-
-
Notifications
You must be signed in to change notification settings - Fork 28
Description
When saving a cpu profile from DevTools the emitted format is different from what this app expects (it changed).
At this point I have no bandwidth fixing this, but am documenting the changes as far as I understand them by now.
Changes
Properties
The properties of a profile changed.
pad > oldKeys
[ 'typeId',
'uid',
'title',
'head',
'startTime',
'endTime',
'samples' ]
pad > newKeys
[ 'nodes', 'startTime', 'endTime', 'samples', 'timeDeltas' ]
Nodes/Callgraph
head used to be the entry point to all nodes by following the nested children (which also mirrored the callgraph).
Now we have a nodes Array each of which has a flat Array of children ids. The actual child node needs to be resolved from the same nodes array.
The call graph needs to be reconstructed from that information as well as it now isn't mirrored like it was before.
Samples/Time Deltas
Samples didn't change, however we have an additional Array, timeDeltas. This tells us the time in between each sampling tick. Turns out that time is not perfectly constant (can very by about 30%) and thus this information can be used to correct the amount of time spent in a function.
Especially when aggregating this data to create a flamegraph this correction could prove important.
Changes Needed
The processor needs to be able to handle this new format. To just get it to work it mainly needs to be able to lookup the children by id and somehow reconstruct the callgraph.
Since these scripts were adapted from perl scripts and steps are not perfectly isolated, this change may affect multiple parts of the processor.
Compatibility
In order to still work for the old format, the processor would need to be able to handle both, or we need a function that transforms old profiles to the new format (IMO the better solution).