How to profile a program that didn't wait for the user to launch and exited quickly

When profiling with a tool like VisualMV, in what order should the programs be run? The program I want to profile is pretty fast and doesn't wait for the user to close it. It's not as if I could really quickly launch the program, switch to VisualVM, and start the profiling process without the first program ending.

An extra line of code has been added to my program that prompts the user to press Enter to run. So I run my program and when it says "press enter" I go to VisualVM, find the process I want, go to the profiling tab and hit CPU. When VisualVM finishes configuring, I go back to my program and press Enter to run it. It is right? Or should it be done in a different order?

Obviously profiling only works on the part of the program running at the time, right?

+3


source to share


2 answers


For VisualVM 1.3.6 or newer, there is a plugin called Startup Profiler . This allows you to profile your application from the start.



+2


source


Not sure about VisualMV, but in JProfiler you can specify options that will make the program wait until JProfiler connects. This way, no part of the program is run until the JProfiler is profiling.



+1


source







All Articles