Skip to content

More additions to profiler-edit, for sp3 profiles#6009

Draft
mstange wants to merge 6 commits into
firefox-devtools:mainfrom
mstange:sp3-profiler-edit-features
Draft

More additions to profiler-edit, for sp3 profiles#6009
mstange wants to merge 6 commits into
firefox-devtools:mainfrom
mstange:sp3-profiler-edit-features

Conversation

@mstange
Copy link
Copy Markdown
Contributor

@mstange mstange commented May 8, 2026

This makes it so that you can run profiler-edit with --insert-label-frames browser_labels.toml --only-keep-threads-with-markers-matching='-async,-sync' --merge-non-overlapping-threads-by-name --set-name 'Sp3 5x (with labels, combined main threads)' to turn https://share.firefox.dev/4cXQFED into https://share.firefox.dev/4ezEcsa

The label frames are useful in the JS-only view when applied to profiles from samply; they let us group work like "Paint" and "JS Parsing" (example toml). You can best see them in action in the function list deploy preview: JS-only, ordered by self, with the Self wing showing where the time is spent.

mstange added 6 commits May 7, 2026 15:50
This allows applying wasm symbols to existing profiles that were captured
with a stripped wasm bundle.

The script looks for functions with names of the shape `wasm-function[123]`,
which is what Firefox uses when the wasm file doesn't have a names section.

Usage:

```
yarn build-node-tools && \
node node-tools-dist/profiler-edit.js -i input.json.gz \
--symbolicate-wasm http://host/a.wasm=./a-unstripped.wasm \
--symbolicate-wasm http://host/b.wasm=./b-unstripped.wasm \
-o out.json.gz
```
This command takes a .toml file and adds label frames to a profile based on 
matching function names.

We want to use this for profiles from samply, to insert labels for DOM calls 
and Layout / Style / etc.

Example:
Before: https://share.firefox.dev/48wEADM
After: https://share.firefox.dev/3P9d3BQ

The toml file has to be provided by the user, because the matched function
names are specific to the program being profiled.

Here's an example toml file:
https://gist.github.com/mstange/827c40404c987bc566b8b324efc0a04f
@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

❌ Patch coverage is 63.55786% with 211 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.48%. Comparing base (5783a76) to head (fd67c9e).
⚠️ Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
src/node-tools/profiler-edit.ts 10.41% 172 Missing ⚠️
src/profile-logic/wasm-symbolication.ts 84.21% 17 Missing and 1 partial ⚠️
src/profile-logic/insert-stack-labels.ts 89.47% 12 Missing ⚠️
src/utils/label-templates.ts 95.39% 7 Missing ⚠️
src/profile-logic/merge-compare.ts 71.42% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6009      +/-   ##
==========================================
- Coverage   83.82%   83.48%   -0.34%     
==========================================
  Files         328      331       +3     
  Lines       34254    34832     +578     
  Branches     9572     9610      +38     
==========================================
+ Hits        28712    29079     +367     
- Misses       5114     5324     +210     
- Partials      428      429       +1     

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

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