Add an insertStackLabels helper.#6076
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6076 +/- ##
=======================================
Coverage 83.82% 83.82%
=======================================
Files 330 330
Lines 34680 34682 +2
Branches 9608 9703 +95
=======================================
+ Hits 29070 29072 +2
Misses 5181 5181
Partials 429 429 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This takes an existing profile and creates label frames based on function name prefix matching. The label frames are inserted as parent stack nodes of the matched stack node. This lets us turn native profiles from e.g. samply into profiles where the JS-only view shows DOM calls.
b9f7919 to
53f9bf4
Compare
| const funcTable = shallowCloneFuncTable(oldFuncTable); | ||
| const stringTable = StringTable.withBackingArray(stringArray); | ||
|
|
||
| const rootLabelName = 'Root (unaccounted / catch-all)'; |
There was a problem hiding this comment.
What does unaccounted mean here? Anything other than the provided label frames?
There was a problem hiding this comment.
Yeah I really wasn't sure what to call this. Unaccounted here means that, if you look at the JS-only call tree in inverted mode, the self samples of this label are any samples that aren't covered by the provided label frames (or JS functions).
| } = profile.shared; | ||
| const frameTable = shallowCloneFrameTable(oldFrameTable); | ||
| const funcTable = shallowCloneFuncTable(oldFuncTable); | ||
| const stringTable = StringTable.withBackingArray(stringArray); |
There was a problem hiding this comment.
We shallow copy frame and func table but not the string array. Should we slice to keep this stringArray immutable?
There was a problem hiding this comment.
No I'd say mutating the stringArray by appending is fine - having unused strings in it doesn't really impact anything.
| const sourceIndex = funcTable.source[funcIndex]; | ||
| if (sourceIndex !== null) { | ||
| const filenameString = stringArray[sources.filename[sourceIndex]]; | ||
| nameString += ` (${filenameString})`; |
There was a problem hiding this comment.
Oh, I see what you mean now. It looks a bit wasteful to compute this for every func, but it's also probably fine for the node script.
I was actually thinking about doing this the other way around. Pre-processing the funcPrefixes array to split the name and file path, so they can be checked individually. But I didn't check the second PR that uses this yet, I don't know how feasible that is. I don't mind either way.
This takes an existing profile and creates label frames based on function name prefix matching. The label frames are inserted as parent stack nodes of the matched stack node.
This lets us turn native profiles from e.g. samply into profiles where the JS-only view shows DOM calls.