6

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.

Nuetrino
  • 1,099
  • 1
  • 14
  • 32

3 Answers3

6

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.

skap
  • 320
  • 3
  • 16
davidg
  • 5,868
  • 2
  • 33
  • 51
  • I am thinking of using a signal generator to generate the interrupt on a GPIO so that i can get the jitter in the interrupt response times by generating the interrupt multiple times and measuring the IRQ time multiple times. The PMCR and Cycle count registers for the ARM cortex will do it for me. Now the logging part is what is need to look into. – Nuetrino Mar 15 '13 at 14:39
  • @Nuetrino The issue with doing this as *davidg* proposes is that you are always *synced* to a system clock. An external source is better. Also, the user space code can have an affect on interrupt latency. Some instructions take longer to execute than others. But really if you need this type of latency, something is probably wrong with hardware. DMA, etc would be better. Ref: [U-boot interrupts](http://stackoverflow.com/questions/15829601/enabling-interrupts-in-u-boot-for-arm-cortex-a-9) – artless noise Apr 06 '13 at 22:16
1

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

0

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

zpon
  • 1,482
  • 1
  • 15
  • 21
Houcheng
  • 2,674
  • 25
  • 32