Freigeben über


How to collect stacks during context switches?

With xperf being more and more adopted and with rich stackwalking capabilities, its only natural to use it for finding out bottlenecks and cause for switch out.

Findout the ready thread information and what causes the threads to switch out and the associated stack that woke up when a thread switches back in is one way to determine what was the offending stack that causes other some other threads to switch out. This helps us identify potential hot locks or just really expensive locks or issues due to false data sharing.

 

You can run the following command to capture stack traces with ready thread information.

 xperf –on base+cswitch+dispatcher –stackwalk cswitch+readythread