summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/include/rtems/rtems/ratemon.h
diff options
context:
space:
mode:
authorGlenn Humphrey <glenn.humphrey@oarcorp.com>2009-12-08 23:05:30 +0000
committerGlenn Humphrey <glenn.humphrey@oarcorp.com>2009-12-08 23:05:30 +0000
commiteb37f9dc5d00c381717376d0dfd00ce86107b3a0 (patch)
treeea4a8a8ee303c9787fbd6f2172093ba0ee54f315 /cpukit/rtems/include/rtems/rtems/ratemon.h
parent2009-12-08 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-eb37f9dc5d00c381717376d0dfd00ce86107b3a0.tar.bz2
2009-12-08 Glenn Humphrey <glenn.humphrey@OARcorp.com>
* rtems/include/rtems/rtems/ratemon.h, rtems/src/ratemongetstatus.c, rtems/src/ratemonperiod.c: Factored out common code to ensure consistent behavior between rtems_rate_monotonic_get_status and rtems_rate_monotonic_report_statistics.
Diffstat (limited to '')
-rw-r--r--cpukit/rtems/include/rtems/rtems/ratemon.h67
1 files changed, 46 insertions, 21 deletions
diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h b/cpukit/rtems/include/rtems/rtems/ratemon.h
index 04f45d29a6..74b4022ceb 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemon.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemon.h
@@ -47,6 +47,11 @@
*
* This encapsulates functionality related to the
* Classic API Rate Monotonic Manager.
+ *
+ * Statistics are kept for each period and can be obtained or printed via
+ * API calls. The statistics kept include minimum, maximum and average times
+ * for both cpu usage and wall time. The statistics indicate the execution time
+ * used by the owning thread between successive calls to rtems_rate_monotonic_period.
*/
/**@{*/
@@ -224,18 +229,6 @@ typedef struct {
rtems_rate_monotonic_period_states state;
/**
- * This field contains the total CPU usage used while executing
- * the body of the loop that is executed each period.
- */
- Thread_CPU_usage_t owner_executed_at_period;
-
- /**
- * This field contains the total wall timer that passed while
- * executing the body of the loop that is executed each period.
- */
- Rate_monotonic_Period_time_t time_at_period;
-
- /**
* This field contains the length of the next period to be
* executed.
*/
@@ -248,8 +241,20 @@ typedef struct {
Thread_Control *owner;
/**
- * This field contains the statistics which are maintained
- * on each period.
+ * This field contains the cpu usage value of the owning thread when
+ * the period was initiated. It is used to compute the period's
+ * statistics.
+ */
+ Thread_CPU_usage_t cpu_usage_period_initiated;
+
+ /**
+ * This field contains the wall time value when the period
+ * was initiated. It is used to compute the period's statistics.
+ */
+ Rate_monotonic_Period_time_t time_period_initiated;
+
+ /**
+ * This field contains the statistics maintained for the period.
*/
Rate_monotonic_Statistics Statistics;
} Rate_monotonic_Control;
@@ -285,9 +290,8 @@ rtems_status_code rtems_rate_monotonic_create(
* @brief rtems_rate_monotonic_ident
*
* This routine implements the rtems_rate_monotonic_ident directive.
- * This directive returns the period ID associated with name.
- * If more than one period is named name, then the period
- * to which the ID belongs is arbitrary.
+ * It returns the period ID associated with name. If more than one period
+ * is named name, then the period to which the ID belongs is arbitrary.
*/
rtems_status_code rtems_rate_monotonic_ident(
rtems_name name,
@@ -341,7 +345,7 @@ rtems_status_code rtems_rate_monotonic_get_statistics(
/**
* @brief rtems_rate_monotonic_reset_statistics
*
- * This directive allows a thread to reset the statistics information
+ * This routine allows a thread to reset the statistics information
* on a specific period instance.
*/
rtems_status_code rtems_rate_monotonic_reset_statistics(
@@ -351,7 +355,7 @@ rtems_status_code rtems_rate_monotonic_reset_statistics(
/**
* @brief rtems_rate_monotonic_reset_all_statistics
*
- * This directive allows a thread to reset the statistics information
+ * This routine allows a thread to reset the statistics information
* on ALL period instances.
*/
void rtems_rate_monotonic_reset_all_statistics( void );
@@ -359,7 +363,7 @@ void rtems_rate_monotonic_reset_all_statistics( void );
/**
* @brief rtems_rate_monotonic_report_statistics
*
- * This directive allows a thread to print the statistics information
+ * This routine allows a thread to print the statistics information
* on ALL period instances which have non-zero counts using printk.
*/
void rtems_rate_monotonic_report_statistics_with_plugin(
@@ -370,7 +374,7 @@ void rtems_rate_monotonic_report_statistics_with_plugin(
/**
* @brief rtems_rate_monotonic_report_statistics
*
- * This directive allows a thread to print the statistics information
+ * This routine allows a thread to print the statistics information
* on ALL period instances which have non-zero counts using printk.
*/
void rtems_rate_monotonic_report_statistics( void );
@@ -404,6 +408,27 @@ void _Rate_monotonic_Timeout(
);
/**
+ * @brief _Rate_monotonic_Get_status(
+ *
+ * This routine is invoked to compute the elapsed wall time and cpu
+ * time for a period.
+ *
+ * @param[in] the_period points to the period being operated upon.
+ * @param[out] wall_since_last_period is set to the wall time elapsed
+ * since the period was initiated.
+ * @param[out] cpu_since_last_period is set to the cpu time used by the
+ * owning thread since the period was initiated.
+ *
+ * @return This routine returns true if the status can be determined
+ * and false otherwise.
+ */
+bool _Rate_monotonic_Get_status(
+ Rate_monotonic_Control *the_period,
+ Rate_monotonic_Period_time_t *wall_since_last_period,
+ Thread_CPU_usage_t *cpu_since_last_period
+);
+
+/**
* @brief _Rate_monotonic_Initiate_statistics(
*
* This routine is invoked when a period is initiated via an explicit