Is there an equivalent C function in linux for reading the CPU counter and its frequency?
I am looking for something similair to QueryPerformanceCounter function that reads the 64bit counter in modern CPU's
clock_gettime(2)
,参数为CLOCK_REALTIME_HR
。
clock_gettime() 与 CLOCK_MONOTONIC_RAW
The HAVEGE library uses the CPU counter. Check out its source code here . The relevant file is src/hardtick.h.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.