views:

298

answers:

2

I have a Web Application deployed to a local Glassfish server which I would like to profile in order to see which parts of my code is accessed most frequently. The code consists of JSF beans and Remote EJBs, with both being deployed in a single EAR. I tried using VisualVM to profile my Application but, although I can successfully connect to the Glassfish server as well as my context root, VisualVM doesn't seem to profile my own classes (in the com.test.* namespace). I see lots of Sun classes and other dependencies such as Lucene being accessed, but not a single instance of my own classes.

My question is thus: am I doing something wrong or is this a shortcoming of VisualVM and should I therefor try a different profiling tool?

+3  A: 

You can use any of the following:

Any of them can connect to a remote server and to profile it. The list in http://java-source.net/open-source/profilers contains some open source profilers (notice that many items are APIs and libraries, not profilers per se)

David Rabinowitz
+1 for YourKit !
romaintaz
Thanks for the response, but I think you misunderstood me. I rephrased the question, hopefully what I'm asking is clearer now.
Zecrates
What are you defining by profiling? Memory consumption, performance, call stack, deadlocks?
David Rabinowitz
Performance (CPU) and memory consumption. I'd like to for instance see that Method A takes up 20% of my execution time and that Class B occupies 15% of total memory usage.
Zecrates
In that case visualvm is not for you (unless you are using some plugin I'm not aware of). Any of the profilers I've mentioned will help you with this.
David Rabinowitz
Thanks, I tried YourKit and it managed to profile my classes. I could not get Eclipse TPTP to work though :( Are there any other free profilers that can do the same thing?
Zecrates
Not that I am aware of
David Rabinowitz
A: 

The latest version of netbeans has a profiler. Try it.

Conor
As I understand it, that is just an embedded version of VisualVM, no?
Zecrates
According to: http://blogs.sun.com/nbprofiler/entry/five_visualvm_myths_demystified : "The NetBeans profiler is sometimes incorrectly mentioned to be the VisualVM integrated into the NetBeans IDE. This statement is kind of inside out, VisualVM reuses some of the NetBeans profiler's features: profiling engine, HeapWalker, threads monitor, UI components etc. NetBeans profiler has been introduced in 2004, VisualVM in 2007. The VisualVM - IDE integration is available for Eclipse and IDEA.".
Conor