CPU Profile Time

Questions about YourKit Java Profiler
Post Reply
yongl
Posts: 2
Joined: Fri May 02, 2014 7:08 pm

CPU Profile Time

Post by yongl »

Hi,

I am using yourkit to monitor a java service (multi-threaded). I launched a single client to request some operations against the service. This operation was started at 20 minutes (from the time the service was started and monitored by yourkit) and run for about 80 seconds. So it finished at around 21 min 20 s. When the operation started, I started the CPU sampling. Right after it finished I took a snapshot. Using this snapshot I can verify this operation by checking the "Threads" tab (there is one worker thread become green starting at 20 min and last for around 80 s). However, when I clicked the "CPU" tap and choose "Call tree (by thread)", I found this worker thread's Time(ms) is only 8256 ms. This is only 1/10 of the entire operation running time. So what does this time mean? I know it is the time consumed by CPU to execute functions, but is this time only a portion of the function execution in the entire operation? Or it roughly captures all the function execution time? If the later is true, does it mean for the rest of the time (80s - 8256ms = 71s) there was something else (networking, IO? ) going on?

Thanks and regards!

- Yong
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: CPU Profile Time

Post by Anton Katilin »

Hi,

Sampling gives approximate results by its nature:
http://www.yourkit.com/docs/java/help/cpu_intro.jsp

Also, it measures CPU time by default, not wall time to which you compare:
http://www.yourkit.com/docs/java/help/times.jsp

Best regards,
Anton
yongl
Posts: 2
Joined: Fri May 02, 2014 7:08 pm

Re: CPU Profile Time

Post by yongl »

Anton Katilin wrote:Hi,

Sampling gives approximate results by its nature:
http://www.yourkit.com/docs/java/help/cpu_intro.jsp

Also, it measures CPU time by default, not wall time to which you compare:
http://www.yourkit.com/docs/java/help/times.jsp

Best regards,
Anton
Thanks for your quick reply, Anton. I understand that it is approximated cpu time. But it is 10 times off. So a reasonable explanation would that the during the program's execution there is significant amount of "wall time" that has not been captured by the CPU profiling, right? If I am going to run a 100% CPU intensive workload, then the time should be much closer to the program's running time, is this correct? Thanks again for your time and reply!
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: CPU Profile Time

Post by Anton Katilin »

Yes, it would be closer, especially for the top (long running) methods.

You can change the settings to use wall time for all methods and repeat profiling:
http://www.yourkit.com/docs/java/help/s ... ttings.jsp

Anyway, please note that sampling is intended to detect hot spots, doing it with minimum profiling overhead, that is to find methods which take most of the time with some level of confidence, but not to exactly measure the time itself.

It's the most common profiling task, and sampling is a good tool for solving it.

If your task is to measure exact time, use tracing. However, please note that you'll probably need to change the filters to keep profiling overhead moderate.
Post Reply