Automatically start CPU profiling with VisualVM
Asked Answered
S

3

14

I'm totally new to VisualVM.

Is there a way to automatically start CPU profiling? My issue is that I start a program from Eclipse which runs for approx. 20 seconds. By the time I can open up the tab and click on CPU profiling, the app has almost finished processing.

Subkingdom answered 27/9, 2012 at 18:2 Comment(1)
Any progress on this?Veneer
C
8

I don't know how to automatically start profiling but I have a workaround.

You can set a breakpoint at the start of your program's main and start the program from Eclipse in debug mode. After beginning to profile in VisualVM resume your program in Eclipse.

Clop answered 27/9, 2012 at 18:21 Comment(1)
thats a fair workaround ... however it would be still interesting how to automatically trigger the monitor. Thanks tough!Subkingdom
D
0

https://visualvm.github.io/startupprofiler.html

Startup Profiler plugin for VisualVM 1.3.6 and newer enables instrumented profiling of local Java 5+ applications from their startup. It is also helpful when profiling short-running processes.

Derk answered 12/3, 2019 at 21:46 Comment(0)
H
0

I added a delay at the first line of the executing code, so I have time to start VisualVM profiling: TimeUnit.SECONDS.sleep(10);

Using VisualVM's Startup Profiler plugin was time consuming to configure, and I wasn't able to get the debug/breakpoint method working.

Herringbone answered 28/9, 2020 at 16:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.