#include <unistd.h>
#include <stdio.h>
#include <assert.h>
-#include <sys/syscall.h>
#include <sched.h>
#include <errno.h>
#include <urcu/arch.h>
-#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
#endif
#include <urcu.h>
-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
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;