Skip to content

Commit

Permalink
omit 0 weighted synthetic samples
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasBa committed Mar 5, 2025
1 parent 0f69da1 commit a745650
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions static/app/utils/profiling/profile/importProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ export function eventedProfileToSampledProfile(
name: profile.name,
};

let currentTimestamp = profile.events[0]!.at;

for (const current of profile.events) {
if (current.type === 'O') {
stack.push(current.frame);
Expand All @@ -287,21 +289,24 @@ export function eventedProfileToSampledProfile(
throw new TypeError('Unknown event type, expected O or C, got ' + current.type);
}

samples.push({
stack_id: stackId,
thread_id: String(profile.threadID),
timestamp: current.at,
});
if (current.at !== currentTimestamp) {
samples.push({
stack_id: stackId,
thread_id: String(profile.threadID),
timestamp: current.at * 1e-9,
});

stacks[stackId] = stack.slice();
stackId++;
stacks[stackId] = stack.slice();
stackId++;
currentTimestamp = current.at;
}
}

if (stack.length > 0) {
samples.push({
stack_id: stackId,
thread_id: String(profile.threadID),
timestamp: profile.events[profile.events.length - 1]!.at,
timestamp: profile.events[profile.events.length - 1]!.at * 1e-9,
});
stacks[stackId] = stack.slice();
stackId++;
Expand Down Expand Up @@ -367,7 +372,6 @@ export function importAndroidContinuousProfileChunk(

for (const key in samplesByThread) {
const profile: Profiling.ContinuousProfile = {
...input,
...convertedProfile,
frames,
samples: samplesByThread[key]!,
Expand Down

0 comments on commit a745650

Please sign in to comment.