HPROF工具通过对采样线程搜集CPU使用信息.以下是从运行的javac中样例输出的一部分.
$ javac -J-agentlib:hprof=cpu=samples Hello.java
CPU SAMPLES BEGIN (total = ) Wed Oct ::
rank self accum count trace method
49.57% 49.57% java.util.zip.ZipFile.getNextEntry
6.93% 56.49% java.util.zip.ZipEntry.initFields
4.76% 61.26% java.lang.ClassLoader.defineClass2
2.81% 64.07% java.util.zip.ZipFile.freeEntry
1.95% 66.02% java.util.Vector.addElement
1.73% 67.75% java.util.zip.ZipFile.getEntry
1.52% 69.26% java.lang.ClassLoader.findBootstrapClass
0.87% 70.13% com.sun.tools.javac.main.JavaCompiler.<init>
0.65% 70.78% java.util.zip.ZipFile.open
0.65% 71.43% com.sun.tools.javac.main.JavaCompiler.<init>
...
CPU SAMPLES END HPROF代理周期对正在运行的线程进行采样.跟踪最活跃的栈.count域指出追踪栈在活跃的时候被发现的次数.
这些被追踪的栈组成应用程序中CPU使用热点