Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New CPU Profile Format #21

Open
thlorenz opened this issue Apr 18, 2017 · 4 comments
Open

New CPU Profile Format #21

thlorenz opened this issue Apr 18, 2017 · 4 comments

Comments

@thlorenz
Copy link
Owner

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

@pmuellr
Copy link

pmuellr commented Sep 28, 2017

I have some converters from the "old" v8-profiler format, to the new inspector "1.2" format, here: https://github.com/moar-things/moar-profile-viewer/tree/master/lib/profile

@thlorenz
Copy link
Owner Author

Well we'd need the opposite of that. However I believe it's better to make the processor handle the new format.
However if we had that then maybe we can drop support for the old format and use your converter to adapt it to the new format instead before processing.

@cmdcolin
Copy link
Contributor

Any progress on this by chance? Really love using this tool :)

@thlorenz
Copy link
Owner Author

No, I'm debating to retire this tool and tell people to use 0x instead.
It cannot load devtools profiles either, but is much easier to use (actually lots of ideas + modules came from here) :)

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

No branches or pull requests

3 participants