C linux equivalent of windows QueryPerformanceCounter

后端 未结 3 862
长发绾君心
长发绾君心 2021-02-19 00:32

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 re

相关标签:
3条回答
  • 2021-02-19 00:38

    clock_gettime(2), with an argument of CLOCK_REALTIME_HR.

    0 讨论(0)
  • 2021-02-19 00:38

    clock_gettime() with CLOCK_MONOTONIC_RAW

    0 讨论(0)
  • 2021-02-19 00:52

    The HAVEGE library uses the CPU counter. Check out its source code here. The relevant file is src/hardtick.h.

    0 讨论(0)
提交回复
热议问题