Ganapa
Ganapa

Reputation: 73

Counting the number of context switches in a c program when that program is executed

I want to output the number of context switches that are performed by the windows OS while executing my program.

Upvotes: 3

Views: 1167

Answers (1)

Akshatha Merve
Akshatha Merve

Reputation: 41

You can use Performance-counter for this purpose.

From : http://msdn.microsoft.com/en-us/library/aa373083%28VS.85%29.aspx

You can view context switch data in two ways:

  • The System\Context Switches/sec counter in System Monitor reports systemwide context switches.
  • The Thread(_Total)\Context Switches/sec counter reports the total number of context switches generated per second by all threads.

Upvotes: 1

Related Questions