You copied the Doc URL to your clipboard.

JIT profiling support

You can profile Just In Time (JIT) compiled language execution with Arm Streamline by importing jitdump files that are generated by JIT engines.

Common supported languages are: Node.js, Chrome V8 Javascript, and Java.

To profile JIT execution, you can trace your program by recording the execution using the perf record command on a supported JIT engine that produces jitdump data. You can then directly import the perf.data file into Arm Streamline.

You can specify the jitdump file paths in the Analyze dialog box, JIT Dump Files tab, shown in the following figure.

Figure 16-1 Analyze dialog box (JIT Dump Files)

Analyze dialog box (JIT Dump Files tab).

Arm Streamline processes the files to extract the source and line information, and shows the generated machine code in the Arm Streamline code view.

Note

  • Only imported perf recordings are supported because Node.js, JVM, and other VMs use a CLOCK_MONOTONIC clock by default. However, gatord uses a CLOCK_MONOTONIC_RAW clock. If you use gatord, you must manually modify Node.js or the JVM Tool Interface library, that is shipped with perf, to use CLOCK_MONOTONIC_RAW.
  • You must pass -k CLOCK_MONOTONIC to perf record when profiling using libperf-jvmti.so. libperf-jvmti.so uses CLOCK_MONOTONIC but, by default, perf does not use the same clock.
  • JIT profiling is not compatible with gator.ko. You can only use user space capturing.

An example of how to profile and analyze JIT execution could be:

  1. To capture profiling data using perf record, you must use a CLOCK_MONOTONIC clock:

    sudo perf record -k CLOCK_MONOTONIC -a -c 1 -e "{sched:sched_switch, cpu-clock/period=10000000/, instructions, branch-misses}:S" java -agentpath:<path-to-libperf-jvmti.so> <java-main-class>"

    To include call stacks, pass --call-graph=fp to perf and pass -XX:+PreserveFramePointer to java.

  2. Copy perf.data and jitdump files, found in ~/.debug/jit/, to your host:

    scp perf.data ~/.debug/jit/<path_to_jitdump_file> hostmachine:
  3. Import perf.data.
  4. Analyze the imported capture by attaching the jitdump file that is transferred in step 2.

Tracing program execution

The steps that you must take to trace execution depends on the particular VM you are using:

Node.js and V8
Run perf with the --perf-prof argument:
perf record ... node --perf-prof ...
See https://github.com/v8/v8/wiki/V8-Linux-perf-Integration.
JVM

Use the libperf_jvmti.so agent library which is provided in source form as part of the perf tools sources. See https://patchwork.kernel.org/patch/8236901/.

  • Download kernel sources and install the JDK on your target.
  • 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 resultant library is in: <KERNEL>/tools/perf.
  • Run the java command with the -agentpath:<ABSOLUTE_PATH_TO_libperf_jvmti.so> argument:
    perf record ... java -agentpath:/home/user/linux-src/tools/perf/libperf_jvmti.so ...