-
-
Notifications
You must be signed in to change notification settings - Fork 443
Instructions
To generate the hotspot.log file used by JITWatch run your program with the following JVM switches.
-XX:+UnlockDiagnosticVMOptions
-Xlog:class+load=info
-XX:+LogCompilation
The hotspot.log file is generated in the program execution directory. From Java 8 onwards the filename will include the process ID of the Java process, e.g. hotspot_pid860.log
If you want to specify the HotSpot log filename use the VM switch
-XX:LogFile=mylogfile.log
If you want to HotSpot to output the disassembled native code then add the JVM switch
-XX:+PrintAssembly
Along with this parameter is highly recommended to add -XX:+DebugNonSafepoints
to gain additional output.
This requires you to use a debug JVM build or have built the hsdis (HotSpot disassembler) binary. The source for hsdis is part of OpenJDK and instructions for building it are here: Building hsdis
-Xlog:class+load=info
is required for JITWatch to build its class model; for Java 8 and older use -XX:+TraceClassLoading
instead.
Requirements for running JITWatch are:
- Oracle JDK or OpenJDK version 7 or higher (a JDK is needed as tools.jar is required)
- JavaFX or OpenJFX for the user interface
You can run JITWatch with Maven, Gradle or the provided shell scripts.
Create the following Maven file (pom.xml):
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>jitwatch</groupId>
<artifactId>jitwatch-run</artifactId>
<version>1.3.0</version>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>LATEST</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>org.adoptopenjdk.jitwatch.launch.LaunchUI</mainClass>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>com.chrisnewland</groupId>
<artifactId>jitwatch</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</project>
Type the command:
mvn exec:java
Create the following Gradle file (build.gradle
):
plugins {
id 'application'
}
mainClassName = 'org.adoptopenjdk.jitwatch.launch.LaunchUI'
repositories {
jcenter()
}
dependencies {
runtime 'com.chrisnewland:jitwatch:1.0.0'
}
Type the command:
gradle run
If you already have a build.gradle
file, you can call this file something else, like jitWatch.gradle
, and then use the following command instead:
gradle -b jitWatch.gradle run
You can also use the startup scripts provided, launchUI.sh
for Linux/Mac and launchUI.bat
for Windows.