Time (ms) call by thread view Vs Time(ms) Threads view

Questions about YourKit Java Profiler
Post Reply
Afrogeek
Posts: 21
Joined: Mon Feb 21, 2011 1:10 pm

Time (ms) call by thread view Vs Time(ms) Threads view

Post by Afrogeek »

Hi,
It seems always not clear for me what is the difference between CPU time in call_by_thread view and the time in Threads view ?
Which one should i consider for comparing CPU usage by each thread of my application.

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

Re: Time (ms) call by thread view Vs Time(ms) Threads view

Post by Anton Katilin »

Hello,
It seems always not clear for me what is the difference between CPU time in call_by_thread view
It shows results based on CPU profiling, i.e. on either sampling or tracing.

http://www.yourkit.com/docs/95/help/cpu_intro.jsp

It shows CPU time spent in methods which were running while the sampling or tracing was active. The time for a thread is a sum of its top method times during the CPU profiling period.
the time in Threads view
It shows CPU time of the thread since its start.
Which one should i consider for comparing CPU usage by each thread of my application.
If you need the total CPU time per thread, use the Threads view.

Best regards,
Anton
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Time (ms) call by thread view Vs Time(ms) Threads view

Post by Anton Katilin »

P.S.

Please also note that CPU profiling can measure wall time for specified methods instead of CPU time (see http://www.yourkit.com/docs/95/help/times.jsp ). This means that the time in call trees and other views presenting CPU profiling results is a sum of CPU time for some methods and wall time for others.
Afrogeek
Posts: 21
Joined: Mon Feb 21, 2011 1:10 pm

Re: Time (ms) call by thread view Vs Time(ms) Threads view

Post by Afrogeek »

Hello Anton,
Thanks for your answer.
Another question. Consider that i want to obtain the results corresponding to the threads view.
When i extract the results from the snapshot file using :
java -Dexport.csv -jar YourKit_Java_Profiler_9.5.5.app/lib/yjp.jar -export file Snapshots/
this generates a csv file called call-tree-by-thread.csv. But according to the name of this file, it contains doesn't show the results corresponding to the thread view (CPU time of a thread since it starts).

So how can i get the thread view results from command line?

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

Re: Time (ms) call by thread view Vs Time(ms) Threads view

Post by Anton Katilin »

The Threads view cannot be exported in offline mode because it contains a lot of information which is fully presented using the full featured profiler UI.

We can consider adding offline export of some of that information.

Could you please describe your use case. Will a list of thread names along with thread CPU times be enough?
Afrogeek
Posts: 21
Joined: Mon Feb 21, 2011 1:10 pm

Re: Time (ms) call by thread view Vs Time(ms) Threads view

Post by Afrogeek »

Hi,
Yes that is exactly what we are looking for.
How should i proceed ?
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Time (ms) call by thread view Vs Time(ms) Threads view

Post by Anton Katilin »

We've added corresponding feature request.

If you describe your use case and convince us that the feature would be useful for other users, we'll give it a higher priority.
Afrogeek
Posts: 21
Joined: Mon Feb 21, 2011 1:10 pm

Re: Time (ms) call by thread view Vs Time(ms) Threads view

Post by Afrogeek »

Hi,
I think it will be very usefull to have the Thread view in the list of possible exported views available on this page :
http://www.yourkit.com/docs/95/help/export.jsp
You didn't told me how i can do it now -....

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

Re: Time (ms) call by thread view Vs Time(ms) Threads view

Post by Anton Katilin »

As I wrote, you cannot do it now, but we've added a feature request. Please read my previous posting.
Afrogeek
Posts: 21
Joined: Mon Feb 21, 2011 1:10 pm

Re: Time (ms) call by thread view Vs Time(ms) Threads view

Post by Afrogeek »

Hi,
I have a set of snapshot files obtained from the profiler running on server application i am profiling.
Is it possible to extract CPU time per thread ( Thread View) from the GUI profiler using the snapshot file?
You told me this cannot be done from command line. i am not interested in the cumulative time(of methods) obtained when extracting results from call_tree_by_thread.csv file.

any suggetion?
thx
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Time (ms) call by thread view Vs Time(ms) Threads view

Post by Anton Katilin »

That particular view neither can be exported to csv from UI. As I wrote, we've added a request to provide this functionality.
philipc
Posts: 5
Joined: Thu Feb 09, 2017 4:53 pm

Re: Time (ms) call by thread view Vs Time(ms) Threads view

Post by philipc »

Anton,

>Is it possible to extract CPU time per thread ( Thread View) from the GUI profiler using the snapshot file?

My request is to see CPU time per thread at a specific timestamp. This is helpful so I can see, for example, when total CPU is high at 01:23:45 timestamp, and thread 1 is using 80% CPU, and thread 2 is using 20% CPU, I can look at the callstacks for thread 1 and thread 2.

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

Re: wolTime (ms) call by thread view Vs Time(ms) Threads vie

Post by Anton Katilin »

Hi Philip

To clarify: exactly what output would you like to have?

For example, would the following be sufficient?

<time stamp 1> <thread ID 1> <CPU usage %>
<time stamp 1> <thread ID 2> <CPU usage %>
...
<time stamp 2> <thread ID 1> <CPU usage %>
<time stamp 2> <thread ID 5> <CPU usage %>
...

Best regard,
Anton
Post Reply