Example flamegraph



The steps for Mac and Linux are explained below, but in both cases ensure to run your app with node version >=0.11.3.


Create a Callgraph

Run your app

node --perf-basic-prof app.js

Use the Instruments Time Profiler to collect stack trace information as follows:

  1. attach Instruments to your running app and excercise it to build the call tree.
  2. expand the part of the call tree you are interested in
  3. Instrument/Export Track to a .csv file
  4. cleanly exit your app and check that a map file was generated at /tmp/perf-<pid>.map


  1. Load the Instruments generated .csv as the Callgraph
  2. Load the /tmp/perf-<pid>.map as the Mapfile


Create Callgraph

Run your app with perf:

perf record -e cycles:u -g -- node --perf-basic-prof app.js

Extract trace from perf.data file

perf script > perf-script.txt


Just loading the perf-script.txt file as the Callgraph suffices since perf already resolved the symbols.
Fork me on GitHub