Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Little micro-benchmark for Linux to test the cost of context switching and system calls
C Shell
Branch: master

Disable AVX instructions.

This doesn't buy us anything here and causes SIGILL with
some kernels booted with the "noxsave" flag.
latest commit ec4ba7cb38
@tsuna authored
Failed to load latest commit information.
.gitignore Trying to improve the benchmark by providing a new method to mesure
Makefile Disable AVX instructions.
README
cpubench.sh Support older versions of taskset.
timectxsw.c Initial import.
timectxswws.c timectxswws: Have the working set aligned on a page boundary.
timesyscall.c Initial import.
timetctxsw.c Initial import.
timetctxsw2.c Trying to improve the benchmark by providing a new method to mesure

README

Little micro-benchmarks to assess the performance overhead of context
switching.

timesyscall: Benchmarks the overhead of a system call.
timectxsw:   Benchmarks the overhead of context switching between 2 processes.
timetctxsw:  Benchmarks the overhead of context switching between 2 threads.
timectxswws: Benchmarks the overhead of context switching between 2 processes
             using a working set of the size specified in argument.
timetctxsw2: Benchmarks the overhead of context switching between 2 threads,
             by using a shed_yield() method.
             If you do taskset -a 1, all threads should be scheduled on the
             same processor, so you are really doing thread context switch.
             Then to be sure that you are really doing it, just do:
               strace -ff -tt -v taskset -a 1 ./timetctxsw2
             Now why sched_yield() is enough for testing ? Because, it place
             the current thread at the end of the ready queue. So the next
             ready thread will be scheduled.
             I also added sched_setscheduler(SCHED_FIFO) to get the best
             performances.
Something went wrong with that request. Please try again.