Profile Just In Time (JIT) execution by using gatord on a supported JIT engine, to collect trace information when running your program. Then you can import the generated jitdump data into Streamline for analysis.
Common supported languages are: Node.js, Chrome V8 Javascript, and Java.
You can specify the jitdump file paths in the Analyze dialog box, JIT Dump Files tab, which is shown in the following figure.
Streamline processes the files to extract the source and line information, and shows the generated machine code in the Code view.
Follow the steps below to configure the JVM and then use gatord to trace execution:
Use the libperf-jvmti.so agent library which is provided in source form as part of the perf tools sources. See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=209045adc2bbdb2b315fa5539cec54d01cd3e7db.
Download kernel sources and install the JDK on your target.
Modify the JVM agent in the perf tools in order to use CLOCK_MONOTONIC_RAW instead of CLOCK_MONOTONIC.
In Linux v6.11 this can be done by applying the following patch to the agent source code:
diff --git a/tools/perf/jvmti/jvmti_agent.c b/tools/perf/jvmti/jvmti_agent.c
index 526dcaf9f..1286b870e 100644
--- a/tools/perf/jvmti/jvmti_agent.c
+++ b/tools/perf/jvmti/jvmti_agent.c
@@ -102,7 +102,7 @@ get_arch_timestamp(void)
}
#define NSEC_PER_SEC 1000000000
-static int perf_clk_id = CLOCK_MONOTONIC;
+static int perf_clk_id = CLOCK_MONOTONIC_RAW;
static inline uint64_t
timespec_to_ns(const struct timespec *ts)
Compile perf tools by running make, setting the JDIR flag to the location of the JDK:
cd <KERNEL>/tools/perf
make JDIR=<PATH_TO_JDK>
The generated library is in <KERNEL>/tools/perf.
Run the java command using gatord. You must add -agentpath:<ABSOLUTE_PATH_TO_libperf_jvmti.so> to the JVM arguments.
For example, to perform a local capture:
./gatord ... --output example-jvm-jit --app java -agentpath:<KERNEL>/tools/perf/libperf-jvmti.so ...
If the JVM is configured correctly, the following message is shown in the console with the paths to the generated jitdump files:
Gator ready
Starting command: java...
java: jvmti: jitdump in /home/user/.debug/jit/java-jit-20241108.XXvrbtM7/jit-2331608.dump
Import the generated capture example-jvm-jit.apc into Streamline and include the generated jitdump files in the Analyze dialog box as shown in the figure above.