RFR: 8257234 : Add gz option to SA jmap to write a gzipped heap dump [v14]

Lin Zang lzang at openjdk.java.net
Fri Feb 5 15:28:44 UTC 2021


On Fri, 5 Feb 2021 15:01:26 GMT, Lin Zang <lzang at openjdk.org> wrote:

>> Also, this method can be refactored to something like this (the check for exactly one option argument is needed):
>>    private int parseHeapDumpCompressionLevel(String option) {
>>        String[] keyValue = option.split("=");
>>        if (!keyValue[0].equals("gz")) {
>>            err.println("Expected option is "gz="");
>>            return 0;
>>       }
>>        if (keyValue.length != 2) {
>>            err.println("Exactly one argument is expected for option "gz"");
>>            return 0;
>>        }
>>        int gzl = 0;
>>        String level = keyValue[1];
>>        try {
>>            gzl = Integer.parseInt(level);
>>        } catch (NumberFormatException e) {
>>            err.println("gz option value not an integer ("+level+")");
>>            return 0;
>>        }
>>        if (gzl < 1 || gzl > 9) {
>>            err.println("Compression level out of range (1-9): " + level);
>>            return 0;
>>        }
>>        return gzl;
>>    }
>
> Hi Serguei,
> 
>> But I still do not see it in the latest updates from you. It feels like there is some misunderstanding and confusion.
> 
> Thanks a lot for remainder! Sorry that I forgot to submit the change.
> 
>> Also, this method can be refactored to something like this (the check for exactly one option argument is needed):
> 
> The change looks nice, I will made the change and submit it in a minute.
> 
> BRs,
> Lin

Hi Chris, 

> It's confusing because both `jhsdb jmap` and the clhsdb `dumpheap` command use the JMap class, but neither support passing `format=x` to it. In order to get SA to dump with `format=x`, you would need to launch `sun/jvm/hotspot/tools/JMap` directly and pass in `-heap:format=x`. I'm not suggesting you fix that, but just something for us to be aware of.

I think new PR can be created for adding `format=x` to `clhsdb dumpheap` and  `jhsdb jmap`. And maybe new CSR is required?

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

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


More information about the hotspot-runtime-dev mailing list