masters-thesis/listings/rdtsc.h
Dennis af25b4b828 Initial commit of master's thesis
This is the version I submitted to RWTH Aachen University at November 9,
2018.
2018-11-12 12:56:59 +01:00

17 lines
220 B
C

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;
}