Skip to content

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

Merged
mstange merged 2 commits into
firefox-devtools:mainfrom
mstange:push-rwkpsqpwxqvt
Oct 28, 2026
Merged

mstange merged 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 (7269a79) to head (1a67b19).
⚠️ Report is 3 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    10917    11020   +103     
========================================
+ 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.

Comment thread src/types/profile-derived.ts Outdated
// This is used for computing the percentages displayed in the call tree.
rootTotalSummary: number;
// The total used as the 100% reference for flame graph box widths.
// Usually equals rootTotalSummary, but for the upper wing it is set to the

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's "upper wing"? Is it a function list thing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes, it's the "callee view" in the function list. I'll just remove that part from the comment.

Comment thread src/profile-logic/flame-graph.ts Outdated
Comment thread src/profile-logic/flame-graph.ts Outdated
…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.
@mstange
mstange enabled auto-merge October 28, 2026 21:46
@mstange
mstange added this pull request to the merge queue Oct 28, 2026
Merged via the queue into firefox-devtools:main with commit f4816d8 Oct 28, 2026
23 checks passed
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.

2 participants