Add runall.sh to tarball
[urcu.git] / tests / test_cycles_per_loop.c
CommitLineData
d3d3d8f0
MD
1#include <urcu/arch.h>
2#include <stdio.h>
3
4#define NR_LOOPS 1000000UL
5
6static inline void loop_sleep(unsigned long l)
7{
8 while(l-- != 0)
06f22bdb 9 caa_cpu_relax();
d3d3d8f0
MD
10}
11
12int main()
13{
14 cycles_t time1, time2;
15
06f22bdb 16 time1 = caa_get_cycles();
d3d3d8f0 17 loop_sleep(NR_LOOPS);
06f22bdb 18 time2 = caa_get_cycles();
d3d3d8f0
MD
19 printf("CPU clock cycles per loop: %g\n", (time2 - time1) /
20 (double)NR_LOOPS);
9907018c 21 return 0;
d3d3d8f0 22}
This page took 0.027871 seconds and 4 git commands to generate.