Skip to content

Commit

Permalink
8336684: renamed string constants for better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
larry-cable committed Oct 3, 2024
1 parent d262f18 commit 1c2d186
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 35 deletions.
40 changes: 20 additions & 20 deletions src/hotspot/share/services/diagnosticCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1228,26 +1228,26 @@ VMUsageMetadataDCmd::VMUsageMetadataDCmd(outputStream* output, bool heap) : DCmd
_dcmdparser.add_dcmd_option(&_filepath);
}

// order of writing o/p...
// default order of writing o/p keys&values...
const char *const VMUsageMetadataDCmd::_DEFAULT_FMT[] = {
_TIMESTAMP,
_STARTTIME,
_JVM_STARTTIME,
_JAVA_HOME,
_JAVA_VERSION,
_JAVA_VM_VERSION,
_SUN_JAVA_LAUNCHER,
_FLAGS,
_ARGS,
_JVM_FLAGS,
_JVM_ARGS,
_SUN_JAVA_CMD,
_CLASSPATH,
_MODULE_PATH,
_MAIN_MODULE,
_MAIN_MODULE_CLASS,
_UPGRADE_MODULE_PATH,
_PID,
_UPTIME,
_JAVA_CLASSPATH,
_JDK_MODULE_PATH,
_JDK_MAIN_MODULE,
_JDK_MAIN_MODULE_CLASS,
_JDK_UPGRADE_MODULE_PATH,
_JVM_PID,
_JVM_UPTIME,
#ifdef LINUX
_CTR_INFO,
_JVM_CTR_INFO,
#endif
_USER_NAME,
_USER_DIR,
Expand All @@ -1259,16 +1259,16 @@ const char *const VMUsageMetadataDCmd::_DEFAULT_FMT[] = {

//ascending lexical order... bsearch
VMUsageMetadataDCmd::MapEntry VMUsageMetadataDCmd::_FIELD_WRITER_MAP[] = {
{ _ARGS, (void *)&_writeJVMArgs },
{ _JVM_ARGS, (void *)&_writeJVMArgs },
#ifdef LINUX
{ _CTR_INFO, (void *)&_writeJVMContainerInfo },
{ _JVM_CTR_INFO, (void *)&_writeJVMContainerInfo },
#endif
{ _FLAGS, (void *)&_writeJVMFlags },
{ _PID, (void *)&_writeJVMPid },
{ _STARTTIME, (void *)&_writeJVMStartTime },
{ _UPTIME, (void *)&_writeJVMUptime },
{ _OS_HOSTNAME,(void *)&_writeHostname },
{ _TIMESTAMP, (void *)&_writeTime },
{ _JVM_FLAGS, (void *)&_writeJVMFlags },
{ _JVM_PID, (void *)&_writeJVMPid },
{ _JVM_STARTTIME, (void *)&_writeJVMStartTime },
{ _JVM_UPTIME, (void *)&_writeJVMUptime },
{ _OS_HOSTNAME, (void *)&_writeHostname },
{ _TIMESTAMP, (void *)&_writeTime },
};

static VMUsageMetadataDCmd::JsonFormatter _JSON_FORMATTER;
Expand Down
35 changes: 20 additions & 15 deletions src/hotspot/share/services/diagnosticCommand.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1074,32 +1074,37 @@ class VMUsageMetadataDCmd : public DCmdWithParser {

private:

static constexpr const char *const _TIMESTAMP = "timestamp";
static constexpr const char *const _STARTTIME = "jvm.starttime";
static constexpr const char *const _JAVA_CLASSPATH = "java.class.path";
static constexpr const char *const _JAVA_HOME = "java.home";
static constexpr const char *const _JAVA_VERSION = "java.version";
static constexpr const char *const _JAVA_VM_VERSION = "java.vm.version";
static constexpr const char *const _SUN_JAVA_CMD = "sun.java.command";
static constexpr const char *const _ARGS = "jvm.args";

static constexpr const char *const _JDK_MODULE_PATH = "jdk.module.path";
static constexpr const char *const _JDK_MAIN_MODULE = "jdk.module.main";
static constexpr const char *const _JDK_MAIN_MODULE_CLASS = "jdk.module.main.class";
static constexpr const char *const _JDK_UPGRADE_MODULE_PATH = "jdk.module.upgrade.path";

static constexpr const char *const _JVM_ARGS = "jvm.args";
#ifdef LINUX
static constexpr const char *const _CTR_INFO = "jvm.container.info";
static constexpr const char *const _JVM_CTR_INFO = "jvm.container.info";
#endif
static constexpr const char *const _FLAGS = "jvm.flags";
static constexpr const char *const _PID = "jvm.pid";
static constexpr const char *const _UPTIME = "jvm.uptime.ms";
static constexpr const char *const _CLASSPATH = "java.class.path";
static constexpr const char *const _JVM_FLAGS = "jvm.flags";
static constexpr const char *const _JVM_PID = "jvm.pid";
static constexpr const char *const _JVM_STARTTIME = "jvm.starttime";
static constexpr const char *const _JVM_UPTIME = "jvm.uptime.ms";

static constexpr const char *const _MODULE_PATH = "jdk.module.path";
static constexpr const char *const _MAIN_MODULE = "jdk.module.main";
static constexpr const char *const _MAIN_MODULE_CLASS = "jdk.module.main.class";
static constexpr const char *const _UPGRADE_MODULE_PATH = "jdk.module.upgrade.path";
static constexpr const char *const _SUN_JAVA_LAUNCHER = "sun.java.launcher";
static constexpr const char *const _SUN_JAVA_CMD = "sun.java.command";

static constexpr const char *const _TIMESTAMP = "timestamp";

static constexpr const char *const _USER_DIR = "user.dir";
static constexpr const char *const _USER_NAME = "user.name";

static constexpr const char *const _OS_ARCH = "os.arch";
static constexpr const char *const _OS_HOSTNAME = "os.hostname";
static constexpr const char *const _OS_NAME = "os.name";
static constexpr const char *const _OS_VERSION = "os.version";
static constexpr const char *const _OS_ARCH = "os.arch";
static constexpr const char *const _SUN_JAVA_LAUNCHER = "sun.java.launcher";

static constexpr const char *const _APPLICATION_JSON = "json";
static constexpr const char *const _TEXT_PLAIN = "plain";
Expand Down

0 comments on commit 1c2d186

Please sign in to comment.