From C # can I determine the number of context switches that occurred while executing a block of code in a particular thread? Ideally, I would like to know how many times and which processor was specified in my stream code.
I know that I can use tools such as Event Tracing for Windows and related viewers, but it seemed a little harder to get the data I wanted.
In addition, tools such as Process Explorer are too difficult to determine how many switches occurred as a result of a particular block of code.
Background . I am trying to check the actual performance of a low-level blocking primitive in .NET (as a result of some comments on a recent blog post I made.
source share