Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add import of v8 heap allocation profile #170
First PR here, but first thanks for the awesome tool !
We plan to integrate it into our product (https://pm2.io/) to visualize all kind of profile that we can take out of NodeJS, for this we needed to be able to render heap allocation that are done by V8 so here it is !
Sorry for not opening an issue first, we just wanted to see if we were able to implement it before bothering you
Wooooaaaah cool! Thanks for doing this and nice work figuring out where to put the necessary code!
Before this can land, in addition to the code review comments that need resolving, I need a few things:
- Instructions for how to record a heap allocation profile like this to be placed into the PR description (I'll use that to update the wiki page: https://github.com/jlfwong/speedscope/wiki/Importing-from-Node.js)
- A minimal checked in example of a heap allocation profile placed in this directory within a subdirectory for the relevant node version https://github.com/jlfwong/speedscope/tree/master/sample/profiles/node
- Leveraging the checked in allocation profile in 2, a test which imports the profile and asserts a snapshot of the contents, like this: https://github.com/jlfwong/speedscope/blob/master/src/import/v8proflog.test.ts
I also don't use yarn for this project, so if you could please remove the yarn.lock file from this PR, that would be much appreciated!
Importing a Heap Profile from the Chrome inspector
Like the CPU Profiling, you can use the Chrome Inspector to record an heap allocation profile, just launch your process with the
Click the start button to start recording a profile.
Now, use your application like you want to and click on the
Click on "save" to save the recorded profile. Save it with the default
You should be able to open that file in https://www.speedscope.app/.
To view it offline, you'll need to install speedscope via
Then you should be able to open it like so:
Sweet! I think all that's left is to run
npm run jest -- -u on this branch & push the result. Once that's done, CI should pass, and I can merge and deploy the result. Thanks for following through with PR feedback so quickly
And done ! thanks for the help for generating the snapshot.
Just to tell you also, i'm working to support an old cpu profile format of v8 (mainly outputted by https://github.com/hyj1991/v8-profiler-node8), which is the current format we use ourselves, so an PR will arrive this week i believe ;)
@vmarchaud thanks for the hard work! This is now merged, published to npm, and deployed to https://www.speedscope.app/. I also updated the documentation here: https://github.com/jlfwong/speedscope/wiki/Importing-from-Node.js#importing-a-heap-profile
Sounds good to me