Nuetrino
Nuetrino

Reputation: 1119

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.

Upvotes: 6

Views: 8102

Answers (3)

davidg
davidg

Reputation: 6017

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.

Upvotes: 6

Houcheng
Houcheng

Reputation: 2894

Another way is to connect your target board's one GPIO output to another GPIO input, pull the signal on GPIO output and handle this event in GPIO's ISR routine. Check the time difference of pulling signal and trigger of GPIO input ISR. here is the open source to do this, for Raspberry board:

Linux GPIO IRQ latency test

Upvotes: 0

Prashant Bhumkar
Prashant Bhumkar

Reputation: 11

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

Upvotes: 1

Related Questions