What are some good end to end CPU profilers that exist for Java?
Quick list of things I'm looking for:
Google has a nice profiler for C/C++ - http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html
If the Java equivalent of this exists, it'd be exactly what I'm looking for.
I'm not including HProf in my list of prospective profilers because it performs badly compared to other commercial profilers I've looked at when you use accurate CPU call profiling (Usually done via Byte Code Injection, which is slow, but HProf appears at least an order of magnitude slower than other profilers, and when a single sampling profile run takes 1-2 hours, waiting more than a day for the same run is unacceptable)
My favorite, by far, is JProfiler. I didn't realize it until just now (because I always use the interactive profiling GUI), but it does in fact support offline profiling, exactly like you described.
A few other cool features:
It profiles all your SQL statements, so you can see which DB queries are slowing you down.
It keeps track of which methods (in which classes & packages) are allocating the most memory, for which types of objects & arrays, and the longevity of those objects. So, if you're leaking memory, it's easy to track down which types of class instances are outliving their usefullness, and to find the methods where those objects were originally allocated (and who's holding the references that are keeping the objects alive).
You can keep track of the VM growth, monitoring the frequency of GC full collections, and determining how many objects (of which type) were freed during each collection cycle.
And of course, you get a hierarchical breakdown of all method invocations, with the number of calls and mean execution time (exclusive or inclusive) of the whole call stack. You can also view this hierarchy from the perspective of "worst bottleneck" functions, ordered either by execution time or memory allocation.
For me, JProfiler is one of the most important tools in my development process (second only to Eclipse).
Also: there's a free 10-day trial. Download it and check it out. And, btw, I'm not affiliated with the company or anything. I've just been a happy customer for the last five or six years.
I am not familiar with offline profiling. Isn't it what hprof is for?. Otherwise I've had very good experience with YourKit profiler.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With