官方文档
https://github.com/jvm-profiling-tools/async-profiler
下载编译
git clone https://github.com/jvm-profiling-tools/async-profiler
cd async-profiler
make
使用命令
可以看到使用的方式是:Usage: ./profiler.sh [action] [options] ,也就是 命令+操作+参数+PID
./profiler.sh -d 30 -f profile.svg 3456
这个命令的意思是,对 PID 为 3456 的 java 进程采样 30 秒,然后生成 profile.svg 结果文件。
默认情况下是分析 CPU 性能,如果要进行其他分析,可以使用 -e 参数。
-e event profiling event: cpu|alloc|lock|cache-misses etc.
可以看到支持的分析事件有 CPU、Alloc、Lock、Cache-misses 。