1587 / 1587.github.com

0 stars 0 forks source link

arm64 get cycle #253

Open 1587 opened 6 years ago

1587 commented 6 years ago

https://stackoverflow.com/questions/32481867/how-is-this-calculation-working

1587 commented 6 years ago

unsigned long long arm_clock(void) { unsigned long long cntvct; asm volatile ("isb; mrs %0, cntvct_el0; isb; " : "=r"(cntvct) :: "memory"); //cntvct = ((__uint128_t)cntvct * NANO_PER_SEC) / this->freq_hz; return cntvct; }