Search code examples
javajit

How to find out the name of JIT used when you run your java program


Is there any command or something like that to know the name of JIT used when running the java program?


Solution

  • (This answer applies to OpenJDK Hotspot)

    You should be able to use -XX:+LogCompilation to get a log file(hotspot_pid< PID>.log, in the startup directory) containing lines like

    <nmethod compile_id='2' compiler='C1' level='3' ...

    Note:LogCompilation is a diagnostic VM-option. So you will need to enable it by preceding it with -XX:+UnlockDiagnosticVMOptions. Your script line for running the class file would look like:

    java -XX:+UnlockDiagnosticVMOptions -XX:+LogCompilation MyClass

    See this Oracle article, Understanding Java JIT Compilation with JITWatch, Part 1, for further details.

    Note that there may be several different JITs in action during one execution.