Skip to content

Instantly share code, notes, and snippets.

@ksmyth
Last active August 29, 2015 14:16
Show Gist options
  • Save ksmyth/606d952587a2c4842e4e to your computer and use it in GitHub Desktop.
Save ksmyth/606d952587a2c4842e4e to your computer and use it in GitHub Desktop.
Node.js flamegraphs on Ubuntu
sudo apt-get install -y build-essential git-core linux-tools-common linux-base
git clone https://github.com/joyent/node.git
cd node
git checkout origin/v0.11.14-release
./configure && make && sudo make install
node --perf-basic-prof app.js
sudo sysctl kernel/kptr_restrict=0
sudo bash
perf record -F 99 -p `pgrep -n node` -g -- sleep 30
# OR perf record -F 99 -p `pgrep -o node` -g -- sleep 30
perf script > out.nodestacks01
[ -d FlameGraph ] || git clone --depth 1 http://github.com/brendangregg/FlameGraph
cd FlameGraph
./stackcollapse-perf.pl < ../out.nodestacks01 | ./flamegraph.pl > ../out.nodestacks01.svg
cd ..
@lattmann
Copy link

lattmann commented Mar 2, 2015

After line 2 add cd node
Line 4 should be ./configure && make && sudo make install
After line 10: apt-get -y install linux-tools-common linux-base

kernel specific apt-get -y install linux-tools-3.13.0-46-generic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment