-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trim reversed stacks to prevent sort check from failing #338
Conversation
Thank you! I'm curious though — how can this happen in practice? Like, what causes a function to have a leading space in its name? How do you end up with the file that you included in this PR? |
tests/data/flamegraph/fractional-samples/fractional-with-space.txt
Outdated
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #338 +/- ##
=======================================
Coverage 91.37% 91.38%
=======================================
Files 20 20
Lines 4440 4444 +4
=======================================
+ Hits 4057 4061 +4
Misses 383 383 ☔ View full report in Codecov by Sentry. |
I think some symbols can have
Since the stack frame separator in collapsed files is In our script we have:
Arguably, these collapsed stacks are somewhat incorrect, but having a somewhat incorrect flamegraph beats having none. |
Oh iiiinteresting. That is indeed pretty broken. I wonder if @brendangregg has thought about how the collapse format for flamegraph more broadly should handle symbols with In the meantime, would you mind making the test collapse hold lines more along the lines of what you'd realistically get with a Rust type like |
If the last line of the stack starts with a space, then the space is used in sorting. However, the space is removed when the line is then fed into the flamegraph, which makes the sorting invalid. This commit adds a trim to the reverse process to fix this.
183b090
to
63eed27
Compare
Internally we use
Good idea, updated with a realistic name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Releasing in #339 |
If the last line of the stack starts with a space, then the space is used in sorting. However, the space is removed when the line is then fed into the flamegraph, which makes the sorting invalid. This commit adds a trim to the reverse process to fix this.