17 lines
220 B
C
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;
|
|
}
|