RFR: 8357828: Add a timestamp to jcmd diagnostic commands [v5]
Kevin Walls
kevinw at openjdk.org
Fri Feb 20 11:08:46 UTC 2026
On Fri, 23 Jan 2026 16:26:57 GMT, Ivan Bereziuk <duke at openjdk.org> wrote:
>> `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
I suggest not worrying too much about jcmd -f to run a list of commands.
If you want individual times, you can run individual commands
(both start time and duration if we make jcmd track that).
Thread.print's existing timestamp could maybe be changed at some point in the future.
I'm not that concerned if opting for jcmd with a timestamp, there is that one command that prints a second timestamp.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27368#issuecomment-3933141116
More information about the serviceability-dev
mailing list