Time calculation with TSC (Time Stamp Counter)

前端 未结 4 1792
误落风尘
误落风尘 2021-01-05 19:41

I am trying to measure the time taken by some code inside Linux kernel at very high accuracy by a Linux kernel module.

For this purpose, I have tried rdtscl

4条回答
  •  星月不相逢
    2021-01-05 20:05

    All the cores have their own TSC; it basically counts cycles- but beware - the TSC clocks may not be synchronized! if your code starts running on one core and migrates to the 2nd one, which is certainly possible in the general case, your count will be wrong!

提交回复
热议问题