Timing of events in an ISR

Joel Sherrill <joel@OARcorp.com> joel.sherrill at OARcorp.com
Mon Oct 18 16:03:56 UTC 2004

Mark VanderVoord wrote:
> I am sending an event from an ISR.  The task waiting
> on the event is the highest priority task in the
> system (priority 5... where two others are priority
> 100+).  
> It appears to take 150 usec on my AU1100 between the
> actual interrupt firing, and the task being allowed to
> run.  This processor runs at 400MHz, so this delay
> sounds excessive to me.  If I poll the flag instead of
> using the interrupt, I can act on it within 4 usec
> (but I am obviously using up a lot more CPU time).  

150 useconds seems very, very excessive.  If you are
in the IDLE task, it should be just a matter of
a context switch away.

> What factors contribute to this delay?  Is there
> anything that I can do about it?

Other tasks running, interrupts being disabled at
the task level, etc.  What is going on at the
task level?

> As a side note, I noticed that there are a lot of
> timing tests which come with RTEMS.  Would any of
> these be useful in nailing down just how much time
> these calls should take?

Yes.  Some of them are specifically measuring event
operations and interrupt entry/exit processing.  You
will have to have some BSP specific support to
force an interrupt to time.

You also have to have a timer driver.  Be sure to
note what unit of measure the timer driver you have is
reporting -- some are cycles, some are useconds, some
are nanoseconds.

I would expect event send to be VERY cheap even with
a preemption.  You should be looking at:

   + ISR entry (non-nested)
     + event_receive (non-preemptive, task readied)
   + ISR exit (preemptive)

A MIPS has a lot of context to switch but it should be
on the order of low single digit microseconds to do
any RTEMS service.  Honestly, I would expect you to
have to measure it in CPU cycles.

> Thanks!
> Mark S VanderVoord
> Self-Guided Systems, LLC
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 

Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985

More information about the users mailing list