支持对 java 语言的性能分析,包括:
- cpu
- allocs, 内存分配
- lock, 锁
- wall,所有线程状态
以及将 java pprof 关联到对应的源代码。
所有的性能文件均针对线程做收集。
cpu
通过 perf 获取调用栈,asyncGetCallTrace 得到对应的函数。
这样得到的性能文件将会非常精确。
memory
通过接受 jdk.ObjectAllocationInNewTLAB, jdk.ObjectAllocationOutsideTLAB 事件,我们可以得到一段时间内的 java 堆内存分配。
同时,能够获取到这块内存是为了哪些对象分配的。
lock
通过监听 monitor 事件,我们可以获取 synchornized 关键字的耗时,包括想要同步的对象。 通过重载 park 函数,我们可以获取到 ReentrantLock,ReentrantReadWriteLock,Semaphore 等锁的好时。
wall
每隔一点时间,获取所有线程的调用栈以及状态。
- running,运行中。
- sleeping,睡眠io或者 block 等其他状态。
source code
通过反编译 jar 文件,成功的将 java 源代码与性能文件关联了起来。
1,jar xf jar file
2, decompile all jar file in lib directory
3, rewrite java file to make line number consistent