Skip to content

Annotate inlined frames in CLI call trees and stacks#6041

Merged
canova merged 1 commit into
firefox-devtools:mainfrom
canova:pq-inline-frames
May 21, 2026
Merged

Annotate inlined frames in CLI call trees and stacks#6041
canova merged 1 commit into
firefox-devtools:mainfrom
canova:pq-inline-frames

Conversation

@canova

@canova canova commented May 21, 2026

Copy link
Copy Markdown
Member

Fixes #6039

Some frames in a profile are inlined into their caller's machine code by the compiler. The profiler frontend marks these with a small "inl" badge and a tooltip naming the outer function, but the CLI previously gave no hint, so consumers could not tell that an inlined frame's body actually executes inside another function and would treat it as an independent call site.

Each call tree node and heaviest-stack frame now carries an inlineStatus of 'inlined' or 'divergent', derived from CallNodeInfo.sourceFramesInlinedIntoSymbolForNode The CLI formatter appends (inl) or (inl?) after the function name and, when at least one frame in the output is inlined, prints a one-line legend above the tree / heaviest stack explaining the markers.

STR:

  • Get the profiler-cli binary from the build-prod task
  • Load a profile, for example <path-to-cli> load https://share.firefox.dev/4mJMKyt
  • Do pq thread samples-bottom-up or pq thread samples.

Example output:

[Thread: t-54 (GeckoMain) | View: Full profile | Full: 5.810s]

Thread: Privileged Content

Note: active samples only (idle excluded) — use --include-idle to include idle samples.

Bottom-Up Call Tree:
Note: (inl) = inlined by the compiler into the nearest non-inlined ancestor above. (inl?) = some calls were inlined by the compiler.

f-9539. libsystem_kernel.dylib!__bsdthread_ctl [total: 3.4%, self: 3.4%]
└─ f-13479. XUL!(anonymous namespace)::HangMonitorChild::RecvSetMainThreadQoSPriority(nsIThread::)::$_0::operator()() const (inl) [total: 3.4%, self: 0.0%]
   f-13478. XUL!mozilla::detail::RunnableFunction<(anonymous namespace)::HangMonitorChild::RecvSetMainThreadQoSPriority()::$_0>Run() [total: 3.4%, self: 0.0%]
...

@canova canova requested review from fatadel and mstange May 21, 2026 16:05
@codecov

codecov Bot commented May 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.92308% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.77%. Comparing base (3182970) to head (cc539d1).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/profile-query/formatters/call-tree.ts 60.00% 4 Missing ⚠️
src/profile-query/formatters/thread-info.ts 87.50% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6041      +/-   ##
==========================================
- Coverage   83.78%   83.77%   -0.01%     
==========================================
  Files         329      329              
  Lines       34528    34546      +18     
  Branches     9659     9677      +18     
==========================================
+ Hits        28930    28942      +12     
- Misses       5169     5175       +6     
  Partials      429      429              

☔ View full report in Codecov by Sentry.
📢 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 mstange left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

expect(formatted).not.toContain('Note: (inl)');
});

it('shows (inl, divergent) for inverted call nodes with conflicting inlining', function () {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The description says (inl, divergent) but we check for (inl?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah yeah, thanks for catching that! Initially I added "(inl, divergent)" but then thought it's too long, and converted it into "(inl?)" with a legend that explains what it means.

Some frames in a profile are inlined into their caller's machine code by
the compiler. The profiler frontend marks these with a small "inl" badge
and a tooltip naming the outer function, but the CLI previously gave no
hint, so consumers could not tell that an inlined frame's body actually
executes inside another function and would treat it as an independent
call site.

Each call tree node and heaviest-stack frame now carries an
`inlineStatus` of `'inlined'` or `'divergent'`, derived from
`CallNodeInfo.sourceFramesInlinedIntoSymbolForNode` The CLI formatter
appends `(inl)` or `(inl?)` after the function name and, when at least
one frame in the output is inlined, prints a one-line legend above the
tree / heaviest stack explaining the markers.
@canova canova force-pushed the pq-inline-frames branch from 28744d2 to cc539d1 Compare May 21, 2026 16:50
@canova canova merged commit 47d5c86 into firefox-devtools:main May 21, 2026
21 of 23 checks passed
@canova canova mentioned this pull request May 26, 2026
canova added a commit that referenced this pull request May 26, 2026
Changes:

[fatadel] Remove unused dependencies from package.json (#6010)
[Nazım Can Altınova] Make profiler-cli work in sandboxed environments
(#6003)
[Markus Stange] Make profiler-edit run profile compacting before writing
out the file (#6015)
[Markus Stange] Migrate from prettier to oxfmt (#5986)
[Markus Stange] Add a --symbolicate-wasm arg to profiler-edit. (#6008)
[Markus Stange] Build and upload the cli artifact in PRs (#6020)
[Markus Stange] Use @streamparser/json if the input is too large to fit
in a V8 string (#6016)
[Nazım Can Altınova] Print also the status output right after cli `load`
command (#6019)
[Nicolas Chevobbe] Update devtools-reps to 0.27.7 (#6030)
[Nazım Can Altınova] Include `--search` option in `pq filter push`
(#6026)
[Nazım Can Altınova] Update all Yarn dependencies (2026-05-20) (#6033)
[fatadel] Translate URL track-index state through profile sanitization
(#6000)
[Markus Stange] Make withSize use a wrapper element so that it can stop
calling findDOMNode (#5988)
[Markus Stange] Fix dhat importer (#6036)
[Nazım Can Altınova] Annotate inlined frames in CLI call trees and
stacks (#6041)
[Nazım Can Altınova] Use proper types in cli tests instead of custom
inline types (#6038)
[Nazım Can Altınova] Fix text truncation for frames named after
Object.prototype methods (#6044)
[Nazım Can Altınova] Add missing key props to CodeErrorOverlay error
list items (#6047)
[depfu[bot]] ⬆️ Update oxfmt to version 0.51.0 (#6054)
[Nazım Can Altınova] 🔃 Sync: l10n -> main (May 26, 2026) (#6058)
[Nazım Can Altınova] Use URL-state symbol server for `profiler-cli
function annotate` (#6051)
[Nazım Can Altınova] Bump profiler-cli version to 0.2.0 (#6059)

And special thanks to our localizers:

fr: YD
sr: Марко Костић (Marko Kostić)
tr: Ali Demirtaş
zh-CN: Olvcpr423
zh-CN: wxie
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.

Make it more obvious which frames are inlined in profiler-cli

2 participants