Call tree (wall time) missing methods in samples

Questions about YourKit Java Profiler
Post Reply
ddlatham
Posts: 13
Joined: Wed May 25, 2011 8:30 pm

Call tree (wall time) missing methods in samples

Post by ddlatham »

I'm trying to get a view of what my threads are spending their time doing and waiting for (don't care about CPU in particular).

Using CPU Sampling, I've tried setting:
walltime=*
and also tried:
walltime=* : *(*)

I've also tried to disable all filters in the UI.

I connect to a remote app (agent attached via yjp.sh -attach <pid>). Enable CPU Sampling, run for several minutes, capture snapshot.

Then, when examining the Call tree (either all threads, or on a thread by thread basis) the results don't seem to match very well with the stack traces I see in the Threads tab. In the Threads tab (or when I do manual jstack's, there are some methods in my code that I see frequently (> 30% of my samples) but they show up with either tiny % in the Call tree or none at all.

In the samples, I see threads like this:

DLP-3 [WAITING] CPU time: 22s
sun.misc.Unsafe.park(boolean, long)
java.util.concurrent.locks.LockSupport.park(Object)
java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt()
java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(int)
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(int)
java.util.concurrent.FutureTask$Sync.innerGet()
java.util.concurrent.FutureTask.get()
<my method>

or:
DLP-8 [SLEEPING] CPU time: 5s
java.lang.Thread.sleep(long)
<another method I care about>

Why don't these methods show up in the call tree with percentage equal to their appearance in the samples? How can I make them do so?

Using YJP 12.0.5 (both agent and UI)
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Call tree (wall time) missing methods in samples

Post by Anton Katilin »

Hello,

There is an internal list of so called "zero-time methods" which currently contains:

Code: Select all

java.lang.Object : wait(*)
java.lang.Thread : sleep(*)
java.lang.Thread : yield(*)
java.net.PlainSocketImpl : socketAccept(*)
java.net.PlainSocketImpl : accept(*)
org.apache.tomcat.jni.Socket : accept(*)
sun.nio.ch.ServerSocketChannelImpl : accept0(*)
sun.misc.Unsafe : park(*)
java.util.concurrent.locks.LockSupport : park*(*)
com.ibm.tools.attach.javaSE.IPC : waitSemaphore(*)
sun.nio.ch.EPollArrayWrapper : epollWait(*)
It's applied in UI. Time of matching methods is subtracted from their callers in CPU profiling views.

This list is not applied in the Threads view when you see stacks.

This should explain what you see.

Unfortunately, this list is not configurable at the moment, in version 12. The good news is that we can change this in the next version. Early access will be available very soon, maybe even by the end of this week.

The very first EAP (early access program) build will contain an option to show the zero time methods too. I'll notify you in this thread when the build is ready.

Best regards,
Anton
ddlatham
Posts: 13
Joined: Wed May 25, 2011 8:30 pm

Re: Call tree (wall time) missing methods in samples

Post by ddlatham »

Anton Katilin wrote:There is an internal list of so called "zero-time methods"
Thank goodness. I'm not crazy! (At least not for this reason).

I'm eager to give the EAP build a spin so that I can disable this list.

Thanks,
Dave
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Call tree (wall time) missing methods in samples

Post by Anton Katilin »

Hi Dave

The EAP build 13004 is available for download:
http://www.yourkit.com/eap

Please find the text "-Dyjp.zero.time.methods=false" in the list of changes for detail.

Best regards,
Anton
ddlatham
Posts: 13
Joined: Wed May 25, 2011 8:30 pm

Re: Call tree (wall time) missing methods in samples

Post by ddlatham »

I gave it a try, and it works great. Now I can see what my threads are actually spending time on.

Any chance this could go in the actual UI somewhere?
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Call tree (wall time) missing methods in samples

Post by Anton Katilin »

Hi Dave

Thanks for testing the new build.
Any chance this could go in the actual UI somewhere?
Could you please clarify what you mean.

If you mean the ability to configure the list of zero time methods directly and explicitly, we'll probably add it in the future. There is corresponding change request.

Best regards,
Anton
ddlatham
Posts: 13
Joined: Wed May 25, 2011 8:30 pm

Re: Call tree (wall time) missing methods in samples

Post by ddlatham »

If you mean the ability to configure the list of zero time methods directly and explicitly, we'll probably add it in the future. There is corresponding change request.
Yes, that's correct. Something besides a system property to enable / disable, whether it's still a simple toggle or the ability to more control it at a more fine grained level.
ksafonov
Posts: 1
Joined: Fri Jul 18, 2014 3:14 pm

Re: Call tree (wall time) missing methods in samples

Post by ksafonov »

+1 for the UI setting!
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Call tree (wall time) missing methods in samples

Post by Anton Katilin »

FYI:

In upcoming build 14102 Thread.sleep() will no longer be in the "zero-time methods" list.
If you want to exclude it please use the What-if feature:
http://www.yourkit.com/docs/java/help/cpu_what_if.jsp
Post Reply