RFR: 8357828: Add a timestamp to jcmd diagnostic commands [v5]

Ivan Bereziuk duke at openjdk.org
Fri Jan 23 16:26:57 UTC 2026


> `jcmd` provides great diagnostics but many commands lack a timestamp in their output.
> Adding a timestamp to the output would add value for those debugging JVM data.
> 
> Some diagnostic commands already provide timestamps. For example `Thread.print` already prints one of "yyyy-MM-dd HH:mm:ss" format.
> 
> With this MR I propose to introduce time-stamping to all diagnostic `jcmd` commands in a form of an additional common flag "-t":
> 
> jcmd [pid | main-class] [-t] command... | PerfCounter.print | -f filename
>                         ^^^^
> 
> * The choice for time format is ISO 8601 `yyyy-MM-dd'T'HH:mm:ss.SSSZ` (example `2026-01-21T16:58:49.518+0100`)
> * if "-t" flag is not passed, `Thread.print` keeps printing "yyyy-MM-dd HH:mm:ss" timestamp to preserve backwards compatibility.

Ivan Bereziuk has updated the pull request incrementally with one additional commit since the last revision:

  tweaked help working for -t flag

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/27368/files
  - new: https://git.openjdk.org/jdk/pull/27368/files/f0e39a34..7371f3c1

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=27368&range=04
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27368&range=03-04

  Stats: 5 lines in 3 files changed: 0 ins; 0 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/27368.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27368/head:pull/27368

PR: https://git.openjdk.org/jdk/pull/27368


More information about the hotspot-runtime-dev mailing list