Details
-
Enhancement
-
Resolution: Unresolved
-
P5
-
22
-
linux
Description
We have `XX:+DumpPerfMapAtExit` and `jcmd Compiler.perfmap` to support profiling with linux perf. They dump symbols of code in CodeCache.
Linux perf supports jit dumps which it can inject into `perf.data`.
The format of the jit dump is specified here:
https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/jitdump-specification.txt
We can have `XX:+DumpPerfJitDumpAtExit` and `jcmd Compiler.perfjitdump` to dump such files. The command should support:
- Dump all code heap (the default mode).
- Dump particular code heaps.
- The default dump file name: `jit-JVM_PID.dump`
- A dump file path.
Use case with `DumpPerfJitDumpAtExit`
$ java -XX:+UnlockDiagnosticVMOptions -XX:+DumpPerfJitDumpAtExit MyBenchmark
$ perf record -k mono -- sleep 60
$ perf inject --jit --input perf.data --output perf.jit.data
$ perf report -i perf.data.jitted
Use case with `jcmd Compiler.perfjitdump`
$ java -XX:+UnlockDiagnosticVMOptions MyServiceApp
$ jcmd <jvm_pid> Compiler.perfjitdump
$ perf record -k mono -- sleep 60
$ perf inject --jit --input perf.data --output perf.jit.data
$ perf report -i perf.data.jitted
It's possible to generate this already for Java processes using a linux perf JVMTI plugin: libperf-jvmti.so. However the plugin might not be available in a particular Linux distribution and will require to compile it from kernel sources. The plugin won't help when we want to log in to a host running a service and to dump a file without restarting the service.
It would be more convenient if Hotspot could write this file directly using a diagnostic command.
Resources:
https://lwn.net/Articles/638566/
https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/perf-inject.txt
https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/jitdump-specification.txt
Linux perf supports jit dumps which it can inject into `perf.data`.
The format of the jit dump is specified here:
https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/jitdump-specification.txt
We can have `XX:+DumpPerfJitDumpAtExit` and `jcmd Compiler.perfjitdump` to dump such files. The command should support:
- Dump all code heap (the default mode).
- Dump particular code heaps.
- The default dump file name: `jit-JVM_PID.dump`
- A dump file path.
Use case with `DumpPerfJitDumpAtExit`
$ java -XX:+UnlockDiagnosticVMOptions -XX:+DumpPerfJitDumpAtExit MyBenchmark
$ perf record -k mono -- sleep 60
$ perf inject --jit --input perf.data --output perf.jit.data
$ perf report -i perf.data.jitted
Use case with `jcmd Compiler.perfjitdump`
$ java -XX:+UnlockDiagnosticVMOptions MyServiceApp
$ jcmd <jvm_pid> Compiler.perfjitdump
$ perf record -k mono -- sleep 60
$ perf inject --jit --input perf.data --output perf.jit.data
$ perf report -i perf.data.jitted
It's possible to generate this already for Java processes using a linux perf JVMTI plugin: libperf-jvmti.so. However the plugin might not be available in a particular Linux distribution and will require to compile it from kernel sources. The plugin won't help when we want to log in to a host running a service and to dump a file without restarting the service.
It would be more convenient if Hotspot could write this file directly using a diagnostic command.
Resources:
https://lwn.net/Articles/638566/
https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/perf-inject.txt
https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/jitdump-specification.txt
Attachments
Issue Links
- relates to
-
JDK-8254723 Add diagnostic command to write Linux perf map file
-
- Resolved
-