feat: invert call stack in flame graph to render as icicle graph#6090
Conversation
4f7ab4e to
2e38000
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6090 +/- ##
=======================================
Coverage 83.50% 83.50%
=======================================
Files 342 342
Lines 36522 36522
Branches 10233 10221 -12
=======================================
Hits 30497 30497
Misses 5597 5597
Partials 428 428 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Hello, is anyone reviewing this PR? I don't have the permission to request a review. |
|
Unfortunately this implementation is too slow on large profiles. For example, clicking the "Invert call stack" checkbox on this flame graph causes the page to hang permanently: Furthermore, I think this view is only useful if most of the time is spent in a single leaf function. Once you have time spread over many different leaves, the inverted flame graph becomes less useful because all the root nodes will be very small boxes, and then their children are even smaller boxes. However, what can be useful is the inverted flame graph for a single leaf function. In #5233 I'm prototyping a panel where you can select a function on the left side, and then see flame graphs for that function on the right side. When limited to a single function, computing the inverted flame graph can be done in reasonable time because the number of nodes in the tree is much more limited. Here's an example: |
|
Thanks for the large-profile test case. I reproduced the hang locally with the profile from the preview link: computing the inverted flame graph timing for thread I pushed
With the same large profile / thread I also added a regression test for the same-name-node case so the inverted tree does not combine unrelated call paths such as |
|
Actually, I think it would be more appropriate to move the data processing part to WASM. Rust can precisely control memory, and Rust itself provides many tools for benchmarking. |
|
🤖 This pull request will be closed in 15 days if there are no new non-automation comments. tracked by #8 |
This PR extracts some ideas from #6090. But it doesn't add UI to show an inverted flame graph. I'm planning to have an upside-down flame graph in the function list (for the callers of the selected function), so the function list PR depends on this one.
Hmm, interesting. But in the large example, this causes a large gap on the side (maybe 15% of the width) because the positions of the rendered boxes are no longer affected by the (narrow) width of the discarded boxes. It also makes for a rather sluggish experience when you drag a preview selection in the timeline while you're looking at the inverted flame graph, because not much of the flame graph information can be reused across different timings. In the meantime I've landed #6126 and #6128. Can you try out another approach where you make a lazy FlameGraphRowsInverted and FlameGraphTimingsInverted and see if the optimization from #6126 to only render visible rows is good enough to achieve acceptable performance? |
1f13270 to
095b392
Compare
|
Thanks for landing #6126 and #6128. I tested this again after rebasing locally onto current A pure lazy I kept the lazy inverted timing shape, but kept the tiny-descendant pruning for boxes below With that version on the same profile, the inverted selector took ~523ms and materializing rows 0..39 took ~2.24s, producing 28,695 visible boxes without OOM. I also kept the upstream |
095b392 to
9cd7d57
Compare
mstange
left a comment
There was a problem hiding this comment.
Thanks, looks pretty good! Just two minor changes. The performance sounds good enough for now. Maybe in the future we can improve the "drag a preview selection" case by caching more information in the flame graph rows (but only compute that information lazily when the flame graph timings ask for it).
8c8d3bb to
6c83b7d
Compare
6c83b7d to
64fe797
Compare
…lameGraph As requested by the maintainer, this makes the invert state distinct for the call tree and flame graph panels so they default independently to non-inverted when switching tabs.
64fe797 to
5d397d9
Compare
add a invert callstack checkbox.
before:
after:

fix #6077