Summary
Extend jcmd Compiler.perfmap with an optional option filename to create a symbol mappings file for the linux perf different from the default /tmp/perf-%d.map.
Problem
The current implementation of jcmd Compiler.perfmap writes the perf map to a hard-coded file name: /tmp/perf-%d.map where %d is a java process ID. The hard-coded file name is inconvenient for long running applications where symbol mappings change because of code changes in CodeCache. These changes must be reflected in the perf map file before any run of perf record. If we run perf record multiple times, we must preserve the previously created perf map file before each of the runs. Otherwise the perf map file will be overwritten and perf report will be incorrect. A workaround is to rename the previously created map file before running perf record. With an ability to specify a filename, we would not need the workaround.
Solution
PerfMapDCmd will inherit from DCmdWithParser to accept an additional argument filename which is optional. If it is provided, the perf map will be written to the specified filename. Otherwise, the perf map file will be written to /tmp/perf-%d.map where %d is a java process ID.
Specification
jcmd Compiler.perfmapis unchanged and creates/tmp/perf-%d.map.jcmd Compiler.perfmap <file>creates the map file at the specified<file>.jcmd PID help Compiler.perfmapprovides the following usage.
Compiler.perfmap [arguments] (Linux only)
Write map file for Linux perf tool.
Impact: Low
arguments:
• filename: (Optional) Name of the map file (STRING, no default value)
If filename is not specified, a default file name is chosen using the pid of the tar
get JVM process. For example, if the pid is 12345, then the default filename will be
/tmp/perf-12345.map.
- csr of
-
JDK-8314029 Add file name parameter to Compiler.perfmap
-
- Resolved
-