I have a bunch of question about context switches info in Hotspots analysis.
1. In Hotspots->Top-down Tree view:
A. What is the difference between "Context Switch Count: Total" and "Context Switch Count: Self"?
B. Is it counting switch-in, or switch-out, or both?
2. In Hotspots->Bottom-up Tree view, context switch info is shown on the floating menu around cursor
However it appears difficult to understand.
A. For blocks colored with CPU time, it does not tell which CPU it is running on.
How do I know the CPU it is running on? Should I refer to the previous block or next block for the CPU?
B. For blocks colored with synchronization, sometimes there are multiple context switches info shown.
What does it mean?
C. Is the context switches switch-in or switch-out?
D. For blocks colored with preemption, why there are CPU time shown for the thread?
E. For context switched, how do I know which thread is switched to?
A. Total count includes Self count of the function itself and Self count of all functions that were called from that function. That is similar to Total and Self time.
B. switch-out + switch-in pairs
A. It is possible to change grouping on Timeline pane to "Thread / H/W Context"
B. That usually happens if duration of the block is less than 1 pixel and zoom-in helps to see individuals objects on timeline. It that the case?
C. switch-out + switch-in pairs
D. That could be artefacts of "CPU Time" calculation algorithm. It should be possible to see raw events on Timeline after switching to the Hardware Events viewpoint.
E. This information is not currently available.
I would also advise to try Threading analysis based on hw sampling and context switches since 2019 Update 1.
We tried to make Context switch based metrics about waits more refined and show it along with active waits to see the full picture on threading efficiency.
Thank you, Regards, Dmitry