X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=tests%2Ftest_looplen.c;h=e1bd2ea25a037238cba132ba61d2879b1fd36f24;hb=2953b501ab1dcf908d07de9b414a08397519f5b6;hp=634cf976688e48b6b970ddd770d4a951af32ff41;hpb=94b343fd8d68512d78d8646c646c15a1b3f84186;p=urcu.git diff --git a/tests/test_looplen.c b/tests/test_looplen.c index 634cf97..e1bd2ea 100644 --- a/tests/test_looplen.c +++ b/tests/test_looplen.c @@ -3,7 +3,7 @@ * * Userspace RCU library - test program * - * Copyright February 2009 - Mathieu Desnoyers + * Copyright February 2009 - Mathieu Desnoyers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,12 +30,15 @@ #include #include #include -#include #include #include #include +#ifdef __linux__ +#include +#endif + #if defined(_syscall0) _syscall0(pid_t, gettid) #elif defined(__NR_gettid) @@ -58,10 +61,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 +78,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;