On Thu, 18 Sep 2025 14:57:44 GMT, Ivan Bereziuk <[email protected]> wrote:

> `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 one of "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`

Hi, that sounds promising.  
I do think we should state the benefit of having this (we don't expect much 
latency as this is a local attach).

Passing something on to the native impl is interesting - then, if the jcmd 
launcher prints pid:, then timestamp on a newline, can Thread.print find out a 
timestamp is already printed, and not duplicate it?

3975026:
2025-09-23 10:31:54
Full thread dump ...

Or, should Thread.print stop printing a timestamp, and rely on the launcher to 
do it.  That would avoid that communication, but would mean we have to default 
to timestamps ON, or Thread.print output format will change (which is not 
completely illegal, but will no doubt surprise some people/scripts).  Or, have 
the two sides communicate and Thread.print prints the timestamp, if it has not 
been shown already.  Nothing there is as simple as we'd like. 8-)

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

PR Comment: https://git.openjdk.org/jdk/pull/27368#issuecomment-3323188843

Reply via email to