c++ - cpp linux: about rdtsc -
c++ - cpp linux: about rdtsc -
i'm using next function in code:
static __inline__ unsigned long long rdtsc(void){ unsigned long long int x; __asm__ volatile (".byte 0x0f, 0x31" : "=a" (x)); homecoming x; } does function homecoming number of ticks since lastly boot? can find documentation function?
rdtsc gets number of cpu cycles since lastly reset, see wikipedia.
the intel instruction set manual vol 2a & b, more trusted source:
the processor monotonically increments time-stamp counter msr every clock cycle , resets 0 whenever processor reset. see “time stamp counter” in chapter 16 of intel® 64 , ia-32 architectures software developer’s manual, volume 3b, specific details of time stamp counter behavior.
as side note: shouldn't emitting bytes, rather utilize actual rtdsc instruction mnemonic, makes far more readable.
c++ linux rdtsc
Comments
Post a Comment