Skip to content

Some FlameGraph changes, for the function list flame graphs - #6402

Open
mstange wants to merge 2 commits into
firefox-devtools:mainfrom
mstange:push-rwkpsqpwxqvt
Open

mstange wants to merge 2 commits into
firefox-devtools:mainfrom
mstange:push-rwkpsqpwxqvt

Conversation

@mstange

@mstange mstange commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Main | Deploy preview

In #5233, I'm making it so that there's a flame graph for the selected function. If the selected function only has 20% of the samples, we want the flame graph for those 20% to still take up the entire width (100%) of the flame graph canvas, but we want to correctly state 20% in the tooltip.

At the moment the percentages in the tooltip and the percentages of the box widths in the canvas come from the same source.

This PR adds a flameGraphWidthTotal property which decouples those two.

@mstange
mstange requested a review from canova October 19, 2026 22:12
@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.79%. Comparing base (7892c63) to head (76c9da5).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/profile-logic/flame-graph.ts 92.85% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6402   +/-   ##
=======================================
  Coverage   84.78%   84.79%           
=======================================
  Files         358      358           
  Lines       38946    38957   +11     
  Branches    11019    11020    +1     
=======================================
+ Hits        33022    33032   +10     
- Misses       5488     5489    +1     
  Partials      436      436           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…ming.

The Canvas computed the tooltip percentage itself, by subtracting the box's
start from its end. That only works because the non-inverted flame graph
happens to lay boxes out relative to rootTotalSummary. Move the computation
behind a getRatioOfRootTotalSummary() method on FlameGraphTiming so that each
implementation can decide how its box widths relate to the percentage it wants
to display.
The flame graph currently derives box widths from rootTotalSummary, which also
serves as the 100% reference for the displayed percentages. The upcoming
function list wings need those to differ: a wing's root should fill the full
width, while percentages should stay relative to all filtered samples.

Add a separate flameGraphWidthTotal to CallTreeTimings for the width
reference. It equals rootTotalSummary everywhere so far, so nothing changes
yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant