Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 931
Ganapa Avatar asked Nov 29 '25 02:11

Ganapa


1 Answers

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.
like image 60
Akshatha Merve Avatar answered Nov 30 '25 16:11

Akshatha Merve



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!