Skip to content

Instantly share code, notes, and snippets.

@tomgco
Last active December 11, 2015 12:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomgco/ac0418ed7b42525777c8 to your computer and use it in GitHub Desktop.
Save tomgco/ac0418ed7b42525777c8 to your computer and use it in GitHub Desktop.
How to Flamegraph

How to flamegraph

node --perf_basic_prof index.js

This will create files based on the pid(s) like /tmp/perf-$pid which hold mapping of memory to function names. It will be automatically picked up by linux perf, so just run everything as your local user if you can.

perf record -a -g -F999 -p $(pgrep -n node) -- sleep 120
perf script > output.perf
FlameGraph/stackcollapse-perf.pl < output.perf > out.folded
FlameGraph/flamegraph.pl --hash --colors=js < out.folded > out.svg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment