JDK-8261105 : improve jcmd GC.class_histogram to support parallel
  • Type: CSR
  • Component: core-svc
  • Sub-Component: tools
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 17
  • Submitted: 2021-02-04
  • Updated: 2021-05-11
  • Resolved: 2021-05-11
Related Reports
CSR :  
Description
TODO

Summary
-------

Add a new sub-command option "parallel" to the existing "GC.class_histogram" jcmd command line option, which specifies how many threads to use to generate the heap histogram.

Problem
-------

"jcmd GC.class_histogram" inspects the heap serially, which takes a long time when the heap is large. Heap iteration time can be significantly reduced by parallel iteration over the object graph.

Solution
--------

Leverage the parallel histo iteration already implemented in jmap -histo.

Specification
-------------
Updated specification.

    GC.class_histogram
    Provide statistics about the Java heap usage.

    Impact: High: Depends on Java heap size and content.

    Permission: java.lang.management.ManagementPermission(monitor)

    Syntax : GC.class_histogram [options]

    Options: (options must be specified using the <key> or <key>=<value> syntax)
        -all : [optional] Inspect all objects, including unreachable objects (BOOLEAN, false)
        -parallel : [optional] Number of parallel threads to use for heap inspection. 0 (the default) means let the VM determine the number of threads to use. 1 means use one thread (disable parallelism). For any other value the VM will try to use the specified number of threads, but might use fewer. (INT, 0)


Comments
Approving for JDK 17.
11-05-2021

Thanks Chris for your review!
11-05-2021

I think this CSR is now in agreement with and alignment with what we discussed in https://github.com/openjdk/jdk/pull/2379.
10-05-2021

Thanks Serguei. will adjust the CSR accordingly when the discussion is finished in https://github.com/openjdk/jdk/pull/2379
10-02-2021

This looks good in general. The default and a reasonable limit for -parallel option need to be specified. If the default value is up to to the implementation than it has to be explained in the spec.
09-02-2021