Friday 19 January 2007

Java Profilers

I had to do some research and pick a Java profiler to use recently. Being open minded instead of using what I knew and the one that is built-in to my favorite IDE, Eclipse, I did some research. But, the task at hand was easily accomplished using hprof and jconsole. Here are some useful links to profilers that I have used in the past.

Using hprof
HPROF - A Heap/CPU profiling tool

In the past I have found the profiler that is included in Netbeans very useful. Inspite of Eclipse being my IDE of choice, I have had this weird combination of using Eclipse to write my code and to run it, and then hook it up with the Netbeans profiler.

Using jconsole
If you are using JDK 5, then use the built-in jconsole utility to provide some valuable insight into what the JVM is doing. All you need to do is to start the JVM with this argument -Dcom.sun.management.jmxremote.

Thus, if you are debugging a java program, use this as part of your command line or if you are debugging your application server's web instance, pass this via your application server to your JVM.
Then just execute jconsole from your JDK/bin directory to connect to the running instance and view.

No comments: