diff --git a/static/app/components/profiling/flamegraph/continuousFlamegraph.tsx b/static/app/components/profiling/flamegraph/continuousFlamegraph.tsx index f532f448c4638c..210fd30e52702b 100644 --- a/static/app/components/profiling/flamegraph/continuousFlamegraph.tsx +++ b/static/app/components/profiling/flamegraph/continuousFlamegraph.tsx @@ -138,6 +138,11 @@ function getProfileOffset( return Rect.Empty(); } + // @todo(jonas): uncomment this when we figure out where to anchor android continuous profiles + if (profile.startedAt - startedAtMs < 0) { + return Rect.Empty(); + } + return new Rect(profile.startedAt - startedAtMs, 0, 0, 0); } diff --git a/static/app/utils/profiling/profile/importProfile.tsx b/static/app/utils/profiling/profile/importProfile.tsx index eb0a7ffe08bba9..41a13764972090 100644 --- a/static/app/utils/profiling/profile/importProfile.tsx +++ b/static/app/utils/profiling/profile/importProfile.tsx @@ -293,7 +293,7 @@ export function eventedProfileToSampledProfile( samples.push({ stack_id: stackId, thread_id: String(profile.threadID), - timestamp: current.at * 1e-9, + timestamp: profile.startValue + current.at * 1e-9, }); stacks[stackId] = stack.slice(); @@ -306,7 +306,8 @@ export function eventedProfileToSampledProfile( samples.push({ stack_id: stackId, thread_id: String(profile.threadID), - timestamp: profile.events[profile.events.length - 1]!.at * 1e-9, + timestamp: + profile.startValue + profile.events[profile.events.length - 1]!.at * 1e-9, }); stacks[stackId] = stack.slice(); stackId++; @@ -363,14 +364,12 @@ export function importAndroidContinuousProfileChunk( samplesByThread[sample.thread_id]!.push(sample); } - for (const key in samplesByThread) { - samplesByThread[key]!.sort((a, b) => a.timestamp - b.timestamp); - } - const profiles: ContinuousProfile[] = []; let activeProfileIndex = input.activeProfileIndex ?? 0; for (const key in samplesByThread) { + samplesByThread[key]!.sort((a, b) => a.timestamp - b.timestamp); + const profile: Profiling.ContinuousProfile = { ...convertedProfile, frames, @@ -442,14 +441,11 @@ export function importSentryContinuousProfileChunk( samplesByThread[sample.thread_id]!.push(sample); } - for (const key in samplesByThread) { - samplesByThread[key]!.sort((a, b) => a.timestamp - b.timestamp); - } - const profiles: ContinuousProfile[] = []; let activeProfileIndex = 0; for (const key in samplesByThread) { + samplesByThread[key]!.sort((a, b) => a.timestamp - b.timestamp); const profile: Profiling.ContinuousProfile = { ...input, ...input.profile,