Community
cancel
Showing results for 
Search instead for 
Did you mean: 
k_sarnath
Beginner
48 Views

SAV and Context switches

I have just started using an evaluation version of vTune. I have a question on SAV.

How does vTune handle context switches that happen in the middle of sampling....?

Say, the counters have not reached the "SAV" value, and a context switch happens -- what happens to the counters that are in the middle of sampling? Does vTune handle that scenario?
0 Kudos
6 Replies
David_A_Intel1
Employee
48 Views

Context switches do not impact sampling, since sampling is system-wide. The PMU (performance monitoring unit) watches the hardware and when the event count register overflows an interrupt is triggered and the execution context is collected.
k_sarnath
Beginner
48 Views

True -- SAV is done for system wide.... but is reported process-wise, right?
So, when the CPU notifies it could "possibly" involve samples from the previous process too...., right?
So, I was wondering if vTune is smart enough to collect half-filled samples on context switches?

( SAV for 1ms should be good enough... as most OSes hve 10ms timer tick.. but still this is a corner case and I was wondering if vTune was handling it.)

David_A_Intel1
Employee
48 Views

I'm not sure I understand your question but, in general, the answer is no. The VTune analyzer is not keeping track of context switches so it can't do anything special with respect to them.
k_sarnath
Beginner
48 Views

ok, Pls allow me to illustrate...

Say we have programmed a countersuch that a counter-overflow interrupt occurs after 10,000 events.


Process Cumulative Event Count vTune Action
-----------------------------------------------------------------------------------------
services.exe 1000none
mplayer.exe 4000none
sse_test.exe 8000none
svchost.exe10000vTune records 1 sample for "svchost.exe"


Now, all 10000 events are attributed to "svchost.exe". No?
If vTune had tracked context switches (god knows how..), it would have recorded 1000 events for services.exe, 3000 events for mplayer.exe, 4000 events for sse_test.exe and 2000 events for svchost.exe.

I hope my point is clear to you now. Can you share your thoughts on this?
Thank you,
Best Rgards,
Sarnath
David_A_Intel1
Employee
48 Views

I understand what you are saying. I think my response to you in the other thread answers this question, also. Let me know, if it does not.

k_sarnath
Beginner
48 Views

Yeah, it does. Thanks for your time!