JVisualVM to run scripts when CPU reached 100%

29 views Asked by At

using JVisualVM 2.0.5 I found an instance where the CPU usage of my application reached 100%. Is there a way for me to run scripts to check what happened during this time (01:00:13PM). I checked my logs and nothing significant happened. I'm planning to run a thread dump during this point before CPU goes back to normal. Or is there a better way to manage this or plugins?

enter image description here

1

There are 1 answers

1
aled On

No, jvisualvm doesn't provide that kind of monitoring feature. You need to create your own script or application to monitor when the process is using too much CPU (for given values of too much) and execute something else to capture information.

Another option would be to use a different tool like Java Flight Recorder which may be able to capture thread usage over time without any special script: https://stackoverflow.com/a/61006913/721855