The tool option allows external processes to be started when an event occurs.
The following example displays a simple message when the JVM stops. The %pid token is used to pass the pid of the process to the command. The list of available tokens can be printed with -Xdump:tokens, or found in Dump agent tokens. If you do not specify a tool to use, a platform specific debugger is started.
java -Xgcpolicy:metronome -Xdump:tool:events=vmstop,exec="echo process %pid has finished" -version VMDUMP006I Processing dump event "vmstop", detail "#00000000" - please wait. JVMDUMP007I JVM Requesting Tool dump using 'echo process 254050 has finished' JVMDUMP011I Tool dump spawned process 344292 process 254050 has finished JVMDUMP013I Processed dump event "vmstop", detail "#00000000".
By default, the range option is set to 1..1. If you do not specify a range option for the dump agent the tool will be started once only. To start the tool every time the event occurs, set the range option to 1..0. See range option for more information.