From 5a2939148f7b6ad902ccfdae6f18b392f92ecffe Mon Sep 17 00:00:00 2001 From: Francesco Vigliaturo Date: Wed, 18 Oct 2023 15:37:32 +0200 Subject: [PATCH] fix: move FixSamplesTime call to speedscope and calltrees methods (#339) * Move FixSamplesTime call to speedscope and calltrees methods --- CHANGELOG.md | 2 ++ internal/profile/android.go | 6 ++++++ internal/profile/legacy.go | 2 -- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0184eb0..bfd8fe5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ **Internal** +- Move FixSamplesTime call to speedscope and calltrees methods([#339](https://github.com/getsentry/vroom/pull/339)) + ## 23.10.0 diff --git a/internal/profile/android.go b/internal/profile/android.go index d8abf60..e437805 100644 --- a/internal/profile/android.go +++ b/internal/profile/android.go @@ -232,6 +232,9 @@ func (p *Android) FixSamplesTime() { // CallTrees generates call trees for a given profile. func (p Android) CallTrees() map[uint64][]*nodetree.Node { + // in case wall-clock.secs is not monotonic, "fix" it + p.FixSamplesTime() + var activeThreadID uint64 for _, thread := range p.Threads { if thread.Name == mainThread { @@ -370,6 +373,9 @@ func (p *Android) NormalizeMethods(pi profileInterface) { } func (p Android) Speedscope() (speedscope.Output, error) { + // in case wall-clock.secs is not monotonic, "fix" it + p.FixSamplesTime() + frames := make([]speedscope.Frame, 0) methodIDToFrameIndex := make(map[uint64][]int) for _, method := range p.Methods { diff --git a/internal/profile/legacy.go b/internal/profile/legacy.go index 610e3a2..bad1bc1 100644 --- a/internal/profile/legacy.go +++ b/internal/profile/legacy.go @@ -239,8 +239,6 @@ func (p *LegacyProfile) Normalize() { t.ReplaceIdleStacks() case *Android: t.NormalizeMethods(p) - // in case wall-clock.secs is not monotonic, "fix" it - t.FixSamplesTime() } if p.BuildID != "" {