Skip to content

Instantly share code, notes, and snippets.

@bdelbosc
Last active June 28, 2018 13:46
Show Gist options
  • Save bdelbosc/b50002dab08bf1d19fc7e863d98619cb to your computer and use it in GitHub Desktop.
Save bdelbosc/b50002dab08bf1d19fc7e863d98619cb to your computer and use it in GitHub Desktop.
# install deps
apt-get install cmake build-essential linux-tools-common linux-tools-generic linux-cloud-tools-generic linux-tools-`uname -r` linux-cloud-tools-`uname -r`
# setup JAVA_HOME
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export PATH=/usr/lib/jvm/java-8-oracle/bin:$PATH
git clone https://github.com/jrudolph/perf-map-agent.git /usr/local/perf-map-agent
cd /usr/local/perf-map-agent
cmake .
make
wget -O /usr/local/bin/jmaps https://raw.githubusercontent.com/brendangregg/Misc/master/java/jmaps
chmod +x /usr/local/bin/jmaps
# fix JAVA_HOME set AGENT_HOME in jmaps
vi /usr/local/bin/jmaps
JAVA_HOME=/usr/lib/jvm/java-8-oracle
AGENT_HOME=/usr/local/perf-map-agent
# setup flamegraph
git clone https://github.com/brendangregg/FlameGraph.git /usr/local/FlameGraph
# create a flame-java.sh with the content
cat > /usr/local/bin/flame-java.sh << EOF
#!/bin/bash
out=/tmp/flame.svg
cd /tmp
rm -f ./perf.data
perf record -F 99 -a -g -- sleep 30; /usr/local/bin/jmaps
perf script > /tmp/out.stacks
/usr/local/FlameGraph/stackcollapse-perf.pl /tmp/out.stacks | /usr/local/FlameGraph/flamegraph.pl --color=java --hash > $out
echo "### done: $out"
EOF
# edit the jvm option in nuxeo.conf and add
JAVA_OPTS=$JAVA_OPTS -XX:+PreserveFramePointer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment