| 136 | #include <stdint.h> |
| 137 | |
| 138 | static inline uint64_t rdtsc() |
| 139 | { |
| 140 | uint32_t hi, lo; |
| 141 | uint64_t hi64, lo64; |
| 142 | asm volatile("rdtscp\n" |
| 143 | "movl %%edx, %0\n" |
| 144 | "movl %%eax, %1\n" |
| 145 | "cpuid" |
| 146 | : "=r"(hi), "=r"(lo) : : "%rax", "%rbx", "%rcx", "%rdx"); |
| 147 | hi64 = hi; |
| 148 | lo64 = lo; |
| 149 | return (hi64 << 32) | lo64; |
| 150 | } |
| 151 | |
| 152 | static uint64_t rdtsc_per_sec = 0; |
| 153 | static void __attribute__((constructor)) init_rdtsc_per_sec() |
no outgoing calls
no test coverage detected