I think this is useful. I have a vague preference for reusing VM.flags though - giving it the option to only print one flag - instead of adding a new command.
Just my 5c .. Thomas On Tue, May 21, 2019, 12:14 Stefan Karlsson <stefan.karls...@oracle.com> wrote: > Hi all, > > Please review this patch to introduce a new diagnostic command: > VM.get_flag. > > http://cr.openjdk.java.net/~stefank/8224479/webrev.01/ > https://bugs.openjdk.java.net/browse/JDK-8224479 > > Today we have: > > - VM.set_flag - which allows the user to set a manageable flag > - VM.flags - which allows the user to print all set flags or print > similar output as -XX:+PrintFlagsFinal > > I propose that we add a new command to print the value of one flag. > > Output from help: > ========== > $ jcmd HelloSleep help VM.get_flag > 1060: > VM.get_flag > Prints the value of a VM flag option. > > Impact: Low > > Permission: java.lang.management.ManagementPermission(monitor) > > Syntax : VM.get_flag <flag name> > > Arguments: > flag name : The name of the flag we want to get (STRING, no > default value) > ========== > > Output from usage: > ========== > $ jcmd HelloSleep VM.get_flag UseSerialGC > 1060: > false > ========== > > I'll create a CSR if others also thinks this is a worthwhile feature. > > Thanks, > StefanK >