Changeset 113ef9fc in rtems for cpukit/rtems/src/ratemon.c


Ignore:
Timestamp:
Apr 9, 1997, 8:02:29 PM (23 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
eafd698
Parents:
0c3cd61
Message:

added support for statistics on rate monotonic periods.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/rtems/src/ratemon.c

    r0c3cd61 r113ef9fc  
    216216/*PAGE
    217217 *
     218 *  rtems_rate_monotonic_get_status
     219 *
     220 *  This directive allows a thread to obtain status information on a
     221 *  period.
     222 *
     223 *  Input parameters:
     224 *    id     - rate monotonic id
     225 *    status - pointer to status control block
     226 *
     227 *  Output parameters:
     228 *    RTEMS_SUCCESSFUL - if successful
     229 *    error code        - if unsuccessful
     230 *
     231 */
     232
     233rtems_status_code rtems_rate_monotonic_get_status(
     234  Objects_Id                           id,
     235  rtems_rate_monotonic_period_status  *status
     236)
     237{
     238  Objects_Locations              location;
     239  Rate_monotonic_Control        *the_period;
     240
     241  the_period = _Rate_monotonic_Get( id, &location );
     242  switch ( location ) {
     243    case OBJECTS_ERROR:
     244      return RTEMS_INVALID_ID;
     245    case OBJECTS_REMOTE:            /* should never return this */
     246      return RTEMS_INTERNAL_ERROR;
     247    case OBJECTS_LOCAL:
     248      status->state = the_period->state;
     249
     250      if ( status->state == RATE_MONOTONIC_INACTIVE ) {
     251        status->ticks_since_last_period = 0;
     252        status->ticks_executed_since_last_period = 0;
     253      } else {
     254        status->ticks_since_last_period =
     255          _Watchdog_Ticks_since_boot - the_period->time_at_period;
     256
     257        status->ticks_executed_since_last_period =
     258          the_period->owner->ticks_executed -
     259            the_period->owner_ticks_executed_at_period;
     260      }
     261
     262      _Thread_Enable_dispatch();
     263      return RTEMS_SUCCESSFUL;
     264  }
     265
     266  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
     267}
     268
     269
     270/*PAGE
     271 *
    218272 *  rtems_rate_monotonic_period
    219273 *
     
    234288)
    235289{
    236   Rate_monotonic_Control        *the_period;
    237   Objects_Locations              location;
    238   rtems_status_code              return_value;
    239   Rate_Monotonic_Period_states   local_state;
    240   ISR_Level                      level;
     290  Rate_monotonic_Control              *the_period;
     291  Objects_Locations                    location;
     292  rtems_status_code                    return_value;
     293  rtems_rate_monotonic_period_states   local_state;
     294  ISR_Level                            level;
    241295
    242296  the_period = _Rate_monotonic_Get( id, &location );
     
    282336            NULL
    283337          );
     338
     339          the_period->owner_ticks_executed_at_period =
     340            _Thread_Executing->ticks_executed;
     341
     342          the_period->time_at_period = _Watchdog_Ticks_since_boot;
     343
    284344          _Watchdog_Insert_ticks( &the_period->Timer, length );
    285345          _Thread_Enable_dispatch();
     
    323383          _ISR_Enable( level );
    324384          the_period->state = RATE_MONOTONIC_ACTIVE;
     385          the_period->owner_ticks_executed_at_period =
     386            _Thread_Executing->ticks_executed;
     387          the_period->time_at_period = _Watchdog_Ticks_since_boot;
     388
    325389          _Watchdog_Insert_ticks( &the_period->Timer, length );
    326390          _Thread_Enable_dispatch();
     
    373437            the_thread->Wait.id == the_period->Object.id ) {
    374438        _Thread_Unblock( the_thread );
     439        the_period->owner_ticks_executed_at_period =
     440          the_thread->ticks_executed;
     441
     442        the_period->time_at_period = _Watchdog_Ticks_since_boot;
     443
    375444        _Watchdog_Reset( &the_period->Timer );
    376445      } else if ( the_period->state == RATE_MONOTONIC_OWNER_IS_BLOCKING ) {
    377446        the_period->state = RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING;
     447        the_period->owner_ticks_executed_at_period =
     448          the_thread->ticks_executed;
     449
     450        the_period->time_at_period = _Watchdog_Ticks_since_boot;
    378451        _Watchdog_Reset( &the_period->Timer );
    379452      } else
Note: See TracChangeset for help on using the changeset viewer.