summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/rtems/src')
-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
4 files changed, 54 insertions, 137 deletions
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
}
}
}