RFR: 8357828: Add a timestamp to jcmd diagnostic commands

Alex Menkov amenkov at openjdk.org
Wed Sep 24 19:52:22 UTC 2025


On Wed, 24 Sep 2025 15:58:37 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> My proposal would entail
>     * adding a new standard option to jcmd
>     * somehow funneling that option to the JVM
>     * the option should be optional, so that:
>       * old jcmd still works with new JVMs (and produces legacy jcmd output)
>       * new jcmd still works with old JVMs (and produces legacy jcmd output)
> How complex would this be? There are two approaches to this. You can either create a new attach listener protocol (we already have ATTACH_API_V2 vs ATTACH_API_V1, so the precedence is there). Or, you can expand the jcmd parsing (see `jcmd(AttachOperation* op, attachStream* out)` in attachListener.cpp).

ATTACH_API_V2 supports "options".
Client (jcmd) detects options supported by the target VM ("getversion options" command) and can set option values in attach command request.
Currently the only supported option is "streaming" (it allows turn off streaming output).
The option is needed only for tests and needs to work for all attach tools (jcmd, jstack, etc.), so it can be set by specifying java property launching attach tool (like `jcmd -J-Djdk.attach.allowStreamingOutput=false PID command`)

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

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


More information about the serviceability-dev mailing list