perf-cpuprofile

Converts linux perf tool output to .cpuprofile files readable by chromiums devtools

PerfCpuprofile

Converts linux perf tool output to .cpuprofile files readable by chromiums devtools

$ npm install -g perf-cpuprofile

Generate a perf trace:

$ perf record -p `pidof sourceview` -g dwarf

Then simply run:

$ perf-cpuprofile

Or if you have custom file names or just love to pipe:

$ cat custom.perf.data | perf script | perf-cpuprofile -- > custom.cpuprofile

Calling perf-cpuprofile with the argument -- makes it output to stdout instead of writing to the default perf.cpuprofile file.

Then just open up the file in chromiums devtools profile tab, and voilà:

It still has some issues with unresolvable functions and finding the callers for _mcount, but overall, I’m very happy with it :-)

Run node with --perf-basic-prof to prodive js stacks. You can then try to filter the output as explained in this gist.

$ time perf record -F 10000 --no-buffering -g node --harmony --perf-basic-prof /usr/lib/node_modules/nlz/bin/nlz-build.js
$ perf script | egrep "(cycles|LazyCompile|(^$))" | perf-cpuprofile

GPLv3