Last active
October 2, 2018 11:33
-
-
Save alexandrnikitin/c1f409c0db55de83cda7cb48d464a154 to your computer and use it in GitHub Desktop.
HOWTO: Create FlameGraphs for java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yum install git perf cmake gcc gcc-c++ | |
# generates method mappings | |
cd ~ | |
git clone https://github.com/jrudolph/perf-map-agent.git | |
cd perf-map-agent/ | |
export JAVA_HOME=/opt/jdk1.8.0_91 | |
cmake . | |
make | |
# add -XX:+PreserveFramePointer to java exec cmd | |
cd ~ | |
git clone https://github.com/brendangregg/FlameGraph.git | |
# for jvm PID only | |
export JAVA_HOME=/opt/jdk1.8.0_91 | |
export FLAMEGRAPH_DIR=~/FlameGraph/ | |
export PERF_RECORD_SECONDS=60 | |
ps ax | grep java | |
./perf-map-agent/bin/perf-java-flames <PID> -F 99 -a -g | |
# with kernel stackframes | |
ps ax | grep java | |
export JAVA_HOME=/opt/jdk1.8.0_91 | |
./perf-map-agent/bin/create-java-perf-map.sh <PID> | |
perf record -F 99 -a -g -- sleep 60 | |
perf script > out.perf | |
./FlameGraph/stackcollapse-perf.pl out.perf > out.folded | |
./FlameGraph/flamegraph.pl out.folded > out.svg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment