X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=tests%2Fbenchmark%2Ftest_mutex.c;h=8da8b0428d8d8ec7b0e6899be26702f8d7d857c8;hb=61c3fb603104bda9e67c0690c1964e61a770d045;hp=19eb7c4f929b8cb84d5cea95040f4669a7bcd81f;hpb=83e334d03eaba62df373cf44298616458900078a;p=urcu.git diff --git a/tests/benchmark/test_mutex.c b/tests/benchmark/test_mutex.c index 19eb7c4..8da8b04 100644 --- a/tests/benchmark/test_mutex.c +++ b/tests/benchmark/test_mutex.c @@ -33,7 +33,6 @@ #include #include -#include "cpuset.h" #include "thread-id.h" /* hardcoded number of CPUs */ @@ -108,11 +107,7 @@ static void set_affinity(void) } CPU_ZERO(&mask); CPU_SET(cpu, &mask); -#if SCHED_SETAFFINITY_ARGS == 2 - sched_setaffinity(0, &mask); -#else sched_setaffinity(0, sizeof(mask), &mask); -#endif #endif /* HAVE_SCHED_SETAFFINITY */ } @@ -142,27 +137,7 @@ static unsigned int nr_writers; pthread_mutex_t rcu_copy_mutex = PTHREAD_MUTEX_INITIALIZER; -void rcu_copy_mutex_lock(void) -{ - int ret; - ret = pthread_mutex_lock(&rcu_copy_mutex); - if (ret) { - perror("Error in pthread mutex lock"); - exit(-1); - } -} - -void rcu_copy_mutex_unlock(void) -{ - int ret; - - ret = pthread_mutex_unlock(&rcu_copy_mutex); - if (ret) { - perror("Error in pthread mutex unlock"); - exit(-1); - } -} - +static void *thr_reader(void *data) { unsigned long tidx = (unsigned long)data; @@ -197,6 +172,7 @@ void *thr_reader(void *data) } +static void *thr_writer(void *data) { unsigned long wtidx = (unsigned long)data; @@ -231,6 +207,7 @@ void *thr_writer(void *data) return ((void*)2); } +static void show_usage(int argc, char **argv) { printf("Usage : %s nr_readers nr_writers duration (s) \n",