how to profile application startup with visualvm how to profile application startup with visualvm java java

how to profile application startup with visualvm


Use the eclipse launcher, and set a breakpoint at an appropriate place in the main method.

Then, start in debug mode, enable profiling in visualVM, and then resume using eclipse.

That won't profile class loading and stuff, but it's good enough for me.


Are you setting up the profiling using the `-Xrunjdwp" command-line option? If so, that option has a "suspend" parameter for just this purpose:

True if the target VM is to be suspended immediately before the main class is loaded; false otherwise.

Example from my own config:

-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

I use this with the YourKit profiler, but I think the principle is the same.


I found Startup Profiler helpful:

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