RFR: JDK-8261034: improve jcmd GC.class_histogram to support parallel

Chris Plummer cjplummer at openjdk.java.net
Wed Feb 3 21:36:41 UTC 2021


On Wed, 3 Feb 2021 12:44:53 GMT, Hamlin Li <mli at openjdk.org> wrote:

> parallel -histo of jmap was added by JDK-8214535, it's better to support parallel for jcmd GC.class_histogram too.

I think you'll need a CSR just as [JDK-8215624](https://bugs.openjdk.java.net/browse/JDK-8215624). Also, a test is needed. There are a couple of tests under `test/hotspot/jtreg/serviceability/dcmd/gc` that already test `GC.class_histogram`. You could probably clone or modify one of them to test the new `-parallel` option.

src/hotspot/share/services/diagnosticCommand.cpp line 559:

> 557:        "BOOLEAN", false, "false"),
> 558:   _parallel_thread_num("-parallel", "parallel threads number for heap iteration",
> 559:        "INT", false, "0")     {

Does "0" mean use a default number of parallel threads as it does for the jmap? It's unclear, but it seems that it doesn't, which I think leads to eventually hitting this assert in `update_active_workers(uint v)`:
    assert(v != 0, "Trying to set active workers to 0");
If that's not the case, please explain how 0 is handled. In any case, I think it should be made consistent with jmap and should also be documented in the above  help output:
  parallel=<count> generate histogram using this many parallel threads, default 0
                     0 use system determined number of threads
                     1 use one thread, i.e., disable parallelism
                     n use n threads, n must be positive

-------------

PR: https://git.openjdk.java.net/jdk/pull/2379


More information about the hotspot-runtime-dev mailing list