GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Flamegraph usability improvements: legend, toolbar, context menu by krk · Pull Request #1140 · async-profiler/async-profiler Conversation
|
|
Should we mimic the one in https://github.com/async-profiler/async-profiler/blob/master/docs/FlamegraphInterpretation.md#understanding-flamegraph-colors? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const legendDetail = document.getElementById('legendDetail'); | ||
| const legendItems = legendDetail.getElementsByTagName('div'); | ||
| for(let i = 0; i < palette.length; i++) { | ||
| legendItems[i].style.backgroundColor = getColor(palette[i]); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
getColor returns random color within palette range. Should we use stable color for the legend?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yes. Colors will not match exactly to what is in the flamegraph in any case, I don't mind either way.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| search(true); | ||
| } | ||
|
|
||
| document.getElementById('legend').onclick = function() { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
What if a legend appears automatically when hovering over? Won't it be a better UX?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I imagine accidental appearances would not be helpful. Other buttons in the same area work with a click, I think this is consistent.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I love this and I'm really looking forward for this being integrated! I have two suggestions though: please consider choosing more distinct colors for interpreted frames. Interpreted code is really a performance killer and should clearly stand out in a flame graph. The second suggestion is about naming. We currently have "jitted" and "c1 compiled" but c1 compiled is also jitted. So consider renaming jitted into "c2 compiled". Also, I'm not sure how AsyncProfiler is displaying JVMCI compiled frames? Are they currently shown as "jitted"? In that case, replacing "jitted" with "c2 compiled" might be a bad choice and "JIT highest tier" and "JIT low tier" might be a better alternative. To further complicate things, we can have C1, C2 and JVMCI compiled methods if we're running the Graal compiler in hosted mode (for Truffle only) but I'm not sure if C2 and JVMCI compiled methods will be distinguishable in that case? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Some more comments/suggestions:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thank you @simonis for your suggestions.
Created #1191 to track this improvement. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @krk, that looks pretty neat now. I like the pop-up version much more than the previous version. The new button now displays fine on Linux. The only remaining nit-picking from me would be to change the label for "C++" frames from "C++" to something like "C++ (VM)" to make it clear that this is HotSpot code in contrast to all the other native code which might also be C++ code. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
unrelated failure: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
|
|
||
| document.getElementById('legend').onclick = function() { | ||
| legend = !legend; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This variable ^^^ isn’t reset to false when the popup closes, so the user must click the "legend" button twice to reopen it. Since the pop-up overlays the page, it’s probably ok to remove this flag altogether.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
8a03457 to
4df3390
Compare
|
Updated based on latest offline discussions. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Image became 3830px wide - was it intentional change? IMO, this is too large.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
High dpi screenshot, fixing.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| a {color: #0366d6} | ||
| #hl {position: absolute; display: none; overflow: hidden; white-space: nowrap; pointer-events: none; background-color: #ffffe0; outline: 1px solid #ffc000; height: 15px} | ||
| #hl span {padding: 0 3px 0 3px} | ||
| #hl span {padding: 0 2px 0 2px} |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why are all these changes in margins and paddings?
Now, frame title jumps whenever I hover a pointer over it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Hm.. might depend on the OS/browser. It does not jump in Chrome.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
|
|
||
| function search(r) { | ||
| function search(r, resetZoom) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
How resetZoom is related to search?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
search is used as the rendering method. In any case, removing the resetZoom argument.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| pattern = r ? RegExp(r) : undefined; | ||
|
|
||
| if (resetZoom) { | ||
| root = origRoot; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
What is origRoot? Can it be different from the all frame at level 0?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
origRoot is the root of the first search call, which should be the all frame. Renaming to allRoot.
Using levels[0][0] now.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| canvas.style.cursor = 'pointer'; | ||
| canvas.onclick = function() { | ||
| if (event.altKey && h >= root.level) { | ||
| if (event.altKey && h > root.level) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
OK, "all" frame should never be removed, but otherwise what's wrong with deleting stack at current level?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixing by disallowing removal of all only.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| function invertMode() { | ||
| inverted = !inverted; | ||
| btnInvert.style.rotate = inverted ? '180deg' : '0deg'; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
nit: the icon is rotated, but the graph is mirrored, not the same thing :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
But seriously, I'd prefer a static icon (like up-down triangles or whatever you invent). Two-state toggle buttons are always confusing: whether they show current state or a state to switch to.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Changed to a static icon.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't think the image in docs is worth replacing with a roughly cropped screenshot, especially since it duplicates information already available on a flamegraph and includes info about shortcuts which is irrelevant here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| <div id="search" class="toolbarIcon" title="Search by Regex [Ctrl + F]"><svg height="20px" width="20px" viewBox="-39.26 -39.26 471.13 471.13" xml:space="preserve" fill="#000000" stroke="#000000" stroke-width="0.00392609"><path style="fill:#FFFFFF;" d="M273.713,147.774c0,69.495-56.501,125.931-125.931,125.931c-69.495,0-125.931-56.501-125.931-125.931 c0-69.495,56.501-125.931,125.931-125.931C217.212,21.843,273.713,78.344,273.713,147.774z"></path><path style="fill:#40b2ff;" d="M370.747,348.695c0,1.422-1.616,6.271-7.176,12.283c-6.206,6.659-12.477,9.762-14.739,9.762h-0.065 c-19.459-1.616-61.996-43.184-109.576-106.796c0-0.065,0-0.065,0-0.129c9.18-7.24,17.455-15.515,24.63-24.63 c0.065,0,0.065,0,0.129,0C327.564,286.699,369.131,329.301,370.747,348.695z"></path><path style="fill:#ff8d40;" d="M208.679,86.877l-14.481,14.481c-17.131,17.131-46.545,5.042-46.545-19.265V61.6 c-49.002,0-88.372,40.792-86.109,90.246c2.004,43.895,38.141,80.032,82.036,82.036c49.455,2.263,90.246-37.172,90.246-86.109 C233.956,124.049,224.323,102.522,208.679,86.877z"></path><path style="fill:#004d80;" d="M276.105,220.954c12.347-21.527,19.459-46.545,19.459-73.18c0-81.455-66.327-147.717-147.846-147.717 S0,66.32,0,147.904s66.327,147.717,147.717,147.717c26.57,0,51.523-7.111,73.18-19.459 c39.822,53.333,91.863,113.519,126.061,116.364c12.283,0.517,22.885-6.723,32.776-16.743c5.172-5.624,13.77-16.937,12.8-28.768 C389.624,312.881,329.438,260.776,276.105,220.954z M147.717,273.77c-69.495,0-125.931-56.501-125.931-125.931 S78.287,21.908,147.717,21.908s125.931,56.501,125.931,125.931S217.212,273.77,147.717,273.77z M363.572,360.978 c-6.206,6.659-12.412,9.762-14.739,9.762h-0.065c-19.459-1.616-61.996-43.184-109.576-106.796c0-0.065,0-0.065,0-0.129 c9.18-7.24,17.455-15.515,24.63-24.63c0.065,0,0.065,0,0.129,0c63.612,47.58,105.18,90.182,106.796,109.576 C370.747,350.118,369.131,354.966,363.572,360.978z"></path></svg></div> | ||
|
|
||
| <div id="invert" class="toolbarIcon" title="Invert Graph [I]"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 16 L6 12 L14 12 Z" fill="#ff8d40"/><line x1="4" y1="10" x2="16" y2="10" stroke="#004d80" stroke-width="2"/><path d="M10 4 L6 8 L14 8 Z" fill="#004d80" opacity="0.7"/><path d="M2 8 L2 12" stroke="#004d80" stroke-width="1.5" stroke-linecap="round"/><path d="M18 12 L18 8" stroke="#004d80" stroke-width="1.5" stroke-linecap="round"/></svg></div> |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This icon looks more like a splitter. IMO it will be better without side vertical lines and with a bit larger triangles.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| <div class="title-toolbar-container"> | ||
| <div class="left-toolbar"> | ||
| <div id="graph-info" class="toolbarIcon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="10" cy="10" r="8" stroke="#004d80" stroke-width="1" fill="none"/><path d="M10 5.5C8.75 5.5 7.75 6.5 7.75 7.75H9C9 7.06 9.56 6.5 10.25 6.5C10.94 6.5 11.5 7.06 11.5 7.75C11.5 8.4 10.95 8.75 10.5 8.95C9.8 9.3 9.25 9.8 9.25 10.75V11H10.75V10.75C10.75 10.38 11.04 10.1 11.43 9.92C12.16 9.58 12.75 9.05 12.75 7.75C12.75 6.5 11.25 5.5 10 5.5Z" fill="#ff8d40" stroke="#ff8d40" stroke-width="0.6" stroke-linecap="round" stroke-linejoin="round"/><circle cx="10" cy="13.5" r="1" fill="#ff8d40"/></svg></div> |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
WDYT about changing order of icons to match previous layout? E.g., Invert button first, then Search, and Help in the end.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (devicePixelRatio) c.scale(devicePixelRatio, devicePixelRatio); | ||
| c.font = document.body.style.font; | ||
|
|
||
| function positionTooltip(e) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Does it even need to float? Static position will be more than enough. It should make code simpler.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
"Need" is a strong word for a UI choice. Made it static anyway.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| btnInvert.onclick = function(e) { | ||
| invertMode(); | ||
| e.preventDefault(); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why is it needed? Is there a default behavior for onclick at all?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This was to help with Chrome selecting title on double-click, doing some cleanup.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| e.preventDefault(); | ||
| e.stopPropagation(); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This repeats in several places. Doesn't return false have the same effect?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| window.scroll(0, inverted ? root.level * 16 : canvasHeight - (root.level + 1) * 16); | ||
| canvas.onmousemove(); | ||
| } else if(event.ctrlKey || event.metaKey) { | ||
| switch(event.key) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Rewriting the function with two switch statements did not make it any cleaner or more readable. On the contrary, this excessively increased nesting level. IMO, switches do not make sense here, especially with one label only.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
There used to be more cases. switch makes it clearer as opposed to composite if-conditions. Converting to if chain.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
It's very unobvious what "Highlight" and "Hide frame" menu items do when popup menu is opened on an empty space of a flamegraph. I also realized that I feel frustrated when a webpage does not allow me to open the default popup menu by replacing it with a custom popup. Highlighting frame type is a funny feature, but I'm not sure its value outweighs the price |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
You could do Shift + Right Click to get the browser's context menu. Additionally, I will fix so only frames will have the custom context menu. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Fixed too. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Context menu feature removed based on offline discussions. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Unrelated test failure: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| align-items: center; | ||
| flex-grow: 1; | ||
| } | ||
| .toolbar-section { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Unused?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| .top { | ||
| border-top: .1px solid #000 | ||
| } | ||
| .left { | ||
| border-left: .1px solid #000 | ||
| } | ||
| .bottom { | ||
| border-bottom: .1px solid #000 | ||
| } | ||
| .right { | ||
| border-right: .1px solid #000 | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't see usages of these classes.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| align-items: center; | ||
| cursor: pointer; | ||
| } | ||
| .toolbarSelected { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Unused?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| .right { | ||
| border-right: .1px solid #000 | ||
| } | ||
| .toolbarIcon { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent naming style: some classes use camelCase, but some use kebab-case.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| Shift + N - Focus on previous match<br> | ||
| Esc - Cancel search<br> | ||
| <br> | ||
| I - invert graph<br> |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Invert (uppercase)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| </div> | ||
| </div> | ||
|
|
||
| <div class='bordered' style="display: flex; flex-direction: column;"> |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
What are these styles for?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| btnInfo.onmousedown = function() { | ||
| return false; | ||
| }; | ||
|
|
||
| btnInfo.ondblclick = function(e) { | ||
| return false; | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Somewhere function() and somewhere function(e)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } else if ((event.key === 'n' || event.key === 'N') && nav.length > 0) { | ||
| } else if((event.ctrlKey || event.metaKey) && event.key === 'f') { | ||
| search(true); | ||
| } else if (event.key === 'n' && nav.length > 0) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
event.key === 'N' was essential for Shift+N to work.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } else if (event.key === '0') { | ||
| resetZoom(); | ||
| } | ||
| return false; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why is that? Standard combinations like reload (Ctrl+R), Zoom (Ctrl+, Ctrl-) etc. no longer work.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Moved return false to only handled combinations. For example when Ctrl+F is pressed, search popup is shown. Without return false, browser search is also activated.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
How come new image is smaller but its size on disk is 240% bigger?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Took a new screenshot and ran it through optipng. Previous image looks like it was scaled up. If I have to hypothesize, I could say previous image had less entropy because of the scaling, hence more compressible.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I did some modifications: https://profiler.tools/tmp/flamegraph-legend.html |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Cannot repro this on latest Chrome + Ubuntu 24. Added |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Co-authored-by: Kerem Kat <[email protected]>
Co-authored-by: Kerem Kat <[email protected]>
|
Integrated with some modifications. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.