java -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly InterThreadLatency
java -XX:+UnlockDiagnosticVMOptions '-XX:CompileCommand=print,*PongRunner.run' InterThreadLatency
The following HotSpot options (with an -XX: prefix on the command line) require OpenJDK 7 and an externally loadable disassembler plugin:
These flags are "diagnostic", meaning that they must be preceded by -XX:+UnlockDiagnosticVMOptions. On the command line, they must all be preceded by -XX:. They may also be placed in a flags file, .hotspotrc by default, or configurable as -XX:Flags=myhotspotrc.txt.
The disassembly output is annotated with various kinds of debugging information, such as field names and source locations. The quality of this information improved markedly in January 2010 (bug fix 6912062).
The -XX:+PrintAssembly option prints everything. If that's too much, drop it and use one of the following options.
Individual methods may be printed:
CompileCommand=print,*MyClass.myMethod prints assembly for just one method CompileCommand=option,*MyClass.myMethod,PrintOptoAssembly (debug build only) produces the old print command output CompileCommand=option,*MyClass.myMethod,PrintNMethods produces method dumps These options accumulate.
If you get no output, use -XX:+PrintCompilation to verify that your method is getting compiled at all.
The -XX:+LogCompilation flag produces a low-level XML file about compiler and runtime decisions, which may be interesting to some. The -XX:+UnlockDiagnosticVMOptions must come first. The dump is to hotspot.log in the current directory; use -XX:LogFile=foo.log to change this.
The LogCompilation output is basic line-oriented XML. It can usefully be read in a text editor, and there are also tools for parsing and scanning it.