Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8255383

Add -XX:+DumpPerfMapAtExit to write Linux perf map file on VM shutdown



    • CSR
    • Status: Closed
    • P4
    • Resolution: Withdrawn
    • 16
    • hotspot
    • None
    • svc
    • behavioral
    • minimal
    • Adds a new option which does not conflict with any current or previous option.
    • add/remove/modify command line option
    • Implementation



      Add a new command line option, -XX:+DumpPerfMapAtExit, which will write a map file in the format used by Linux perf at VM shutdown. The map file can then be used by perf to convert addresses to symbol names.


      JDK-8254723 adds a new diagnostic command Compiler.perfmap to write a map file for the current code cache contents of a running VM. During the review for this feature [1] two reviewers suggested it would be useful to also have an option to write the map file on exit, instead of having to use "jcmd Compiler.perfmap" while the VM is running. This would support a common use case of perf like

      perf record -- workload

      Where "workload" terminates after some time.


      Add a new command line product option, -XX:+DumpPerfMapAtExit to write the map on exit. It can be used like this

      perf record -- java -XX:+DumpPerfMapAtExit Workload


      See the changes in pull request [1] for implementation details.

      When DumpPerfMapAtExit is enabled, just before VM shutdown, the start address, length, and symbol name of each entry in the code cache is written to a file /tmp/perf-$PID.map. The format of this file is described in [2].

      Additionally, enabling DumpPerfMapAtExit sets the default value of UseCodeCacheFlushing to false. This is to ensure that the map file contains symbol names for all methods compiled during the life of the VM, and to prevent reuse of address ranges so that each address decodes to a unique symbol. This behaviour can be overridden by explicitly setting -XX:+UseCodeCacheFlushing.

      This option is only available on Linux, as this file format is specific to perf which is a Linux-only tool.

      [1] https://github.com/openjdk/jdk/pull/760

      [2] https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/jit-interface.txt


        Issue Links



              ngasson Nick Gasson
              ngasson Nick Gasson
              0 Vote for this issue
              2 Start watching this issue