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)
Call tree (wall time) missing methods in samples
-
- Posts: 13
- Joined: Wed May 25, 2011 8:30 pm
-
- Posts: 6172
- Joined: Wed Aug 11, 2004 8:37 am
Re: Call tree (wall time) missing methods in samples
Hello,
There is an internal list of so called "zero-time methods" which currently contains:
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
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(*)
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
-
- Posts: 13
- Joined: Wed May 25, 2011 8:30 pm
Re: Call tree (wall time) missing methods in samples
Thank goodness. I'm not crazy! (At least not for this reason).Anton Katilin wrote:There is an internal list of so called "zero-time methods"
I'm eager to give the EAP build a spin so that I can disable this list.
Thanks,
Dave
-
- Posts: 6172
- Joined: Wed Aug 11, 2004 8:37 am
Re: Call tree (wall time) missing methods in samples
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
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
-
- Posts: 13
- Joined: Wed May 25, 2011 8:30 pm
Re: Call tree (wall time) missing methods in samples
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?
Any chance this could go in the actual UI somewhere?
-
- Posts: 6172
- Joined: Wed Aug 11, 2004 8:37 am
Re: Call tree (wall time) missing methods in samples
Hi Dave
Thanks for testing the new build.
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
Thanks for testing the new build.
Could you please clarify what you mean.Any chance this could go in the actual UI somewhere?
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
-
- Posts: 13
- Joined: Wed May 25, 2011 8:30 pm
Re: Call tree (wall time) missing methods in samples
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.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.
-
- Posts: 1
- Joined: Fri Jul 18, 2014 3:14 pm
Re: Call tree (wall time) missing methods in samples
+1 for the UI setting!
-
- Posts: 6172
- Joined: Wed Aug 11, 2004 8:37 am
Re: Call tree (wall time) missing methods in samples
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
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