Skip to content

Instantly share code, notes, and snippets.

@prasanthj
prasanthj / java-async-profiler.txt
Created December 13, 2017 23:41
Java Async Profiler Usage
# Pre-req: gcc, gcc-c++, git (to clone), openjdk with debug symbols (centos: java-1.8.0-openjdk-debug.x86_64, ubuntu: openjdk-8-dbg)
# Git clone async-profiler https://github.com/jvm-profiling-tools/async-profiler
# Make sure JAVA_HOME is set and you are logged as same user running the java process
cd async-profiler
make all
# Also git clone FlameGraph in the same directory as you clone async-profiler
# sysctl changes
echo 1 > /proc/sys/kernel/perf_event_paranoid
echo 0 > /proc/sys/kernel/kptr_restrict
URL_HTML=$1
OUT=$2
if [ "x$URL_HTML"="x" || "x$OUT"="x" ]
then
echo "$0 html outfile"
exit 1
fi
function retry() {
# retry [--limit,-l] [--delay,-d] [--] command args..
[ $# -lt 1 ] && echo "return [-ld] [--] commands [args...]" >&2 && return
LIMIT=5
DELAY=5
while [[ $# > 0 ]]; do
case $1 in
--limit|-l)
shift