Daniel
Daniel

Reputation: 651

How to test context switch performance?

How to test context switch performance? Firstly, we need to know all the scenarios of context switch.

I'm NOT sure that I'm able list all those scenarios:

  1. process context switch
  2. thread context switch
  3. process signal context switch
  4. kernel thread context switch
  5. interrupt context switch

Secondly, is there any way or method to test those context switch performance?

Any suggestions on context switch scenarios and test methods are warmly welcomed.

Upvotes: 3

Views: 3812

Answers (1)

gby
gby

Reputation: 15218

You forgot system call induced context switch :-)

The lmbench benchmark suite has the lat_ctx test that tests context switch times. You can run it on your hardware to test the cost of context switches (http://www.bitmover.com/lmbench/)

In addition, recent Linux version has a performance testing tool called "perf" which can record and report how many context switches occurred during a run of a traced program as well as much more.

Hope this helps!

Upvotes: 4

Related Questions