-
-
Notifications
You must be signed in to change notification settings - Fork 443
Home
A tool for understanding the behaviour of the Java HotSpot Just-In-Time (JIT) compiler during the execution of your program.
Works by processing the hotspot.log file output by the JVM.
I built this tool as a learning vehicle to gain a better understanding of HotSpot and JavaFX.
https://skillsmatter.com/skillscasts/5243-chris-newland-hotspot-profiling-with-jit-watch
http://www.chrisnewland.com/images/jitwatch/HotSpot_Profiling_Using_JITWatch.pdf
15/07/2014 http://www.oraclejavamagazine-digital.com/javamagazine/july_august_2014?sub_id=BMDiUzTxiJd78#pg51 *requires free subscription
15/07/2014 http://zeroturnaround.com/rebellabs/why-it-rocks-to-finally-understand-java-jit-with-jitwatch/
15/05/2014 http://blog.paralleluniverse.co/2014/05/15/modern-java-pt3/
For usage questions, bug reports, feature requests, and general chat about JIT, HotSpot, JVM, bytecode and performance tuning please join the list at
https://groups.google.com/forum/#!forum/jitwatch
- To verify whether methods you believe to be performance-critical were JIT-compiled during the program's execution.
- To learn when your performance-critical methods were compiled.
- For visualising the effects of tuning JVM compilation thresholds.
- To gain a better understanding of the HotSpot JIT compiler.
- To have a nice interface for inspecting method bytecode and assembly?
- Browse class trees and view which methods were JIT-compiled, when JIT-compilation occurred, and information about the compilation.
- Mount your source, jars, and class trees to jump to the source, bytecode, and assembly for a method.
- Plot JIT compilations over time and visualise when a method was JIT-compiled.
- View toplists of the largest native methods, methods with most bytecodes, longest compilation times, etc.
- Open sourced under the Simplified BSD licence.
Pre-built jars are now produced by Jenkins CI. See the README for details
To generate the hotspot.log file used by JITWatch run your program with the following JVM switches.
-XX:+UnlockDiagnosticVMOptions -XX:+TraceClassLoading -XX:+LogCompilation -XX:+PrintAssembly
The hotspot.log file is generated in the program execution directory.
If you want to use the -XX:+PrintAssembly
switch to view the assembly language (disassembled JIT-compiled native code) then you need to use a debug JVM build or have built the hsdis (HotSpot disassembler) binary. The source for hsdis is part of OpenJDK.
Instructions for building hsdis (for Windows) are here: Building hsdis on Windows
Instructions for building hsdis (for Linux) are here: [Building hsdis on Linux] (http://www.chrisnewland.com/building-hsdis-on-linux-amd64-on-debian-369)
Instructions for building hsdis (for Mac OSX) are here: [Building hsdis on Max OSX] (https://www.chrisnewland.com/building-hsdis-amd64dylib-on-mac-osx-376)
-XX:+TraceClassLoading
is required. This is how JITWatch builds the class model.
JavaFX (JAVA_HOME/jre/lib/jfxrt.jar for jdk1.7 or JAVA_HOME/jre/lib/ext/jfxrt.jar for jdk8) and tools.jar (JDK_HOME/lib/tools.jar) are required to run JITWatch.
Example launch script (Linux):
#!/bin/sh
export CP=$JDK_HOME/lib/tools.jar:$JDK_HOME/jre/lib/jfxrt.jar:jitwatch.jar
$JDK_HOME/bin/java -cp $CP com.chrisnewland.jitwatch.launch.LaunchUI
Please report it using the Issue Tracker
Feel free to fork the code and send me a pull request with your changes. I'd appreciate if you use the same code formatting. Here is my Eclipse Java formatting profile
Thanks to Martijn Verburg for maven help and lots of useful suggestions! Thanks to Mani Sarkar for code improvements!
Thanks to Dr Heinz Kabutz and the participants of JCrete 2013 for an amazing unconference and inspiring me to up my Java game.
The idea for building this tool came after reading The Well Grounded Java Developer by Ben Evans and Martijn Verburg.
Oracle HotSpot Internals wiki LogCompilation
Oracle HotSpot Internals wiki PrintAssembly
My "Understanding HotSpot Logs" session at the JCrete (un)conference (Open Spaces)
Slides on Understanding HotSpot Logs
Love it? Hate it? Want a new feature? Let me know!
Twitter: @chriswhocodes
Email : [email protected]
Main JITWatch application window.
Configure JITWatch by mounting src trees, class folders, and jars.
Browse the package tree and inspect methods.
Right click a method to show detailed inspection tools
JIT Sandbox: Edit->Compile->Execute->Analyse fast feedback loop.
JIT Sandbox: Experiment with various HotSpot JIT Compilation options.
TriView combined source, bytecode, assembly viewer.
Bytecode annotations for inlining and branch taken probability.
Compile Chain showing JIT-compiled and inlined members.
Suggestion tool - highlights hot method inlining failures and unpredictable branches.
Chart of compilations over time. Selected method is shown.
Code cache free space over time.
Toplists of largest native methods, highest bytecode count, longest compile time, etc.
Histograms of compile times, method sizes, etc.
JIT Journal: Find all the log statements associated with a method.
Statistics on JIT compilations made by HotSpot.