菜菜

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
HPROF工具通过对采样线程搜集CPU使用信息.以下是从运行的javac中样例输出的一部分.
$ javac -J-agentlib:hprof=cpu=samples Hello.java
CPU SAMPLES BEGIN (total = 462) Wed Oct 4 13:33:07 2006
rank self  accum  count trace     method
1   49.57% 49.57% 229   300187 java.util.zip.ZipFile.getNextEntry
2   6.93%  56.49% 32    300190 java.util.zip.ZipEntry.initFields
3   4.76%  61.26% 22    300122 java.lang.ClassLoader.defineClass2
4   2.81%  64.07% 13    300188 java.util.zip.ZipFile.freeEntry
5   1.95%  66.02% 9     300129 java.util.Vector.addElement
6   1.73%  67.75% 8     300124 java.util.zip.ZipFile.getEntry
7   1.52%  69.26% 7     300125 java.lang.ClassLoader.findBootstrapClass
8   0.87%  70.13% 4     300172 com.sun.tools.javac.main.JavaCompiler.<init>
9   0.65%  70.78% 3     300030 java.util.zip.ZipFile.open
10  0.65%  71.43% 3     300175 com.sun.tools.javac.main.JavaCompiler.<init>
...
CPU SAMPLES END

HPROF代理周期对正在运行的线程进行采样.跟踪最活跃的栈.count域指出追踪栈在活跃的时候被发现的次数.
这些被追踪的栈组成应用程序中CPU使用热点

 

posted on 2018-04-09 00:07  好吧,就是菜菜  阅读(224)  评论(0编辑  收藏  举报