简体   繁体   English

如何使用Linux获取滴答声中的时钟周期值?

[英]How to get the value of clock cycles in ticks using linux?

Taking the timestamp in linux is same as clock cycles in ticks for linux. 在Linux中获取时间戳与Linux的滴答声中的时钟周期相同。 I know how to get the timestamp but I dont now how to take the clock cycles in ticks. 我知道如何获取时间戳,但是现在我不知道如何获取时钟周期。 could someone tell me what is the difference between the two ?? 有人可以告诉我两者有什么区别吗? could someone give me a small example for clock cycles in ticks ?? 有人可以给我一个关于时钟周期的小例子吗?

Looking forward for your reply. 期待您的答复。

extra : Am trying to add assembly instructions for timing in pisa architecture using simplescalar simulator. extra:我正在尝试使用simplescalar模拟器添加用于比萨架构中计时的汇编指令。 For my instructions i should access clock cycles and store it in the register. 根据我的指示,我应该访问时钟周期并将其存储在寄存器中。

Well, there are: 好吧,有:

  1. Ticks. cks虫。 Modern kernels don't use them . 现代内核不使用它们
  2. Timestamp counter , this is what you may like to use for high-resolution time measurements, but you have to understand how to make unbiased measurements with it. 时间戳计数器 ,这是您可能想用于高分辨率时间测量的方法,但是您必须了解如何使用它进行无偏测量。
  3. Clocks, portable clock_gettime , nanosecond-resolution, often good enough for everything. 时钟,可移植clock_gettime ,纳秒级分辨率,通常足以满足所有需求。

If you want to get access to CPU performance registers, you can start with Intel® Performance Counter Monitor inside your programs . 如果要访问CPU性能寄存器,则可以从程序内部的Intel®Performance Counter Monitor开始。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM