Reputation: 5659
I have a small Java app which reads a large file into memory, does some processing and prints some results to standard out. It's bundled as a jar file.
I want to measure the performance of the application, both in terms of memory and speed, using Java VisualVM, but I don't seem to be able to attach to the execution of the jar because it only runs for around 2 seconds.
How can I measure the performance of this short-running application?
Upvotes: 0
Views: 393
Reputation: 6981
You can try the startup profiler plugin:
https://visualvm.java.net/startupprofiler.html
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.
Upvotes: 0
Reputation: 6363
You can launch your program with VisualVM from inside your IDE. Eclipse and IntelliJ have plugins for Visual VM which makes it very easy to launch your program with Visual VM and not have to connect to the application after starting it. My understanding is that Netbeans has an integrated profiler on which VisualVM was based.
Upvotes: 1