X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=tests%2Ftest_looplen.c;h=16674e76ac442343b77ea27d1994a5920cd6c9e7;hp=53d39cd9edb6d559bebeb9794b0599591154cfa8;hb=a5bae03d59c22e57263b8610b9fed99738303cf0;hpb=6982d6d71aeed16d2d929bd0ed221e8f444b706e diff --git a/tests/test_looplen.c b/tests/test_looplen.c index 53d39cd..16674e7 100644 --- a/tests/test_looplen.c +++ b/tests/test_looplen.c @@ -30,27 +30,11 @@ #include #include #include -#include #include #include #include -#if defined(_syscall0) -_syscall0(pid_t, gettid) -#elif defined(__NR_gettid) -static inline pid_t gettid(void) -{ - return syscall(__NR_gettid); -} -#else -#warning "use pid as tid" -static inline pid_t gettid(void) -{ - return getpid(); -} -#endif - #ifndef DYNAMIC_LINK_TEST #define _LGPL_SOURCE #else @@ -58,10 +42,10 @@ static inline pid_t gettid(void) #endif #include -static inline void loop_sleep(unsigned long l) +static inline void loop_sleep(unsigned long loops) { - while(l-- != 0) - cpu_relax(); + while (loops-- != 0) + caa_cpu_relax(); } #define LOOPS 1048576 @@ -75,9 +59,9 @@ int main(int argc, char **argv) double cpl; for (i = 0; i < TESTS; i++) { - time1 = get_cycles(); + time1 = caa_get_cycles(); loop_sleep(LOOPS); - time2 = get_cycles(); + time2 = caa_get_cycles(); time_tot += time2 - time1; } cpl = ((double)time_tot) / (double)TESTS / (double)LOOPS;