Add an --insert-label-frames argument to the profiler-edit tool#5966
Merged
Conversation
c303031 to
39b7942
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5966 +/- ##
==========================================
- Coverage 83.70% 83.69% -0.02%
==========================================
Files 337 338 +1
Lines 35575 35693 +118
Branches 9971 9904 -67
==========================================
+ Hits 29778 29873 +95
- Misses 5369 5392 +23
Partials 428 428 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
83cd29e to
7354e3c
Compare
55816ce to
952d57e
Compare
057b358 to
560ba64
Compare
canova
reviewed
Jun 4, 2026
Comment on lines
+109
to
+114
| if (line !== null && col !== null) { | ||
| name += ` (${filename}:${line}:${col})`; | ||
| } else if (line !== null) { | ||
| name += ` (${filename}:${line})`; | ||
| } else { | ||
| name += ` (${filename})`; |
Member
There was a problem hiding this comment.
The comment above mentions that it mirrors getLabelIndexForFunc, but it doesn't seem like it matches fully.
getLabelIndexForFunc constructs it like (${filename}), but this one does it like (${filename}:${line}:${col}).
| autoLabels: AutoLabel[]; | ||
| }; | ||
|
|
||
| import { parse as parseToml } from 'smol-toml'; |
Member
There was a problem hiding this comment.
nit: can we move this to the top of the file?
560ba64 to
9563cd2
Compare
In the past we had a hardcoded list of DOM methods in the label matchers.
This modification lets us replace 100 explicit labels of this type:
```
[[labels]]
name = "Document.querySelector"
funcPrefixes = [
"mozilla::dom::Document_Binding::querySelector(",
"blink::`anonymous namespace'::v8_document::QuerySelectorOperation",
"blink::(anonymous namespace)::v8_document::QuerySelectorOperation",
"WebCore::jsDocumentPrototypeFunction_querySelector",
]
```
with one auto label of this type:
```
[[auto_labels]]
nameTemplate = "{Class}.{method}"
funcPrefixTemplates = [
"mozilla::dom::{Class}_Binding::{method}(",
"blink::`anonymous namespace'::v8_{Class:blink_snake}::{method:pascal}Operation",
"blink::(anonymous namespace)::v8_{Class:blink_snake}::{method:pascal}Operation",
"WebCore::js{Class}PrototypeFunction_{method}",
]
```
fixup auto labels
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
9563cd2 to
2cb282f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on #6076.
This lets us create profiles like https://share.firefox.dev/4mPPTgr with DOM label frames that show up in the JS-only view, for profiles from samply, based on function name matching. The matchers are declared in a toml file that is passed to the script.
Example TOML file: https://gist.github.com/mstange/827c40404c987bc566b8b324efc0a04f