简体   繁体   English

如何获得linux内核服务中断所花费的时间

[英]how do I get the time spent by the linux kernel servicing interrupts

I want to track down jitter in a piece of code and I know there are many potential sources ( task switch, system calls, cache misses, moving task to another CPU, cpu throttling, etc ) and I know how to track all of those but the only one I don't know how to track is time the kernel spent servicing interrupts. 我想跟踪一段代码中的抖动,我知道有很多潜在的来源(任务切换,系统调用,缓存未命中,将任务移动到另一个CPU,cpu限制等),我知道如何跟踪所有这些但是唯一一个我不知道如何跟踪的是内核为中断服务的时间。 The data is in /proc/stat but that measures time in soft-irq and irq at a low resolution and I'm looking for something at a much finer resolution. 数据在/ proc / stat中,但是它以低分辨率测量soft-irq和irq中的时间,我正在寻找更精细分辨率的东西。

Is there a way to get the time, down to the nanosecond or at least microsecond, spent by the kernel servicing interrupts? 有没有办法把内核服务中断的时间减少到纳秒或至少微秒?

Yes put a printk before and after the calling to handle_IRQ the timer on the screen is usually the high resolution one: 是的,在调用handle_IRQ之前和之后放一个printk,屏幕上的计时器通常是高分辨率的:

 86 /*
 87  * asm_do_IRQ is the interface to be used from assembly code.
 88  */
 89 asmlinkage void __exception_irq_entry
 90 asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
 91 {
 92         handle_IRQ(irq, regs);
 93 }
 94 

If you ask about the irq_latency see these nice answers: 如果您询问irq_latency请看这些好的答案:

What is the irq latency due to the operating system? 操作系统导致的irq延迟是多少?

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

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