Latency measurement using C

Latency measurement using C

by Amaury Pierre Jiezhi Wei -
Number of replies: 2

Hello,

I am currently working on measuring the latency using C-code. I followed the guide on Moodle to modify "alt_irq_handler.c". I am able to see the pins being set and cleared using the Logic Analyzer. 

However, I feel like I obtain really high latencies (45 cycles with both caches, 220 cycles with no cache) compared to the results I am supposed to get (70 cycles was the obtained value in the guide).

I have tried to measure the latency using the Signal Tap Logic Analyzer and looking at the instruction address of the cpu and I obtain 13 cycles with no cache, which doesn't match at all the 220 cycles using C-code.

What am I doing wrong?

Best regards,

Amaury

isralt_irq_handler.c

 

In reply to Amaury Pierre Jiezhi Wei

Re: Latency measurement using C

by René Beuchat -

The value with the Signal Tap is the real one to enter in the ISR at the provided address. 

The value measured in the IRQ handler with PIO is one with many instructions done before until you access your own code.

You can have some view at disassembly of your code to see what are all the instructions executed. Try to put a breakpoint at the IRA handler at assembly level and look the disassembly code to go until your own code.