Support zoom by click in flame graph#5893
Support zoom by click in flame graph#5893andjsrk wants to merge 4 commits intofirefox-devtools:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5893 +/- ##
==========================================
+ Coverage 85.44% 85.45% +0.01%
==========================================
Files 321 321
Lines 32061 32094 +33
Branches 8753 8843 +90
==========================================
+ Hits 27393 27426 +33
Misses 4236 4236
Partials 432 432 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
IDK why, but my editor did not report any formatting/linting diagnostics, so I accidentally interpreted below as "there is no error, go ahead":
I thought "The output seems it implies there is a problem... but there is no editor diagnostic at all. Ah, comes to think of it, formatters/linters usually print where the problem is, and there is none! I guess it is designed to always print that message, let's just commit it."... Well, actually Prettier and ESLint do print them, but EDIT: Wait, something is weird, |
|
This is cool! It'll take me a while to get used to it, but I think it's worth doing because it'll be familiar to users of SVG flame graphs. Some things I've noticed so far:
I don't have any concrete answers to your questions yet. For the linting troubles, could you file a separate issue? |
|
Maybe we could give the zoom node ancestor boxes a horizontal line at the bottom whose width reflects the amount of zoom? This would make them look different and also indicate how much you're zoomed in. Though if you're zoomed to 1%, the line would be 1% wide and be easy to miss. Ideally, the more you zoomed in, the more present should be the reminder that you're zoomed in. Hmm. Also, I think the flame graph zoom node should be included in the URL, so that you can easily share the view you're looking at. |
|
Ok, how about this:
But for the zoom node and its ancestors, instead of filling the entire box with the zoom fill color, subdivide the box as follows: and the horizontal position and width of the zoom fill "tab" at the top is based on where this box would have been located in the original unzoomed flame graph. |
minimap itself seems good idea, but I have no idea where to place it:
I agree, I'll make a separate state from it.
Currently, if we select a range with no activity, it displays:
Would it be confusing that applying this behavior for zoomed nodes as well? |
Let's implement the segmented fill idea first, and then we can check if we still need a minimap.
Ok yes but that's not what I meant by clicking the activity graph. I mean clicking on a filled pixel in the graph (without moving your mouse). This currently changes the selected call node.
I'm not sure I follow. Can you share an example profile and say what steps to take to get into the state that you're suggesting a behavior change for?
I agree, let's not unset the zoom when you click outside. But we do need a way to reset the zoom. Yes you can click ancestor nodes, but what if the tree has multiple root nodes? Then there's no single root that would include the entire graph. Maybe we need an extra "Total" box at the bottom, like a synthetic "parent node" of all the roots? Then you could make it so that clicking that box resets the zoom completely. |
Great idea! By the way, are node indices(an
I'm lost, could you elaborate on this?
Oh ok. Actually, I have been started using profilers for few weeks, so I'm definitely not experienced, but I think zooming it in would be better.
It is astonishing to me. I thought it is fine to assume that there is only one root node... But yeah, if so, an action is needed. Umm, for now, what comes to mind is only "Total" node, what you suggested. |
No they're not, but you can use the int array encoding of the call path, like we do for "focus on call node" filters. |
|
Hello, EDIT: The problem mentioned in #5893 (comment) makes me able to skip automated checks. As I can commit changes somehow, now this is less important. profiler/src/test/components/WindowTitle.test.tsx Lines 39 to 52 in 144ca4f This test fails on my machine because of localization:
and pushing a commit requires tests to pass. What should I do? I'm considering opening a separate issue/PR then working it around by something like commenting out the test (but only on local environment). |
|
You can skip the requirement with |


Production | Deploy preview
Closes #969
You can zoom in/out flame graph by clicking a box(bar).
Design Questions
Initial Selection
(Implementation detail: the implementation is based on selected call node state.)
The profiler currently determines initially selected call node using some heuristics.
That feature does not only expand call tree, but also set selected call node. The selected call node is shared in tabs, so if you select a call node in call tree tab, it persists in flame graph tab. It means that, if you switch tab to flame graph, what you see is probably unexpected. See below:
Expected:
Actual:
Actually, I experienced this while implementing the feature, and I thought I made a weird bug or there is a bug in state management.
Fixing it to only expand call tree seems desirable to me, although I'm not sure if it is simple as I haven't looked into it closely.
Click on Background
Currently clicking background of graph deselects boxes(bars), leading to get back to the root, which is annoying IMO. Should we keep it selected even we click background?
Help Needed
New color style and its name
It seems that introducing new color style to contrast ascendants with descendants of the selected call node would be good. For your information, "color style" refers to:
profiler/src/utils/colors.ts
Lines 30 to 33 in 3d5a1c1
Anyway, the problem is:
For name, I'm considering "uninterested": we zoom in a box(bar), so its ascendants are uninterested at this time.
Comments appreciated!