有没有可用的内核工具来以合理的精度测量中断等待时间? [英] Are there any kernel tools available to measure interrupt latency with reasonable accuracy?

查看:102
本文介绍了有没有可用的内核工具来以合理的精度测量中断等待时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试测量各种Linux内核(启用了RT补丁等)的中断延迟中的抖动.我知道最好的方法是通过使用GPIO引脚生成中断并在中断服务程序中切换另一个GPIO引脚来使用示波器来执行此操作,但我想知道是否有任何Linux内核工具可以执行此操作,并且可能我可以对数字进行比较.

I am trying to measure the jitter in the Interrupt latency for variousLinux kernel ( with RT patch enabled etc). I know the best way is to use a oscilloscope to do this, by generating a interrupt with GPIO pin and toggling another GPIO pin in the interrupt service routine, but i was wondering whether there are any Linux kernel tools to do this, and may be i can do a comparison of the numbers.

推荐答案

典型的方法是设置一个高精度时钟(例如CPU的周期计数器),以触发一个随机但已知的时间中断.未来,并在ISR中测量将时钟设置为关闭的时间与实际达到ISR的时间之间的差.

A typical method would be to set up a high-precision clock (such as the CPU's cycle counter) to trigger an interrupt some random-but-known time in the future, and measure in the ISR the difference between the time the clock was set to go off versus the time the ISR was actually reached.

(此操作的随机"部分是为了确保您避免在安静或繁忙的时间里系统地进行测量-例如,您不希望定时器中断与网卡同时系统地触发中断,不公平地增加您的延迟时间.)

(The "random" part of this is to ensure that you avoid systematically taking measurements during quiet or busy times---for instance, you don't want your timer interrupt to systematically trigger at the same time as a network card interrupt, unfairly pushing your latency numbers up.)

某种程度上可以实现此目的的工具是 Cyclictest ,尽管它似乎是在测量内核线程内的时间,而不是ISR本身,这会在某种程度上增加所测量的延迟时间.

A tool that somewhat implements this is Cyclictest, though it appears to measure time inside a kernel thread instead of the ISR itself, which will push up your measured latency numbers somewhat.

这篇关于有没有可用的内核工具来以合理的精度测量中断等待时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆