11 #include <l4/util/rdtsc.h>
12 #include <l4/sys/kip.h>
13 #include <l4/re/env.h>
17 #define WORKSET_SIZE (6*1024*1024)
18 //#define ALL_WORKSETS_BENCH
25 struct s array[0x1000000/sizeof(struct s)];
26 #define REPEATS (0x20000000)
28 static __inline__ uint64_t rdtsc(void)
32 asm volatile("rdtsc" : "=a" (a), "=d" (d));
34 return (((uint64_t)a) | (((uint64_t)d) << 32));
37 int main(int argc, char *argv[])
41 #ifdef ALL_WORKSETS_BENCH
42 for (size = 1024; size <= sizeof(array); size *= 2)
43 #else //!ALL_WORKSETS_BENCH
47 size = strtoul(argv[1], &nxt_cr, 0);
53 for (i=0; i < size / sizeof(array[0]); i++)
54 array[i].ptr = &array[i+1];
55 array[ size / sizeof(array[0]) - 1].ptr = &array[0];
58 volatile struct s *p = &array[0];
66 printf("%d %llu\n", size, (tac - tic) / REPEATS);