Created
December 4, 2018 22:29
-
-
Save rigtorp/82dfc060b86a3aef093759669bad02c0 to your computer and use it in GitHub Desktop.
Read rdtsc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static inline uint64_t rdtsc() { | |
uint64_t hi, lo; | |
asm volatile ("mfence; rdtsc\n" : "=a" (lo), "=d" (hi)); | |
return (hi << 32) | lo; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment