diff options
Diffstat (limited to 'lib/libc_r/BENCH/yield.c')
-rw-r--r-- | lib/libc_r/BENCH/yield.c | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/lib/libc_r/BENCH/yield.c b/lib/libc_r/BENCH/yield.c deleted file mode 100644 index c197afd2b2d..00000000000 --- a/lib/libc_r/BENCH/yield.c +++ /dev/null @@ -1,55 +0,0 @@ -#include <pthread.h> -#include <sched.h> -#include <string.h> -#include <err.h> -#include "bench.h" - -static char name[] = "Thread Yield Time (Busy)"; -static char doc[] = -"\tThread yield time is defined as the amount of time between that\n" -"\tpoint when a running thread voluntarily gives up the CPU until\n" -"\tthe highest priority runnable thread begins execution of its\n" -"\tapplication code."; - -#ifdef DEBUG -volatile int state = 0; -#endif -bench_t b; - -void * -other_thread(arg) - void *arg; -{ - - pthread_set_name_np(pthread_self(), "oth"); - bench_amortize(&b, BENCH_LOOPS) { -#ifdef DEBUG - if (state != 0) abort(); - state = 1; -#endif - sched_yield(); - } -} - -int -main() { - pthread_t other; - - bench_init(&b, name, doc, "per yield"); - b.n = BENCH_LOOPS; - bench_header(&b); - pthread_create(&other, NULL, other_thread, NULL); - while (b.i < b.n) { -#ifdef DEBUG - if (state != 1) abort(); - state = 0; -#endif - sched_yield(); - } - pthread_join(other, NULL); - b.divisor = 2; - bench_report(&b); - exit(0); -} - - |