-
Notifications
You must be signed in to change notification settings - Fork 54
CPU Flame Graph
Johannes Rudolph edited this page Aug 5, 2015
·
7 revisions
Here is an example output for this page.
Download Brendan Gregg's FlameGraph tool
git clone https://github.com/brendangregg/FlameGraph.git
Download the example jar file
wget http://blog.minzhou.info/perfj/leveldb-benchmark.jar
Run java program with frame pointer preserved
java -cp leveldb-benchmark.jar -XX:+PreserveFramePointer org.iq80.leveldb.benchmark.DbBenchmark –benchmarks=fillrandom –num=100000000
Profile CPU usage by PerfJ
bin/perfj record -F 99 -g -p `pgrep -f DbBenchmark`
After a while use Ctrl+C to terminate the profiling. You will see a file named perf.data
in the current working directory. Move it into FlameGraph
directory.Follow below steps
sudo mv perf.data ../FlameGraph
cd ../FlameGraph
sudo perf script | ./stackcollapse-perf.pl > out.perf-folded
./flamegraph.pl out.perf-folded –colors java > perfj.svg