masters-thesis/listings/rdtsc.h

17 lines
220 B
C
Raw Normal View History

static inline uint64_t rdtsc()
{
uint64_t tsc;
__asm__ __volatile__(
"lfence;"
"rdtsc;"
"shl $32, %%rdx;"
"or %%rdx,%%rax"
: "=a" (tsc)
:
: "%rcx", "%rdx", "memory"
);
return tsc;
}