source: rtems/cpukit/include/rtems/rtems/ratemondata.h @ 21275b58

Last change on this file since 21275b58 was 21275b58, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 22, 2018 at 6:14:51 PM

score: Static Objects_Information initialization

Statically allocate the objects information together with the initial
set of objects either via <rtems/confdefs.h>. Provide default object
informations with zero objects via librtemscpu.a. This greatly
simplifies the workspace size estimate. RTEMS applications which do not
use the unlimited objects option are easier to debug since all objects
reside now in statically allocated objects of the right types.

Close #3621.

  • Property mode set to 100644
File size: 4.6 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ClassicRateMonImpl
5 *
6 * @brief Classic Rate Monotonic Scheduler Data Structures
7 */
8
9/* COPYRIGHT (c) 1989-2009, 2016.
10 * On-Line Applications Research Corporation (OAR).
11 * COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.
12 *
13 * The license and distribution terms for this file may be
14 * found in the file LICENSE in this distribution or at
15 * http://www.rtems.org/license/LICENSE.
16 */
17
18#ifndef _RTEMS_RTEMS_RATEMONDATA_H
19#define _RTEMS_RTEMS_RATEMONDATA_H
20
21#include <rtems/rtems/ratemon.h>
22#include <rtems/score/timestamp.h>
23#include <rtems/score/thread.h>
24#include <rtems/score/watchdog.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30/**
31 * @addtogroup ClassicRateMonImpl
32 *
33 * @{
34 */
35
36/**
37 *  The following defines the INTERNAL data structure that has the
38 *  statistics kept on each period instance.
39 */
40typedef struct {
41  /** This field contains the number of periods executed. */
42  uint32_t     count;
43  /** This field contains the number of periods missed. */
44  uint32_t     missed_count;
45
46  /** This field contains the least amount of CPU time used in a period. */
47  Timestamp_Control min_cpu_time;
48  /** This field contains the highest amount of CPU time used in a period. */
49  Timestamp_Control max_cpu_time;
50  /** This field contains the total amount of wall time used in a period. */
51  Timestamp_Control total_cpu_time;
52
53  /** This field contains the least amount of wall time used in a period. */
54  Timestamp_Control min_wall_time;
55  /** This field contains the highest amount of wall time used in a period. */
56  Timestamp_Control max_wall_time;
57  /** This field contains the total amount of CPU time used in a period. */
58  Timestamp_Control total_wall_time;
59}  Rate_monotonic_Statistics;
60
61/**
62 * @brief The following structure defines the control block used to manage each
63 * period.
64 *
65 * State changes are protected by the default thread lock of the owner thread.
66 * The owner thread is the thread that created the period object.  The owner
67 * thread field is immutable after object creation.
68 */
69typedef struct {
70  /** This field is the object management portion of a Period instance. */
71  Objects_Control                         Object;
72
73  /**
74   * @brief Protects the rate monotonic period state.
75   */
76  ISR_LOCK_MEMBER(                        Lock )
77
78  /** This is the timer used to provide the unblocking mechanism. */
79  Watchdog_Control                        Timer;
80
81  /** This field indicates the current state of the period. */
82  rtems_rate_monotonic_period_states      state;
83
84  /**
85   * @brief A priority node for use by the scheduler job release and cancel
86   * operations.
87   */
88  Priority_Node                           Priority;
89
90  /**
91   * This field contains the length of the next period to be
92   * executed.
93   */
94  uint32_t                                next_length;
95
96  /**
97   * This field contains a pointer to the TCB for the thread
98   * which owns and uses this period instance.
99   */
100  Thread_Control                         *owner;
101
102  /**
103   * This field contains the cpu usage value of the owning thread when
104   * the period was initiated.  It is used to compute the period's
105   * statistics.
106   */
107  Timestamp_Control                       cpu_usage_period_initiated;
108
109  /**
110   * This field contains the wall time value when the period
111   * was initiated.  It is used to compute the period's statistics.
112   */
113  Timestamp_Control                       time_period_initiated;
114
115  /**
116   * This field contains the statistics maintained for the period.
117   */
118  Rate_monotonic_Statistics               Statistics;
119
120  /**
121   * This field contains the number of postponed jobs.
122   * When the watchdog timeout, this variable will be increased immediately.
123   */
124  uint32_t                                postponed_jobs;
125
126  /**
127   *  This field contains the tick of the latest deadline decided by the period
128   *  watchdog.
129  */
130  uint64_t                                latest_deadline;
131}   Rate_monotonic_Control;
132
133/**
134 * @brief The Classic Rate Monotonic objects information.
135 */
136extern Objects_Information _Rate_monotonic_Information;
137
138/**
139 * @brief Macro to define the objects information for the Classic Rate
140 * Monotonic objects.
141 *
142 * This macro should only be used by <rtems/confdefs.h>.
143 *
144 * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag
145 * may be set).
146 */
147#define RATE_MONOTONIC_INFORMATION_DEFINE( max ) \
148  OBJECTS_INFORMATION_DEFINE( \
149    _Rate_monotonic, \
150    OBJECTS_CLASSIC_API, \
151    OBJECTS_RTEMS_PERIODS, \
152    Rate_monotonic_Control, \
153    max, \
154    OBJECTS_NO_STRING_NAME, \
155    NULL \
156  )
157
158/** @} */
159
160#ifdef __cplusplus
161}
162#endif
163
164#endif
165/* end of include file */
Note: See TracBrowser for help on using the repository browser.