Skip to content

[Deploy preview] Add a function list - #5233

Draft
mstange wants to merge 17 commits into
firefox-devtools:mainfrom
mstange:function-list
Draft

[Deploy preview] Add a function list#5233
mstange wants to merge 17 commits into
firefox-devtools:mainfrom
mstange:function-list

Conversation

@mstange

@mstangemstange commented Nov 28, 2024

Copy link
Copy Markdown
Contributor

Deploy preview

WIP implementing the approach outlined in #15 (comment)

@mstange
mstangeforce-pushed the function-list branch 4 times, most recently from 25bc285 to af75e01CompareApril 2, 2026 18:48
@mstange
mstangeforce-pushed the function-list branch 2 times, most recently from 26f8559 to abde12bCompareApril 7, 2026 18:28
@codecov

codecovBot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.15741% with 412 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.47%. Comparing base (a88ef3b) to head (7b7cea8).
⚠️ Report is 1 commits behind head on main.

Files with missing linesPatch %Lines
src/components/calltree/SelfWing.tsx1.85%53 Missing ⚠️
src/components/calltree/WingTreeView.tsx46.93%52 Missing ⚠️
src/profile-logic/flame-graph.ts78.26%39 Missing and 1 partial ⚠️
src/profile-logic/call-node-info.ts88.03%36 Missing ⚠️
src/components/shared/WingContextMenu.tsx79.60%30 Missing and 1 partial ⚠️
src/components/calltree/LowerWingFlameGraph.tsx3.33%29 Missing ⚠️
src/app-logic/url-handling.ts71.60%23 Missing ⚠️
src/components/calltree/UpperWingFlameGraph.tsx31.25%22 Missing ⚠️
src/selectors/per-thread/stack-sample.ts83.58%22 Missing ⚠️
src/reducers/profile-view.ts73.68%20 Missing ⚠️
... and 12 more
Additional details and impacted files
@@ Coverage Diff @@## main #5233 +/- ##
==========================================
- Coverage 83.82% 83.47% -0.36% 
==========================================
Files 350 359 +9 Lines 37744 39388 +1644 Branches 10651 10882 +231 ==========================================
+ Hits 31638 32878 +1240 - Misses 5677 6076 +399 - Partials 429 434 +5 

☔ 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.

@mstange
mstangeforce-pushed the function-list branch 5 times, most recently from 86bf68a to 5059e16CompareJune 24, 2026 20:53
@mstange
mstangeforce-pushed the function-list branch 2 times, most recently from 50bbdd4 to 2667660CompareJuly 3, 2026 19:08
…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 bottom box can currently only be opened for a call node. Add the
equivalent lookup for a bare function index, so that views which select
functions rather than call nodes can open the bottom box too.
Add a new "Function List" tab which shows a flat, sortable list of functions
rather than a tree. Selection is per-function instead of per-call-node, so
this adds selectedFunctionIndex to the per-thread view options along with the
URL handling, reducers and selectors that go with it.
The call tree's context menu operates on a call node path, which the function
list does not have. Add a sibling menu that operates on a function index
instead. The menu items are described by a data table rather than repeated
JSX, because the same set of transforms is about to be reused by more than one
view.
These are the same single-key shortcuts the call tree context menu offers
(m, f, S, c, C, r, R, d), applied to the selected function.
When the function list tab is active, the activity graph should highlight
every sample whose stack contains the selected function, rather than the
samples belonging to a selected call node.
Clicking a sample already selects the corresponding self call node. When the
function list tab is active, also select that call node's function so the
click has an effect there too.
Turn CallNodeInfoInverted from a concrete class into an interface, and rename
the existing class to LazyInvertedCallNodeInfo. Along with that, stop assuming
that an inverted tree has exactly one root per function: the timings are now
keyed by root call node handle, obtained via getRootNodeForFunc(), rather than
by func index directly. For the lazy implementation the two are still the same
number, so this is behavior-preserving.
This makes room for an inverted CallNodeInfo whose roots are restricted to a
single function, which the next commit adds.
The lower wing answers "who calls the selected function?". It is an inverted
tree, but unlike the regular inverted tree it has a single root — the selected
function — and its totals count only the samples in which that function
appears.
LowerWingCallNodeInfo builds that tree eagerly from the selected function's
root-most entry points, expanding by inverted depth as the view asks for it.
computeLowerWingTimings maps each entry point's inclusive time onto the
corresponding node so that the percentages stay relative to the full thread.
The upper wing answers "what does the selected function call?". It is a
non-inverted tree rooted at the selected function, built by re-rooting the
thread's stacks at that function's entry points.
Lay out the lower wing as a flame graph. Because the lower wing tree is
materialized lazily by inverted depth, the layout is computed row by row and
memoizes its prefix sums rather than walking a fully built table.
The flame graph currently derives box widths from rootTotalSummary, which also
serves as the 100% reference for the displayed percentages. The upper wing
needs those to differ: its 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.
The function list is about to grow three "wings" around the selected
function: descendants (upper), ancestors (lower), and self. Each needs its own
selected, expanded and right-clicked call node path.
Rather than adding three more pairs of fields, key the existing per-thread
paths by a CallNodeArea instead of by an isInverted boolean, and add the two
wing areas alongside the two tree areas. The selected function itself moves
into URL state so it can be shared and restored, and is mirrored into the wing
paths as the wings' root.
This commit adds the state, actions, reducers, selectors and URL handling; the
views that consume them follow.
A collapsible section with a header, used by the function list wings in the
next commit. The header can hold extra controls via headerActions.
Render the descendants and ancestors wings next to the function list, each in
its own disclosure box. Both are the same TreeView-based component, differing
only in which selectors they read and which context menu they open.
The function list context menu is now shared between the function list and the
wings, so rename it to WingContextMenu and give it a second connected variant
for the lower wing, whose right-clicked target is a call node rather than a
bare function.
The self wing shows where the selected function spends its own self time. It
is built from the focusSelf-filtered thread, taken before the implementation
filter so that native frames inside a JS function's self time stay visible
when the filter is set to "JS only".
Each wing can now be displayed either as a call tree or as a flame graph, and
WingViewToggle in the disclosure box header switches between them. The choice
is per-wing and persisted in the URL.
Sign up for freeto 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

@mstange