7 ms·
> I use __rdtsc() compiler intrinsic What do you do on ARM?
by oguz-ismail 1y ago
> I use __rdtsc() compiler intrinsic
What do you do on ARM?
- Narishma 1y agoUse a Raspberry Pi or something.
- loeg 1y agohttps://github.com/facebook/folly/blob/main/folly/chrono/Hardware.h#L48 https://github.com/facebook/folly/blob/main/folly/chrono/Har...
- oasisaimlessly 1y agoRead `cntvct_el0` with the `mrs` instruction. [1] [1]: https://developer.arm.com/documentation/102379/0104/The-processor-timers/Count-and-frequency?lang=en https://developer.arm.com/documentation/102379/0104/The-proc...
- JdeBP 1y agoSee manual page and changelog. * https://jdebp.uk/Softwares/djbwares/guide/commands/clockspeed.xml https://jdebp.uk/Softwares/djbwares/guide/commands/clockspee... * https://github.com/jdebp/djbwares/commit/8d2c20930c8700b1786db917a2586bf32acd94f1 https://github.com/jdebp/djbwares/commit/8d2c20930c8700b1786... Yes, 27 years later it now compiles on a non-Intel architecture. (-:
- madog 1y agoJust use gettimeofday/clock_gettime via vDSO. struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); On arm64 it directly uses the cntvct_el0 register under the hood but with a standard/easy to use API instead of messing about with inline assembly. Also avoids a context switch because it's vDSO.