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