What's the best timing resolution can i get on Linux

前端 未结 3 1554
有刺的猬
有刺的猬 2020-12-20 10:16

I\'m trying to measure the time difference between 2 signals on the parallel port, but first i got to know how much accurate and precise is my measuring system (AMD Athlon(t

3条回答
  •  轮回少年
    2020-12-20 10:26

    RDTSCP on your AMD Athlon 64 X2 will give you the time stamp counter with resolution dependent upon your clock. However accuracy is different to resolution, you need to lock thread affinity and disable interrupts (see IRQ routing).

    This entails dropping down to assembler or for Windows developers using MSVC 2008 instrinsics.

    RedHat with RHEL5 introduced user-space shims that replace gettimeofday with high resolution RDTSCP calls:

    • http://developer.amd.com/Resources/documentation/articles/Pages/1214200692_5.aspx

    • https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_MRG/1.3/html/Realtime_Tuning_Guide/sect-Realtime_Tuning_Guide-General_System_Tuning-gettimeofday_speedup.html

    Also, check your hardware an AMD 5200 has a 2.6Ghz clock which has 0.4ns interval and the cost of gettimeofday with RDTSCP is 221 cycles that equals 88ns at best.

提交回复
热议问题