X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=tests%2Fcommon%2Fapi.h;h=a260463ad09ea212bb7ee4517a2fd995f21b2d74;hb=153b081a9b007aad7bece415dc3bf1125edd2da3;hp=5ca045c66cab375e75ce2f8747c860ade6038ff2;hpb=0614a2e61ccbf150cc51d4fd3073b285983417c5;p=userspace-rcu.git diff --git a/tests/common/api.h b/tests/common/api.h index 5ca045c..a260463 100644 --- a/tests/common/api.h +++ b/tests/common/api.h @@ -165,7 +165,7 @@ static int smp_thread_id(void) id = pthread_getspecific(thread_id_key); if (id == NULL) return __smp_thread_id(); - return (long)(id - 1); + return ((long) id - 1); } static thread_id_t create_thread(void *(*func)(void *), void *arg) @@ -228,21 +228,26 @@ static void wait_all_threads(void) } } +#ifdef HAVE_SCHED_SETAFFINITY static void run_on(int cpu) { -#if HAVE_SCHED_SETAFFINITY cpu_set_t mask; CPU_ZERO(&mask); CPU_SET(cpu, &mask); sched_setaffinity(0, sizeof(mask), &mask); -#endif /* HAVE_SCHED_SETAFFINITY */ } +#else + +static void run_on(int cpu __attribute__((unused))) +{} +#endif /* HAVE_SCHED_SETAFFINITY */ /* * timekeeping -- very crude -- should use MONOTONIC... */ +static inline long long get_microseconds(void) { struct timeval tv;