Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any kernel tools available to measure interrupt latency with reasonable accuracy?

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.

like image 931
Nuetrino Avatar asked Mar 13 '13 10:03

Nuetrino


People also ask

How do you measure interrupt latency?

One approach is to use one pin on a GPIO interface to generate the interrupt. This pin can be monitored on the 'scope. At the start of the interrupt service routine, another pin, which is also being monitored, is toggled. The interval between the two signals may be easily read from the instrument.

What is interrupt latency & how we can reduce it?

Interrupt latency depends on a combination of hardware and software. System architects must balance the system design to handle multiple simultaneous interrupt sources and minimize interrupt latency. If the interrupts are not handled in a timely manner, then the system will exhibit slow response times.

Does the kernel handle interrupts?

In the first phase the kernel will run the generic interrupt handler that determines the interrupt number, the interrupt handler for this particular interrupt and the interrupt controller.

What is interrupt latency in OS?

The term interrupt latency refers to the delay between the start of an Interrupt Request (IRQ) and the start of the respective Interrupt Service Routine (ISR). The interrupt latency is expressed in core clock cycles.


2 Answers

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.)

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.

like image 97
davidg Avatar answered Oct 16 '22 15:10

davidg


Use "cyclictest" utility to measure latency, I have done research and I am using cyclictest to measure jitter of ported RT linux on powerpc platform.
It is simple yet powerful utility to measure latency

like image 1
Prashant Bhumkar Avatar answered Oct 16 '22 17:10

Prashant Bhumkar