summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2015-05-27 10:13:58 -0500
committerJoel Sherrill <joel.sherrill@oarcorp.com>2015-06-15 13:20:17 -0500
commite6b31b27fbe3cd76534db2d4fc4ef5dcdf0d33b4 (patch)
treee833cd29335dedfba764815c61a92c0a4cab1347 /cpukit/rtems
parentscore: Add _Watchdog_Preinitialize() (diff)
downloadrtems-e6b31b27fbe3cd76534db2d4fc4ef5dcdf0d33b4.tar.bz2
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.
Diffstat (limited to 'cpukit/rtems')
-rw-r--r--cpukit/rtems/include/rtems/rtems/ratemon.h16
-rw-r--r--cpukit/rtems/include/rtems/rtems/ratemonimpl.h52
-rw-r--r--cpukit/rtems/include/rtems/rtems/types.h6
-rw-r--r--cpukit/rtems/src/ratemongetstatistics.c21
-rw-r--r--cpukit/rtems/src/ratemongetstatus.c32
-rw-r--r--cpukit/rtems/src/ratemonperiod.c73
-rw-r--r--cpukit/rtems/src/ratemonreportstatistics.c65
7 files changed, 77 insertions, 188 deletions
diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h b/cpukit/rtems/include/rtems/rtems/ratemon.h
index 8701639e12..3f8ed8bfad 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemon.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemon.h
@@ -62,25 +62,17 @@ extern "C" {
* This is the public type used for the rate monotonic timing
* statistics.
*/
-#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- #include <rtems/score/timespec.h>
+#include <rtems/score/timespec.h>
- typedef struct timespec rtems_rate_monotonic_period_time_t;
-#else
- typedef uint32_t rtems_rate_monotonic_period_time_t;
-#endif
+typedef struct timespec rtems_rate_monotonic_period_time_t;
/**
* This is the internal type used for the rate monotonic timing
* statistics.
*/
-#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- #include <rtems/score/timestamp.h>
+#include <rtems/score/timestamp.h>
- typedef Timestamp_Control Rate_monotonic_Period_time_t;
-#else
- typedef uint32_t Rate_monotonic_Period_time_t;
-#endif
+typedef Timestamp_Control Rate_monotonic_Period_time_t;
/**
* The following enumerated type defines the states in which a
diff --git a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
index 1489e57e06..b3aa1cf303 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
@@ -201,46 +201,30 @@ void _Rate_monotonic_Initiate_statistics(
*
* This method resets the statistics information for a period instance.
*/
-#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- #define _Rate_monotonic_Reset_wall_time_statistics( _the_period ) \
- do { \
- /* set the minimums to a large value */ \
- _Timestamp_Set( \
- &(_the_period)->Statistics.min_wall_time, \
- 0x7fffffff, \
- 0x7fffffff \
- ); \
- } while (0)
-#else
- #define _Rate_monotonic_Reset_wall_time_statistics( _the_period ) \
- do { \
- /* set the minimum to a large value */ \
- (_the_period)->Statistics.min_wall_time = 0xffffffff; \
- } while (0)
-#endif
+#define _Rate_monotonic_Reset_wall_time_statistics( _the_period ) \
+ do { \
+ /* set the minimums to a large value */ \
+ _Timestamp_Set( \
+ &(_the_period)->Statistics.min_wall_time, \
+ 0x7fffffff, \
+ 0x7fffffff \
+ ); \
+ } while (0)
/**
* @brief Rate_monotonic_Reset_cpu_use_statistics
*
* This helper method resets the period CPU usage statistics structure.
*/
-#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- #define _Rate_monotonic_Reset_cpu_use_statistics( _the_period ) \
- do { \
- /* set the minimums to a large value */ \
- _Timestamp_Set( \
- &(_the_period)->Statistics.min_cpu_time, \
- 0x7fffffff, \
- 0x7fffffff \
- ); \
- } while (0)
-#else
- #define _Rate_monotonic_Reset_cpu_use_statistics( _the_period ) \
- do { \
- /* set the minimum to a large value */ \
- (_the_period)->Statistics.min_cpu_time = 0xffffffff; \
- } while (0)
-#endif
+#define _Rate_monotonic_Reset_cpu_use_statistics( _the_period ) \
+ do { \
+ /* set the minimums to a large value */ \
+ _Timestamp_Set( \
+ &(_the_period)->Statistics.min_cpu_time, \
+ 0x7fffffff, \
+ 0x7fffffff \
+ ); \
+ } while (0)
/**
* @brief Rate_monotonic_Reset_statistics
diff --git a/cpukit/rtems/include/rtems/rtems/types.h b/cpukit/rtems/include/rtems/rtems/types.h
index fb88116769..978947615e 100644
--- a/cpukit/rtems/include/rtems/rtems/types.h
+++ b/cpukit/rtems/include/rtems/rtems/types.h
@@ -124,11 +124,7 @@ typedef Watchdog_Interval rtems_interval;
* When using nanoseconds granularity timing, RTEMS may internally use a
* variety of representations.
*/
-#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- typedef struct timespec rtems_thread_cpu_usage_t;
-#else
- typedef uint32_t rtems_thread_cpu_usage_t;
-#endif
+typedef struct timespec rtems_thread_cpu_usage_t;
/**
* @brief Data structure to manage and manipulate calendar
diff --git a/cpukit/rtems/src/ratemongetstatistics.c b/cpukit/rtems/src/ratemongetstatistics.c
index d106f045b0..6644562ba0 100644
--- a/cpukit/rtems/src/ratemongetstatistics.c
+++ b/cpukit/rtems/src/ratemongetstatistics.c
@@ -46,21 +46,12 @@ rtems_status_code rtems_rate_monotonic_get_statistics(
src = &the_period->Statistics;
dst->count = src->count;
dst->missed_count = src->missed_count;
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- _Timestamp_To_timespec( &src->min_cpu_time, &dst->min_cpu_time );
- _Timestamp_To_timespec( &src->max_cpu_time, &dst->max_cpu_time );
- _Timestamp_To_timespec( &src->total_cpu_time, &dst->total_cpu_time );
- _Timestamp_To_timespec( &src->min_wall_time, &dst->min_wall_time );
- _Timestamp_To_timespec( &src->max_wall_time, &dst->max_wall_time );
- _Timestamp_To_timespec( &src->total_wall_time, &dst->total_wall_time );
- #else
- dst->min_cpu_time = src->min_cpu_time;
- dst->max_cpu_time = src->max_cpu_time;
- dst->total_cpu_time = src->total_cpu_time;
- dst->min_wall_time = src->min_wall_time;
- dst->max_wall_time = src->max_wall_time;
- dst->total_wall_time = src->total_wall_time;
- #endif
+ _Timestamp_To_timespec( &src->min_cpu_time, &dst->min_cpu_time );
+ _Timestamp_To_timespec( &src->max_cpu_time, &dst->max_cpu_time );
+ _Timestamp_To_timespec( &src->total_cpu_time, &dst->total_cpu_time );
+ _Timestamp_To_timespec( &src->min_wall_time, &dst->min_wall_time );
+ _Timestamp_To_timespec( &src->max_wall_time, &dst->max_wall_time );
+ _Timestamp_To_timespec( &src->total_wall_time, &dst->total_wall_time );
_Objects_Put( &the_period->Object );
return RTEMS_SUCCESSFUL;
diff --git a/cpukit/rtems/src/ratemongetstatus.c b/cpukit/rtems/src/ratemongetstatus.c
index 37d524dc9c..b61e234137 100644
--- a/cpukit/rtems/src/ratemongetstatus.c
+++ b/cpukit/rtems/src/ratemongetstatus.c
@@ -24,10 +24,7 @@
#include <rtems/score/isr.h>
#include <rtems/rtems/ratemonimpl.h>
#include <rtems/score/thread.h>
-
-#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- #include <rtems/score/timespec.h>
-#endif
+#include <rtems/score/timespec.h>
rtems_status_code rtems_rate_monotonic_get_status(
rtems_id id,
@@ -54,14 +51,8 @@ rtems_status_code rtems_rate_monotonic_get_status(
* If the period is inactive, there is no information.
*/
if ( status->state == RATE_MONOTONIC_INACTIVE ) {
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- _Timespec_Set_to_zero( &status->since_last_period );
- _Timespec_Set_to_zero( &status->executed_since_last_period );
- #else
- status->since_last_period = 0;
- status->executed_since_last_period = 0;
- #endif
-
+ _Timespec_Set_to_zero( &status->since_last_period );
+ _Timespec_Set_to_zero( &status->executed_since_last_period );
} else {
/*
@@ -76,17 +67,12 @@ rtems_status_code rtems_rate_monotonic_get_status(
return RTEMS_NOT_DEFINED;
}
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- _Timestamp_To_timespec(
- &since_last_period, &status->since_last_period
- );
- _Timestamp_To_timespec(
- &executed, &status->executed_since_last_period
- );
- #else
- status->since_last_period = since_last_period;
- status->executed_since_last_period = executed;
- #endif
+ _Timestamp_To_timespec(
+ &since_last_period, &status->since_last_period
+ );
+ _Timestamp_To_timespec(
+ &executed, &status->executed_since_last_period
+ );
}
_Objects_Put( &the_period->Object );
diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/ratemonperiod.c
index ca278fb022..6aefaba09b 100644
--- a/cpukit/rtems/src/ratemonperiod.c
+++ b/cpukit/rtems/src/ratemonperiod.c
@@ -30,67 +30,50 @@ bool _Rate_monotonic_Get_status(
Thread_CPU_usage_t *cpu_since_last_period
)
{
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- Timestamp_Control uptime;
- #endif
- Thread_Control *owning_thread = the_period->owner;
- Thread_CPU_usage_t used;
+ Timestamp_Control uptime;
+ Thread_Control *owning_thread = the_period->owner;
+ Thread_CPU_usage_t used;
/*
* Determine elapsed wall time since period initiated.
*/
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- _TOD_Get_uptime( &uptime );
- _Timestamp_Subtract(
- &the_period->time_period_initiated, &uptime, wall_since_last_period
- );
- #else
- *wall_since_last_period =
- _Watchdog_Ticks_since_boot - the_period->time_period_initiated;
- #endif
+ _TOD_Get_uptime( &uptime );
+ _Timestamp_Subtract(
+ &the_period->time_period_initiated, &uptime, wall_since_last_period
+ );
/*
* Determine cpu usage since period initiated.
*/
used = owning_thread->cpu_time_used;
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- if (owning_thread == _Thread_Executing) {
+ if (owning_thread == _Thread_Executing) {
- Thread_CPU_usage_t ran;
+ Thread_CPU_usage_t ran;
- /* How much time time since last context switch */
- _Timestamp_Subtract(
- &_Thread_Time_of_last_context_switch, &uptime, &ran
- );
+ /* How much time time since last context switch */
+ _Timestamp_Subtract(
+ &_Thread_Time_of_last_context_switch, &uptime, &ran
+ );
- /* cpu usage += ran */
- _Timestamp_Add_to( &used, &ran );
+ /* cpu usage += ran */
+ _Timestamp_Add_to( &used, &ran );
- /*
- * The cpu usage info was reset while executing. Can't
- * determine a status.
- */
- if (_Timestamp_Less_than(&used, &the_period->cpu_usage_period_initiated))
- return false;
+ /*
+ * The cpu usage info was reset while executing. Can't
+ * determine a status.
+ */
+ if (_Timestamp_Less_than(&used, &the_period->cpu_usage_period_initiated))
+ return false;
- /* used = current cpu usage - cpu usage at start of period */
- _Timestamp_Subtract(
- &the_period->cpu_usage_period_initiated,
- &used,
- cpu_since_last_period
- );
- }
- #else
- /*
- * The cpu usage info was reset while executing. Can't
- * determine a status.
- */
- if (used < the_period->cpu_usage_period_initiated)
- return false;
+ /* used = current cpu usage - cpu usage at start of period */
+ _Timestamp_Subtract(
+ &the_period->cpu_usage_period_initiated,
+ &used,
+ cpu_since_last_period
+ );
+ }
- *cpu_since_last_period = used - the_period->cpu_usage_period_initiated;
- #endif
return true;
}
diff --git a/cpukit/rtems/src/ratemonreportstatistics.c b/cpukit/rtems/src/ratemonreportstatistics.c
index 0b1a3202dd..856d431bdc 100644
--- a/cpukit/rtems/src/ratemonreportstatistics.c
+++ b/cpukit/rtems/src/ratemonreportstatistics.c
@@ -23,12 +23,10 @@
#include <inttypes.h>
-#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- /* We print to 1/10's of milliseconds */
- #define NANOSECONDS_DIVIDER 1000
- #define PERCENT_FMT "%04" PRId32
- #define NANOSECONDS_FMT "%06" PRId32
-#endif
+/* We print to 1/10's of milliseconds */
+#define NANOSECONDS_DIVIDER 1000
+#define PERCENT_FMT "%04" PRId32
+#define NANOSECONDS_FMT "%06" PRId32
void rtems_rate_monotonic_report_statistics_with_plugin(
void *context,
@@ -45,10 +43,8 @@ void rtems_rate_monotonic_report_statistics_with_plugin(
return;
(*print)( context, "Period information by period\n" );
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- (*print)( context, "--- CPU times are in seconds ---\n" );
- (*print)( context, "--- Wall times are in seconds ---\n" );
- #endif
+ (*print)( context, "--- CPU times are in seconds ---\n" );
+ (*print)( context, "--- Wall times are in seconds ---\n" );
/*
Layout by columns -- in memory of Hollerith :)
@@ -62,25 +58,11 @@ ididididid NNNN ccccc mmmmmm X
1234567890123456789012345678901234567890123456789012345678901234567890123456789\
\n");
*/
- (*print)( context, " ID OWNER COUNT MISSED "
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- " "
- #endif
- "CPU TIME "
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- " "
- #endif
- " WALL TIME\n"
- );
- (*print)( context, " "
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- " "
- #endif
- "MIN/MAX/AVG "
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- " "
- #endif
- " MIN/MAX/AVG\n"
+ (*print)( context,
+ " ID OWNER COUNT MISSED "
+ " CPU TIME WALL TIME\n"
+ " "
+ " MIN/MAX/AVG MIN/MAX/AVG\n"
);
/*
@@ -126,7 +108,6 @@ ididididid NNNN ccccc mmmmmm X
* print CPU Usage part of statistics
*/
{
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
struct timespec cpu_average;
struct timespec *min_cpu = &the_stats.min_cpu_time;
struct timespec *max_cpu = &the_stats.max_cpu_time;
@@ -144,25 +125,12 @@ ididididid NNNN ccccc mmmmmm X
_Timespec_Get_seconds( &cpu_average ),
_Timespec_Get_nanoseconds( &cpu_average ) / NANOSECONDS_DIVIDER
);
- #else
- uint32_t ival_cpu, fval_cpu;
-
- ival_cpu = the_stats.total_cpu_time * 100 / the_stats.count;
- fval_cpu = ival_cpu % 100;
- ival_cpu /= 100;
-
- (*print)( context,
- "%3" PRId32 "/%4" PRId32 "/%3" PRId32 ".%02" PRId32 " ",
- the_stats.min_cpu_time, the_stats.max_cpu_time, ival_cpu, fval_cpu
- );
- #endif
}
/*
* print wall time part of statistics
*/
{
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
struct timespec wall_average;
struct timespec *min_wall = &the_stats.min_wall_time;
struct timespec *max_wall = &the_stats.max_wall_time;
@@ -180,17 +148,6 @@ ididididid NNNN ccccc mmmmmm X
_Timespec_Get_seconds( &wall_average ),
_Timespec_Get_nanoseconds( &wall_average ) / NANOSECONDS_DIVIDER
);
- #else
- uint32_t ival_wall, fval_wall;
-
- ival_wall = the_stats.total_wall_time * 100 / the_stats.count;
- fval_wall = ival_wall % 100;
- ival_wall /= 100;
- (*print)( context,
- "%3" PRId32 "/%4" PRId32 "/%3" PRId32 ".%02" PRId32 "\n",
- the_stats.min_wall_time, the_stats.max_wall_time, ival_wall, fval_wall
- );
- #endif
}
}
}