source: rtems/cpukit/rtems/src/ratemongetstatus.c @ e6b31b27

4.11
Last change on this file since e6b31b27 was e6b31b27, checked in by Joel Sherrill <joel.sherrill@…>, on May 27, 2015 at 3:13:58 PM

Remove use ticks for statistics configure option.

This was obsolete and broken based upon recent time keeping changes.

Thie build option was previously enabled by adding
USE_TICKS_FOR_STATISTICS=1 to the configure command line.

This propagated into the code as preprocessor conditionals
using the RTEMS_USE_TICKS_FOR_STATISTICS conditional.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Rate Monotonic Get Status
5 *  @ingroup ClassicRateMon
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2009.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/system.h>
22#include <rtems/rtems/status.h>
23#include <rtems/rtems/support.h>
24#include <rtems/score/isr.h>
25#include <rtems/rtems/ratemonimpl.h>
26#include <rtems/score/thread.h>
27#include <rtems/score/timespec.h>
28
29rtems_status_code rtems_rate_monotonic_get_status(
30  rtems_id                            id,
31  rtems_rate_monotonic_period_status *status
32)
33{
34  Thread_CPU_usage_t             executed;
35  Objects_Locations              location;
36  Rate_monotonic_Period_time_t   since_last_period;
37  Rate_monotonic_Control        *the_period;
38  bool                           valid_status;
39
40  if ( !status )
41    return RTEMS_INVALID_ADDRESS;
42
43  the_period = _Rate_monotonic_Get( id, &location );
44  switch ( location ) {
45
46    case OBJECTS_LOCAL:
47      status->owner = the_period->owner->Object.id;
48      status->state = the_period->state;
49
50      /*
51       *  If the period is inactive, there is no information.
52       */
53      if ( status->state == RATE_MONOTONIC_INACTIVE ) {
54        _Timespec_Set_to_zero( &status->since_last_period );
55        _Timespec_Set_to_zero( &status->executed_since_last_period );
56      } else {
57
58        /*
59         *  Grab the current status.
60         */
61        valid_status =
62          _Rate_monotonic_Get_status(
63            the_period, &since_last_period, &executed
64          );
65        if (!valid_status) {
66          _Objects_Put( &the_period->Object );
67          return RTEMS_NOT_DEFINED;
68        }
69
70        _Timestamp_To_timespec(
71          &since_last_period, &status->since_last_period
72        );
73        _Timestamp_To_timespec(
74          &executed, &status->executed_since_last_period
75        );
76      }
77
78      _Objects_Put( &the_period->Object );
79      return RTEMS_SUCCESSFUL;
80
81#if defined(RTEMS_MULTIPROCESSING)
82    case OBJECTS_REMOTE:            /* should never return this */
83#endif
84    case OBJECTS_ERROR:
85      break;
86  }
87
88  return RTEMS_INVALID_ID;
89}
Note: See TracBrowser for help on using the repository browser.