summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/ratemongetstatus.c
diff options
context:
space:
mode:
authorGlenn Humphrey <glenn.humphrey@oarcorp.com>2009-12-02 18:15:16 +0000
committerGlenn Humphrey <glenn.humphrey@oarcorp.com>2009-12-02 18:15:16 +0000
commitc6f7e060eaeb951a86dc640855e88c6f8260a347 (patch)
tree7d6ef3b0be5fec6206861601980974b5749baa04 /cpukit/rtems/src/ratemongetstatus.c
parent2009-12-02 Ralf Corsépius <ralf.corsepius@rtems.org> (diff)
downloadrtems-c6f7e060eaeb951a86dc640855e88c6f8260a347.tar.bz2
2009-12-02 Glenn Humphrey <glenn.humphrey@OARcorp.com>
* configure.ac, libcsupport/src/__times.c, libmisc/cpuuse/cpuusagedata.c, libmisc/cpuuse/cpuusagereport.c, libmisc/cpuuse/cpuusagereset.c, rtems/include/rtems/rtems/ratemon.h, rtems/include/rtems/rtems/types.h, rtems/src/ratemongetstatistics.c, rtems/src/ratemongetstatus.c, rtems/src/ratemonperiod.c, rtems/src/ratemonreportstatistics.c, score/include/rtems/score/thread.h, score/src/threaddispatch.c, score/src/threadinitialize.c, score/src/threadtickletimeslice.c: Changed the configuration of statistics granularity to use just one define.
Diffstat (limited to 'cpukit/rtems/src/ratemongetstatus.c')
-rw-r--r--cpukit/rtems/src/ratemongetstatus.c35
1 files changed, 11 insertions, 24 deletions
diff --git a/cpukit/rtems/src/ratemongetstatus.c b/cpukit/rtems/src/ratemongetstatus.c
index 8fc003f7e4..bb22254563 100644
--- a/cpukit/rtems/src/ratemongetstatus.c
+++ b/cpukit/rtems/src/ratemongetstatus.c
@@ -23,8 +23,7 @@
#include <rtems/rtems/ratemon.h>
#include <rtems/score/thread.h>
-#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) || \
- defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
+#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
#include <rtems/score/timespec.h>
#endif
@@ -52,8 +51,7 @@ rtems_status_code rtems_rate_monotonic_get_status(
{
Objects_Locations location;
Rate_monotonic_Control *the_period;
- #if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) || \
- defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
+ #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
Timestamp_Control uptime;
Timestamp_Control temp;
#endif
@@ -68,36 +66,23 @@ rtems_status_code rtems_rate_monotonic_get_status(
status->owner = the_period->owner->Object.id;
status->state = the_period->state;
+ /*
+ * If the period is inactive, there is no information.
+ */
if ( status->state == RATE_MONOTONIC_INACTIVE ) {
- #ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
+ #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
_Timespec_Set_to_zero( &status->since_last_period );
- #else
- status->since_last_period = 0;
- #endif
- #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
_Timespec_Set_to_zero( &status->executed_since_last_period );
#else
+ status->since_last_period = 0;
status->executed_since_last_period = 0;
#endif
+
} else {
- /*
- * Both nanoseconds granularity options have to know the uptime.
- * This lets them share one single invocation of _TOD_Get_uptime().
- */
- #if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) || \
- defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
+ #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
_TOD_Get_uptime( &uptime );
- #endif
-
- #ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
_Timestamp_Subtract( &the_period->time_at_period, &uptime, &temp );
_Timestamp_To_timespec( &temp, &status->since_last_period );
- #else
- status->since_last_period =
- _Watchdog_Ticks_since_boot - the_period->time_at_period;
- #endif
-
- #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
_Timestamp_Subtract(
&_Thread_Time_of_last_context_switch,
&uptime,
@@ -105,6 +90,8 @@ rtems_status_code rtems_rate_monotonic_get_status(
);
_Timestamp_To_timespec( &temp, &status->executed_since_last_period );
#else
+ status->since_last_period =
+ _Watchdog_Ticks_since_boot - the_period->time_at_period;
status->executed_since_last_period =
the_period->owner->cpu_time_used -
the_period->owner_executed_at_period;