[JVM] How to track native code compilation for Java methods

JVM JIT is an awesome piece of Software craftsmanship. JIT compiles Java byte code to native platform code. The natively compiled code is stored in CodeCache, which is outside Java Heap and PermGen space. Watching this process can help in tuning CodeCache size if needed.

Add the following parameter to JVM to see when a method is compiled to native code


This shall print a line on console each time a method is compiled. To see a summary compile time at the end use the following

-XX:+PrintCompilation -XX:+CITime

This shall print a summary, here is a sample from one of my programs

Accumulated compiler times (for compiled methods only)
  Total compilation time   :  0.320 s
    Standard compilation   :  0.314 s, Average : 0.004
    On stack replacement   :  0.006 s, Average : 0.003

  Total compiled bytecodes :  16964 bytes
    Standard compilation   :  16808 bytes
    On stack replacement   :    156 bytes
  Average compilation speed:  52961 bytes/s

  nmethod code size        :  78784 bytes
  nmethod total size       : 150120 bytes

Working on decoding this process further. Stay tuned.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.