Inspecting the Compilation Process
The last of the intermediate tunings aren't tunings per se: that is, they will not improve the
performance of an application. Rather, they are the JVM flags (and other tools) that give vis-
ibility into the working of the compiler. The most important of these is -
XX:+PrintCompilation (which by default is false ).
If PrintCompilation is enabled, every time a method (or loop) is compiled, the JVM prints
out a line with information about what has just been compiled. The output has varied some-
what between Java releases; the output discussed here became standardized in Java 7.
Most lines of the compilation log have the following format:
timestamp compilation_id attributes (tiered_level) method_name size deopt
The timestamp here is the time after the compilation has finished (relative to 0, which is
when the JVM started).
The compilation_id is an internal task ID. Usually this number will simply increase mono-
tonically, but sometimes with the server compiler (or anytime the number of compilation
threads has been increased), you may see an out-of-order compilation ID. This indicates that
compilation threads are running faster or slower relative to each other, but don't conclude
that one particular compilation task was somehow inordinately slow: it is usually just a func-
tion of thread scheduling (though OSR compilation is slow and often appears out of order).
The attributes field is a series of five characters that indicates the state of the code being
compiled. If a particular attribute applies to the given compilation, the character shown in the
following list is printed; otherwise, a space is printed for that attribute. Hence, the five-char-
acter attribute string may appear as two or more items separated by spaces. The various at-
▪ % : The compilation is OSR.
▪ s : The method is synchronized.
▪ ! : The method has an exception handler.
▪ b : Compilation occurred in blocking mode.
▪ n : Compilation occurred for a wrapper to a native method.