View Code? Open in Web Editor
NEW
Little micro-benchmark for Linux to test the cost of context switching and system calls
Home Page: http://blog.tsunanet.net/2010/11/how-long-does-it-take-to-make-context.html
License: GNU General Public License v3.0
Shell 12.76%
C 80.50%
Makefile 6.74%
contextswitch's Issues
Hi tsuna,
In your timectxsw.c benchmark, the variable nswitches is not correct.
It should be:
const int nswitches = iterations * 6;
and not:
const int nswitches = iterations << 2;
If you follow through the child and parent for loops you will see there are 6 context switches per iteration.
Many thanks for a really useful bit of code.
Christo
This test can also run on a Raspberry Pi ๐ if the Makefile CFLAGS option "-mno-avx" is replaced with "-Wno-abi".
Not really an issue but an enhancement