Skip to content

Conversation

Domest0s
Copy link
Contributor

@Domest0s Domest0s commented Sep 18, 2025

jcmd provides great diagnostics but many commands lack a timestamp in their output.
Adding a timestamp to the output of some would add value for those debugging JVM data.

Some diagnostic commands already provide timestamps. For example Thread.print already prints timestamp in a "yyyy-MM-dd HH:mm:ss" format.

Adding timestamps to all diagnostic jcmd commands with a non-throw-away STDOUT.

The exceptions are:

  • VM.uptime - command run with -date argument will also print a timestamp;
  • VM.system_properties - already lists timestamp
  • Thread.dump_to_file - the content dumped to file already has a timestamp;
  • VM.version

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8357828: Add a timestamp to jcmd diagnostic commands (Enhancement - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27368/head:pull/27368
$ git checkout pull/27368

Update a local copy of the PR:
$ git checkout pull/27368
$ git pull https://git.openjdk.org/jdk.git pull/27368/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 27368

View PR using the GUI difftool:
$ git pr show -t 27368

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27368.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 18, 2025

👋 Welcome back Domest0s! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Sep 18, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Sep 18, 2025

@Domest0s The following labels will be automatically applied to this pull request:

  • hotspot-runtime
  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@@ -1063,6 +1090,7 @@ ThreadDumpToFileDCmd::ThreadDumpToFileDCmd(outputStream* output, bool heap) :
}

void ThreadDumpToFileDCmd::execute(DCmdSource source, TRAPS) {
print_local_time(output());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you didn't mean to print a time stamp here as the output already has a timestamp. Also for -format=json and sending the output to stdout, then it will be unparsable if a timestamp appears before the JSON object.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Alan. That's right.
My mistake. I declared the intention to not have timestamps for commands with a throwaway stdout. This also includes "Thread.dump_to_file" command but then mistakenly added print_local_time() in here.

@Domest0s Domest0s marked this pull request as ready for review September 19, 2025 14:03
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 19, 2025
@mlbridge
Copy link

mlbridge bot commented Sep 19, 2025

Webrevs

@Domest0s
Copy link
Contributor Author

Internal testing tier 1-5 did not show any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants