> `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. > > 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 "yyyy-MM-dd HH:mm:ss" as it is already used > in `Thread.print`. > * `Thread.print` prints timestamp irrespectively from "-T" flag presence to > preserve backwards compatibility. > > I haven't added a timestamp to the following diagnostic command: > * `VM.uptime` - command run with `-date` argument will also print a timestamp; > * `VM.system_properties` - as the output already lists a timestamp. Not sure > if we need more timestamps here. > * `Thread.dump_to_file` - the content dumped to a file already has a > timestamp;
Ivan Bereziuk has updated the pull request incrementally with one additional commit since the last revision: change flag name from -T to -t ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27368/files - new: https://git.openjdk.org/jdk/pull/27368/files/c702901d..f0e39a34 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27368&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27368&range=02-03 Stats: 13 lines in 6 files changed: 0 ins; 0 del; 13 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
