feat: invert call stack in flame graph to render as icicle graph#6090
feat: invert call stack in flame graph to render as icicle graph#6090cathaysia wants to merge 3 commits into
Conversation
4f7ab4e to
2e38000
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #6090 +/- ##
==========================================
- Coverage 83.69% 83.33% -0.36%
==========================================
Files 338 339 +1
Lines 35693 36098 +405
Branches 9904 10096 +192
==========================================
+ Hits 29873 30084 +211
- Misses 5392 5586 +194
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? |
add a invert callstack checkbox.
before:
after:

fix #6077