tags:

views:

851

answers:

4

I just installed Java 1.6_07 so I could try profiling with VisualVM. It tells me that my app is spending 60% of its time in sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run

How do I find out what it was doing during that time? How much of the time was it waiting for something to call it, or doing something else? What was calling it and what was it calling? I just can't seem to find any way to drill down to deeper levels like there is in Quantify or the Perl profiler.

+1  A: 

Does your App use RMI over TCP? If not, is it possible that this is a heisenbug, caused by instrumenting the VM? I assume VisualVM must use RMI calls to figure out what's going on in the JVM....

Tim Howland
I had the same problem.
Seun Osewa
A: 

@Tim-Howland It uses quite a lot of RMI. My point is that this debugger doesn't, as far as I can tell, tell me what is taking the time in ConnectionHandler.run - is it the waiting for a RMI call, or processing the call, or what? I'm used to profilers that exclude time spend blocked waiting for something, and which tell you that of the XXX seconds spend in method A, YYY of them were spent calling B.foo() and ZZZ of them were spent in C.bar().

Paul Tomblin
Are you profiling all JVM and sun classes (such as java.net.Socket and its sun implementations)? I would set that as your root, and then enable profling of ALL clases, including the core java.* and sun* classes.
James Schek
+4  A: 

I don't have experience with VisualVM -- but JRockit's profiler does provide this information; you may consider using it instead.

Update: a question with a list of java profilers can be found here

Charles Duffy
Actually, I ended up using the 10 day evaluation of jprofiler. And since I can't convince my boss to spend the $500, I'm going to be burning through a lot of fake email addresses next time I need to do any profiling.
Paul Tomblin
JRockit's profiler, last I used it, had a zero-cost development/non-production-use license which allowed up to 30 minutes of use per JVM invocation; perhaps that might be more appropriate.
Charles Duffy
JRockit Mission Controls new license has no such time restriction. It's free for use for development and evaluation.
Tnilsson
A: 

I have started using the new VisualVM 1.2. It allows profiling CPU and drilling down using a call graph. Try it out.

Yuval F