It is the responsibility of each period task loop to update the statistics on each execution of its loop. The following is an example of a simple periodic task that uses the period statistics manager:
rtems_task Periodic_task() { rtems_name name; rtems_id period; rtems_status_code status; name = rtems_build_name( 'P', 'E', 'R', 'D' ); (void) rate_monotonic_create( name, &period ); while ( 1 ) { if ( rate_monotonic_period( period, 100 ) == TIMEOUT ) break; /* Perform some periodic actions */ /* Report statistics */ Period_usage_Update( period_id ); } /* missed period so delete period and SELF */ (void) rate_monotonic_delete( period ); (void) task_delete( SELF ); }
Copyright © 1988-2004 OAR Corporation