RFR: 8323546: Clarify docs for Compiler.perfmap filename parameter, and other misc related jcmd doc cleanups [v4]

Chris Plummer cjplummer at openjdk.org
Sun Jan 14 01:31:23 UTC 2024


On Sun, 14 Jan 2024 01:03:14 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> src/hotspot/share/services/diagnosticCommand.cpp line 866:
>> 
>>> 864:   const char* filename = _filename.value();
>>> 865:   if (strncmp(filename, DEFAULT_PERFMAP_FILENAME, strlen(DEFAULT_PERFMAP_FILENAME)) == 0) {
>>> 866:       filename = nullptr; // use the default filename based on the pid
>> 
>> Nit: the indent has to be 2, not 4.
>
> I only expected to see a change to the help string, I don't understand why the actual Dcmd is being modified here! ???

The default value for the argument is what gets displayed in the help text. For example:


ThreadDumpToFileDCmd::ThreadDumpToFileDCmd(outputStream* output, bool heap) :
                                           DCmdWithParser(output, heap),
  _overwrite("-overwrite", "May overwrite existing file", "BOOLEAN", false, "false"),
  _format("-format", "Output format ("plain" or "json")", "STRING", false, "plain"),
  _filepath("filepath", "The file path to the output file", "STRING", true) {
  _dcmdparser.add_dcmd_option(&_overwrite);
  _dcmdparser.add_dcmd_option(&_format);
  _dcmdparser.add_dcmd_argument(&_filepath);
}


And the help text:


Options: (options must be specified using the <key> or <key>=<value> syntax)
	-overwrite : [optional] May overwrite existing file (BOOLEAN, false)
	-format : [optional] Output format ("plain" or "json") (STRING, plain)


The help output that indicates that "plain" is the default format comes from the intialization of the _format argument. There is no separate help text.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17359#discussion_r1451636226


More information about the serviceability-dev mailing list