Java -Xprof 输出的解释

Explanation of Java -Xprof Output

我正在尝试解释通过指定 -Xprof 标志生成的分析输出。

对于我的应用程序,我得到这样的分析输出:

 Flat profile of 8.34 secs (775 total ticks): main
  Interpreted + native   Method
 10.4%    66  +    12    java.lang.ClassLoader.defineClass1
  3.6%    27  +     0    java.nio.HeapCharBuffer.<init>
  2.5%     1  +    18    java.io.UnixFileSystem.getBooleanAttributes0
...
 74.4%   380  +   179    Total interpreted (including elided)
     Compiled + native   Method
  0.3%     0  +     2    java.util.jar.JarFile.hasMoreElements
  0.3%     0  +     2    org.reflections.vfs.ZipDir.computeNext
  0.1%     0  +     1    java.lang.Object.<init>
...
  1.7%     3  +    10    Total compiled
         Stub + native   Method
  7.5%     0  +    56    java.util.zip.ZipFile.getEntry
  4.7%     0  +    35    java.lang.Object.getClass
  3.2%     0  +    24    java.lang.System.arraycopy
...
 23.2%     0  +   174    Total stub
  Thread-local ticks:
  3.1%    24             Blocked (of total)
  0.7%     5             Class loader

对于每个线程。我的问题是 InterpretedCompiledStub 方法之间有什么区别,什么是 Thread-local ticks+ native 列的含义是什么? -Xprof 探查器是否有任何规范文档?谷歌搜索 Xprof 收效甚微。

我唯一能找到有关 XProf 等工具的信息的地方是一些(稍旧的)纸质 Java 书籍。

  • Interpreted + native:该图显示了 JVM 在执行解释方法时使用的 ticks。额外的(+本机)列显示了这些解释方法调用的本机 C 方法。
  • Compiled + native:此图显示了已被 JIT compiler 解析的方法所使用的刻度。 运行 你的程序一段时间后,解释部分的大多数主要消费者应该显示为 "Compiled",因为 JIT 将编译它们。
  • Stubs + native:这个图是JNI调用的。这可能只使用 "native" 列,因为 JNI 当然是作为一系列本机调用执行的。
  • 线程局部滴答:这被列为 "miscellaneous" 其他条目,并且写在 "should not raise concerns from performance optimization perspective" 的某处。我不确定我们有多愿意相信它,但 XProf 确实不是您上面所说的记录工具。