`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.

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
                        ^^^^


This is a simplified approach to handle timestamp (v1 is 
[here](https://github.com/openjdk/jdk/pull/27368))

Some diagnostic commands already provide timestamps information. For example 
`Thread.print` already starts with a timestamp of "yyyy-MM-dd HH:mm:ss" format.
In that case the timestamp is printed twice if "-T" flag is passed to 
`Thread.print`.

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

Commit messages:
 - improve TestJcmdTimestamp.java. add '-f <file>
 - implementation v2, top level timestamping
 - remove TimeStamp::No as it's not used. virtual should be flipped to override 
in bulk (afressed clang warning)
 - Merge branch 'master' into 8357828_add_timestamp_to_jcmd
 - changes to jcmd.md
 - undo changes to reorder_help_cmd()
 - cleanup
 - add timestamp to VM.version. Add test
 - updated jcmd usage text
 - undo the changes to the modified earlier tests as timestamp presence is 
fully backwards compatible
 - ... and 7 more: https://git.openjdk.org/jdk/compare/f2d5290c...eaea764d

Changes: https://git.openjdk.org/jdk/pull/29325/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29325&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8357828
  Stats: 189 lines in 6 files changed: 169 ins; 4 del; 16 mod
  Patch: https://git.openjdk.org/jdk/pull/29325.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29325/head:pull/29325

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

Reply via email to