4 #define NUM_TIMINGS 10000
5 #define ITERATIONS 1000
7 int compareDouble(const void *x, const void *y)
9 double xx = *(double*)x, yy = *(double*)y;
10 if (xx < yy) return -1;
11 if (xx > yy) return 1;
15 unsigned long long int startTimer(void)
19 __asm__ volatile("CPUID\n\t"
22 "mov %%eax, %1\n\t": "=r" (d),
23 "=r" (a):: "%rax", "%rbx", "%rcx", "%rdx");
25 return ((unsigned long long)a) | (((unsigned long long)d) << 32);;
28 unsigned long long int endTimer(void)
32 __asm__ volatile("RDTSCP\n\t"
35 "CPUID\n\t": "=r" (d), "=r" (a)::
36 "%rax", "%rbx", "%rcx", "%rdx");
38 return ((unsigned long long)a) | (((unsigned long long)d) << 32);;