How to run a Java application at the same time as the profiler?

I have tried VisualVM and JVM Monitor so far and they have not behaved the way I need. A brief overview of my program: I need to measure a fast application with an accuracy of subseconds over 5+ threads. When I can select "Start profiling", my application is finished. As a workaround, I put it System.in.read()at the end of my application, but that means everything from reading is garbage information and skips some of the dimensions.

The JVM monitor specifically has to run automatic profiling at the start of each application, being built into Eclipse.

+4
source share
2 answers

From the manual: http://www.jvmmonitor.org/doc/#How_to_monitor_app_that_runs_for_short_time

How can I control my application, which only runs for a very short time?

Monitoring an application that runs in such a short time that you cannot connect the JVM monitor,

Set a breakpoint at the point of interest and run the application in debug mode.
Connect the JVM Monitor to the application when it is stopped at a breakpoint.
Collect profiling data using the JVM monitor.

Note. If your application is launched by Eclipse, you can specify the following option to pause your application with a debugger attached.

-agentlib:jdwp=transport=dt_socket,address=<port number>,server=y,suspend=y
+2

VisualVM 1.3.6 . .

+2

All Articles