On Fri, 23 Jan 2026 16:26:57 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 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 have a side question. This might help us make the right choice. Q: Is there a chance that we change the format of timestamp from `Thread.print` printed currently to ISO 8601? Also. Adding `jcmd` "duration at the end" feature makes sense only if it's measured per individual command. Propagation of the argument to the target JVM is necessary because of `jcmd`'s "-f <file>" submits a chain of commands to the target JVM. As a User I would expect "-t" to align with that and timestamp before each individual command. Thoughts? ------------- PR Comment: https://git.openjdk.org/jdk/pull/27368#issuecomment-3933032044
