Interrupt latency in RTEMS (Zedboard)

BRIARD Sebastien sebastien.briard at thalesaleniaspace.com
Tue Mar 27 12:33:22 UTC 2018


I am using the expiration of a timer. And basically I am doing two things:
-  I keep measuring time in my main loop
- when I am in the handler I take a new measure of the time.

It was a quick, not so rigorous test, with global variables. 

Here is the code : 
// Global variable for tests //
volatile bool signal_sent;
rtems_interval lat=0 ;
rtems_id main_task;

//handler //
rtems_timer_service_routine test_signal_from_isr(rtems_id  timer, void     *arg)
{
  rtems_interval *rag = (rtems_interval*)arg ;
  lat = rtems_clock_get_uptime_nanoseconds() - *rag ;
  signal_sent = TRUE;
}

// main task //
rtems_task Init(  rtems_task_argument argument)
{
  rtems_status_code     status;
  rtems_id              timer;
  rtems_interval now;

  // index to repeat test //
  int i = 0 ;
  main_task = rtems_task_self();
  printf("ticks per seconds : %02ld \n",rtems_clock_get_ticks_per_second()) ;
  
  /*
   *  Timer used in multiple ways
   */
  status = rtems_timer_create( 1, &timer );
  assert( status == RTEMS_SUCCESSFUL );
  
  while(i<10)
  {
  /*
   * Test Signal from ISR
   */
  signal_sent = FALSE;

  status = rtems_timer_fire_after( timer, 20, test_signal_from_isr, (void*) &now );
  assert( status == RTEMS_SUCCESSFUL );

  while (1) {
    now = rtems_clock_get_uptime_nanoseconds() ;
    if ( signal_sent )
      break;
  }
  printf(" interrupt latency : %ld ns \n",lat) ;
  puts( "Signal sent from ISR has been processed" ); 
  i++;
  }
  puts( "*** END OF SIGNAL FROM TSR TEST ***" );
  exit( 0 ); // generera un RTEMS fatal
}

/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER

#define CONFIGURE_MICROSECONDS_PER_TICK	  1

#define CONFIGURE_RTEMS_INIT_TASKS_TABLE

#define CONFIGURE_MAXIMUM_TASKS             1
#define CONFIGURE_MAXIMUM_TIMERS            1

#define CONFIGURE_INIT
#include <rtems/confdefs.h>

-----Message d'origine-----
De : Sebastian Huber [mailto:sebastian.huber at embedded-brains.de] 
Envoyé : mardi 27 mars 2018 14:20
À : BRIARD Sebastien; users at rtems.org
Objet : Re: Interrupt latency in RTEMS (Zedboard)

Hello Sebastien,

could you give a code example how you measure the interrupt latency? 
Which interrupt do you use?

The time keeping is independent of the clock tick configuration.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the users mailing list