a good way to measure latency of interuptions
mantegazza at aero.polimi.it
Thu Aug 24 13:42:41 CEST 2006
Julien Michel wrote:
> Hi all,
> I am running a v24.1.11 RTAI version on an embedded system.
> I would like to measure the latency time to start an interruption routine.
> By latency time, I mean the delay between the time a hardware interruption
> appears and the time its corresponding routine starts.
> I heard the average maximum latency time is about 10-20 us, depending on the
> system load, the runtime frequency etc...
> Is there any way to accurately do such a measurement ?
> Btw, I try to measure the delay to execute a routine.
> I use the do_gettimeofday function, one at the beginning, one at the end, of the
> routine and get the difference.
> I wonder if it is a good way. Indeed, an interruption of a higher priority may
> occur between the do_gettimeofday functions, so the measures would be wrong ...
The delay to execute a routine is not the latency delay. In any case do
not use gettimeofday in real time but read the TSC and convert the
measure. Rt_get_cpu_time_ns should be the fuction to be used.
The measure of the interrupt latency for a generic interrupt you need to
have access to the interrupt wire. The only way to measure it in
software entirely is on the timer interrupt. In RTAI showroom CVS there
is a wealth of examples that do that, available also in the RTAI
calibration tool of the latest RTAIs.
More information about the Rtai