summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cpukit/configure.ac5
-rw-r--r--cpukit/libcsupport/src/__times.c68
-rw-r--r--cpukit/libmisc/cpuuse/cpuusagedata.c6
-rw-r--r--cpukit/libmisc/cpuuse/cpuusagereport.c90
-rw-r--r--cpukit/libmisc/cpuuse/cpuusagereset.c26
-rw-r--r--cpukit/libmisc/cpuuse/cpuusagetop.c35
-rw-r--r--cpukit/libmisc/cpuuse/cpuuse.h10
-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
-rw-r--r--cpukit/score/include/rtems/score/thread.h8
-rw-r--r--cpukit/score/src/schedulerdefaulttick.c7
-rw-r--r--cpukit/score/src/threaddispatch.c15
-rw-r--r--cpukit/score/src/threadinitialize.c6
-rw-r--r--testsuites/sptests/sp69/init.c64
19 files changed, 169 insertions, 436 deletions
diff --git a/cpukit/configure.ac b/cpukit/configure.ac
index 46942c9805..c2b8e8d4f2 100644
--- a/cpukit/configure.ac
+++ b/cpukit/configure.ac
@@ -240,11 +240,6 @@ RTEMS_CPUOPT([RTEMS_VERSION],
["]_RTEMS_VERSION["],
[RTEMS version string])
-RTEMS_CPUOPT([__RTEMS_USE_TICKS_FOR_STATISTICS__],
- [test x"${USE_TICKS_FOR_STATISTICS}" = x"1"],
- [1],
- [disable nanosecond granularity for statistics])
-
## Header file differences that need to be known in .h after install
RTEMS_CPUOPT([__RTEMS_HAVE_SYS_CPUSET_H__],
[test x"${ac_cv_header_sys_cpuset_h}" = x"yes"],
diff --git a/cpukit/libcsupport/src/__times.c b/cpukit/libcsupport/src/__times.c
index 895ee6b658..e5ec411543 100644
--- a/cpukit/libcsupport/src/__times.c
+++ b/cpukit/libcsupport/src/__times.c
@@ -31,9 +31,7 @@
#include <errno.h>
#include <rtems/seterr.h>
#include <rtems/score/todimpl.h>
-#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- #include <rtems/score/timestamp.h>
-#endif
+#include <rtems/score/timestamp.h>
#include <rtems/score/threadimpl.h>
/**
@@ -63,41 +61,35 @@ clock_t _times(
* of ticks since boot and the number of ticks executed by this
* this thread.
*/
-
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- {
- Timestamp_Control per_tick;
- uint32_t ticks_of_executing;
- uint32_t fractional_ticks;
- Per_CPU_Control *cpu_self;
-
- _Timestamp_Set(
- &per_tick,
- rtems_configuration_get_microseconds_per_tick() /
- TOD_MICROSECONDS_PER_SECOND,
- (rtems_configuration_get_nanoseconds_per_tick() %
- TOD_NANOSECONDS_PER_SECOND)
- );
-
- cpu_self = _Thread_Dispatch_disable();
- executing = _Thread_Executing;
- _Thread_Update_cpu_time_used(
- executing,
- &_Thread_Time_of_last_context_switch
- );
- _Timestamp_Divide(
- &executing->cpu_time_used,
- &per_tick,
- &ticks_of_executing,
- &fractional_ticks
- );
- _Thread_Dispatch_enable( cpu_self );
- ptms->tms_utime = ticks_of_executing * us_per_tick;
- }
- #else
- executing = _Thread_Get_executing();
- ptms->tms_utime = executing->cpu_time_used * us_per_tick;
- #endif
+ {
+ Timestamp_Control per_tick;
+ uint32_t ticks_of_executing;
+ uint32_t fractional_ticks;
+ Per_CPU_Control *cpu_self;
+
+ _Timestamp_Set(
+ &per_tick,
+ rtems_configuration_get_microseconds_per_tick() /
+ TOD_MICROSECONDS_PER_SECOND,
+ (rtems_configuration_get_nanoseconds_per_tick() %
+ TOD_NANOSECONDS_PER_SECOND)
+ );
+
+ cpu_self = _Thread_Dispatch_disable();
+ executing = _Thread_Executing;
+ _Thread_Update_cpu_time_used(
+ executing,
+ &_Thread_Time_of_last_context_switch
+ );
+ _Timestamp_Divide(
+ &executing->cpu_time_used,
+ &per_tick,
+ &ticks_of_executing,
+ &fractional_ticks
+ );
+ _Thread_Dispatch_enable( cpu_self );
+ ptms->tms_utime = ticks_of_executing * us_per_tick;
+ }
ptms->tms_stime = ticks * us_per_tick;
ptms->tms_cutime = 0;
ptms->tms_cstime = 0;
diff --git a/cpukit/libmisc/cpuuse/cpuusagedata.c b/cpukit/libmisc/cpuuse/cpuusagedata.c
index ea24db5dee..661b97e726 100644
--- a/cpukit/libmisc/cpuuse/cpuusagedata.c
+++ b/cpukit/libmisc/cpuuse/cpuusagedata.c
@@ -22,8 +22,4 @@
#include <rtems/cpuuse.h>
-#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- Timestamp_Control CPU_usage_Uptime_at_last_reset;
-#else
- uint32_t CPU_usage_Ticks_at_last_reset;
-#endif
+Timestamp_Control CPU_usage_Uptime_at_last_reset;
diff --git a/cpukit/libmisc/cpuuse/cpuusagereport.c b/cpukit/libmisc/cpuuse/cpuusagereport.c
index 5cba819355..98b5f8bfae 100644
--- a/cpukit/libmisc/cpuuse/cpuusagereport.c
+++ b/cpukit/libmisc/cpuuse/cpuusagereport.c
@@ -44,12 +44,8 @@ void rtems_cpu_usage_report_with_plugin(
Objects_Information *information;
char name[13];
uint32_t ival, fval;
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- Timestamp_Control uptime, total, ran, uptime_at_last_reset;
- uint32_t seconds, nanoseconds;
- #else
- uint32_t total_units = 0;
- #endif
+ Timestamp_Control uptime, total, ran, uptime_at_last_reset;
+ uint32_t seconds, nanoseconds;
if ( !print )
return;
@@ -59,38 +55,15 @@ void rtems_cpu_usage_report_with_plugin(
* the number of "ticks" we gave credit for to give the user a rough
* guideline as to what each number means proportionally.
*/
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- _Timestamp_Set_to_zero( &total );
- uptime_at_last_reset = CPU_usage_Uptime_at_last_reset;
- #else
- for ( api_index = 1 ; api_index <= OBJECTS_APIS_LAST ; api_index++ ) {
- #if !defined(RTEMS_POSIX_API) || defined(RTEMS_DEBUG)
- if ( !_Objects_Information_table[ api_index ] )
- continue;
- #endif
-
- information = _Objects_Information_table[ api_index ][ 1 ];
- if ( information ) {
- for ( i=1 ; i <= information->maximum ; i++ ) {
- the_thread = (Thread_Control *)information->local_table[ i ];
-
- if ( the_thread )
- total_units += the_thread->cpu_time_used;
- }
- }
- }
- #endif
+ _Timestamp_Set_to_zero( &total );
+ uptime_at_last_reset = CPU_usage_Uptime_at_last_reset;
(*print)(
context,
"-------------------------------------------------------------------------------\n"
" CPU USAGE BY THREAD\n"
"------------+----------------------------------------+---------------+---------\n"
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- " ID | NAME | SECONDS | PERCENT\n"
- #else
- " ID | NAME | TICKS | PERCENT\n"
- #endif
+ " ID | NAME | SECONDS | PERCENT\n"
"------------+----------------------------------------+---------------+---------\n"
);
@@ -117,7 +90,6 @@ void rtems_cpu_usage_report_with_plugin(
name
);
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
{
Timestamp_Control last;
@@ -150,52 +122,20 @@ void rtems_cpu_usage_report_with_plugin(
ival, fval
);
}
- #else
- if (total_units) {
- uint64_t ival_64;
-
- ival_64 = the_thread->cpu_time_used;
- ival_64 *= 100000;
- ival = ival_64 / total_units;
- } else {
- ival = 0;
- }
-
- fval = ival % 1000;
- ival /= 1000;
- (*print)( context,
- "%14" PRIu32 " |%4" PRIu32 ".%03" PRIu32 "\n",
- the_thread->cpu_time_used,
- ival,
- fval
- );
- #endif
}
}
}
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- seconds = _Timestamp_Get_seconds( &total );
- nanoseconds = _Timestamp_Get_nanoseconds( &total ) /
- TOD_NANOSECONDS_PER_MICROSECOND;
- (*print)(
- context,
- "------------+----------------------------------------+---------------+---------\n"
- " TIME SINCE LAST CPU USAGE RESET IN SECONDS: %7" PRIu32 ".%06" PRIu32 "\n"
- "-------------------------------------------------------------------------------\n",
- seconds, nanoseconds
- );
- #else
- (*print)(
- context,
- "------------+----------------------------------------+---------------+---------\n"
- " TICKS SINCE LAST SYSTEM RESET: %14" PRIu32 "\n"
- " TOTAL UNITS: %14" PRIu32 "\n"
- "-------------------------------------------------------------------------------\n",
- _Watchdog_Ticks_since_boot - CPU_usage_Ticks_at_last_reset,
- total_units
- );
- #endif
+ seconds = _Timestamp_Get_seconds( &total );
+ nanoseconds = _Timestamp_Get_nanoseconds( &total ) /
+ TOD_NANOSECONDS_PER_MICROSECOND;
+ (*print)(
+ context,
+ "------------+----------------------------------------+---------------+---------\n"
+ " TIME SINCE LAST CPU USAGE RESET IN SECONDS: %7" PRIu32 ".%06" PRIu32 "\n"
+ "-------------------------------------------------------------------------------\n",
+ seconds, nanoseconds
+ );
}
void rtems_cpu_usage_report( void )
diff --git a/cpukit/libmisc/cpuuse/cpuusagereset.c b/cpukit/libmisc/cpuuse/cpuusagereset.c
index a167e859f6..e6c429e5b5 100644
--- a/cpukit/libmisc/cpuuse/cpuusagereset.c
+++ b/cpukit/libmisc/cpuuse/cpuusagereset.c
@@ -27,11 +27,7 @@ static void CPU_usage_Per_thread_handler(
Thread_Control *the_thread
)
{
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- _Timestamp_Set_to_zero( &the_thread->cpu_time_used );
- #else
- the_thread->cpu_time_used = 0;
- #endif
+ _Timestamp_Set_to_zero( &the_thread->cpu_time_used );
}
/*
@@ -39,21 +35,17 @@ static void CPU_usage_Per_thread_handler(
*/
void rtems_cpu_usage_reset( void )
{
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- uint32_t cpu_count;
- uint32_t cpu_index;
+ uint32_t cpu_count;
+ uint32_t cpu_index;
- _TOD_Get_uptime( &CPU_usage_Uptime_at_last_reset );
+ _TOD_Get_uptime( &CPU_usage_Uptime_at_last_reset );
- cpu_count = rtems_get_processor_count();
- for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
- Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );
+ cpu_count = rtems_get_processor_count();
+ for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
+ Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );
- cpu->time_of_last_context_switch = CPU_usage_Uptime_at_last_reset;
- }
- #else
- CPU_usage_Ticks_at_last_reset = _Watchdog_Ticks_since_boot;
- #endif
+ cpu->time_of_last_context_switch = CPU_usage_Uptime_at_last_reset;
+ }
rtems_iterate_over_all_threads(CPU_usage_Per_thread_handler);
}
diff --git a/cpukit/libmisc/cpuuse/cpuusagetop.c b/cpukit/libmisc/cpuuse/cpuusagetop.c
index e4a47fe6d3..eaa192aa74 100644
--- a/cpukit/libmisc/cpuuse/cpuusagetop.c
+++ b/cpukit/libmisc/cpuuse/cpuusagetop.c
@@ -144,31 +144,14 @@ static inline bool less_than_uint32_t( uint32_t * lhs, uint32_t * rhs )
return false;
}
-#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- #define CPU_usage_Equal_to( _lhs, _rhs ) \
- _Timestamp_Equal_to( _lhs, _rhs )
-#else
- #define CPU_usage_Equal_to( _lhs, _rhs ) \
- equal_to_uint32_t( _lhs, _rhs )
-#endif
+#define CPU_usage_Equal_to( _lhs, _rhs ) \
+ _Timestamp_Equal_to( _lhs, _rhs )
-#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- #define CPU_usage_Set_to_zero( _time ) \
- _Timestamp_Set_to_zero( _time )
-#else
- #define CPU_usage_Set_to_zero( _time ) \
- do { \
- *_time = 0; \
- } while (0)
-#endif
+#define CPU_usage_Set_to_zero( _time ) \
+ _Timestamp_Set_to_zero( _time )
-#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- #define CPU_usage_Less_than( _lhs, _rhs ) \
- _Timestamp_Less_than( _lhs, _rhs )
-#else
- #define CPU_usage_Less_than( _lhs, _rhs ) \
- less_than_uint32_t( _lhs, _rhs )
-#endif
+#define CPU_usage_Less_than( _lhs, _rhs ) \
+ _Timestamp_Less_than( _lhs, _rhs )
static void
print_memsize(rtems_cpu_usage_data* data, const uint32_t size, const char* label)
@@ -581,11 +564,6 @@ void rtems_cpu_usage_top_with_plugin(
rtems_printk_plugin_t print
)
{
-#ifdef __RTEMS_USE_TICKS_FOR_STATISTICS__
- if ( !print )
- return;
- (*print)(context, "error: tick kernels not supported\n");
-#else
rtems_status_code sc;
rtems_task_priority priority;
rtems_name name;
@@ -714,7 +692,6 @@ void rtems_cpu_usage_top_with_plugin(
rtems_event_send(id, RTEMS_EVENT_1);
}
}
-#endif
}
void rtems_cpu_usage_top( void )
diff --git a/cpukit/libmisc/cpuuse/cpuuse.h b/cpukit/libmisc/cpuuse/cpuuse.h
index 662d905eb0..1e26019cd6 100644
--- a/cpukit/libmisc/cpuuse/cpuuse.h
+++ b/cpukit/libmisc/cpuuse/cpuuse.h
@@ -25,9 +25,7 @@
#include <rtems.h>
#include <rtems/bspIo.h>
-#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- #include <rtems/score/timestamp.h>
-#endif
+#include <rtems/score/timestamp.h>
/**
* @defgroup libmisc_cpuuse CPU Usage
@@ -39,11 +37,7 @@
extern "C" {
#endif
-#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- extern Timestamp_Control CPU_usage_Uptime_at_last_reset;
-#else
- extern uint32_t CPU_usage_Ticks_at_last_reset;
-#endif
+extern Timestamp_Control CPU_usage_Uptime_at_last_reset;
/*
* rtems_cpu_usage_report_with_handler
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
}
}
}
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index c69646b26b..05c1ff79b9 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -83,13 +83,9 @@ extern "C" {
* The user can define this at configure time and go back to ticks
* resolution.
*/
-#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- #include <rtems/score/timestamp.h>
+#include <rtems/score/timestamp.h>
- typedef Timestamp_Control Thread_CPU_usage_t;
-#else
- typedef uint32_t Thread_CPU_usage_t;
-#endif
+typedef Timestamp_Control Thread_CPU_usage_t;
/**
* The following defines the "return type" of a thread.
diff --git a/cpukit/score/src/schedulerdefaulttick.c b/cpukit/score/src/schedulerdefaulttick.c
index db67ca1508..19acd3b2b8 100644
--- a/cpukit/score/src/schedulerdefaulttick.c
+++ b/cpukit/score/src/schedulerdefaulttick.c
@@ -31,13 +31,6 @@ void _Scheduler_default_Tick(
{
(void) scheduler;
- #ifdef __RTEMS_USE_TICKS_FOR_STATISTICS__
- /*
- * Increment the number of ticks this thread has been executing
- */
- executing->cpu_time_used++;
- #endif
-
/*
* If the thread is not preemptible or is not ready, then
* just return.
diff --git a/cpukit/score/src/threaddispatch.c b/cpukit/score/src/threaddispatch.c
index f20f427bd6..cce3affda4 100644
--- a/cpukit/score/src/threaddispatch.c
+++ b/cpukit/score/src/threaddispatch.c
@@ -99,17 +99,10 @@ void _Thread_Do_dispatch( Per_CPU_Control *cpu_self, ISR_Level level )
_ISR_Enable( level );
#endif
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- _Thread_Update_cpu_time_used(
- executing,
- &cpu_self->time_of_last_context_switch
- );
- #else
- {
- _TOD_Get_uptime( &cpu_self->time_of_last_context_switch );
- heir->cpu_time_used++;
- }
- #endif
+ _Thread_Update_cpu_time_used(
+ executing,
+ &cpu_self->time_of_last_context_switch
+ );
#if !defined(__DYNAMIC_REENT__)
/*
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 3c0a412aee..c6985f013b 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -217,11 +217,7 @@ bool _Thread_Initialize(
/*
* Initialize the CPU usage statistics
*/
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- _Timestamp_Set_to_zero( &the_thread->cpu_time_used );
- #else
- the_thread->cpu_time_used = 0;
- #endif
+ _Timestamp_Set_to_zero( &the_thread->cpu_time_used );
/*
* initialize thread's key vaule node chain
diff --git a/testsuites/sptests/sp69/init.c b/testsuites/sptests/sp69/init.c
index ecc384678b..ac6f58cebe 100644
--- a/testsuites/sptests/sp69/init.c
+++ b/testsuites/sptests/sp69/init.c
@@ -55,15 +55,10 @@ rtems_task Init(
/* Check status values. */
rtems_test_assert( period_status.owner == rtems_task_self() );
rtems_test_assert( period_status.state == RATE_MONOTONIC_INACTIVE );
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
- rtems_test_assert( period_status.since_last_period.tv_sec == 0 );
- rtems_test_assert( period_status.since_last_period.tv_nsec == 0 );
- rtems_test_assert( period_status.executed_since_last_period.tv_sec == 0 );
- rtems_test_assert( period_status.executed_since_last_period.tv_nsec == 0 );
- #else
- rtems_test_assert( period_status.since_last_period == 0 );
- rtems_test_assert( period_status.executed_since_last_period == 0 );
- #endif
+ rtems_test_assert( period_status.since_last_period.tv_sec == 0 );
+ rtems_test_assert( period_status.since_last_period.tv_nsec == 0 );
+ rtems_test_assert( period_status.executed_since_last_period.tv_sec == 0 );
+ rtems_test_assert( period_status.executed_since_last_period.tv_nsec == 0 );
/*
* Check get_status error cases.
@@ -113,40 +108,25 @@ rtems_task Init(
directive_failed( status, "rate_monotonic_get_status" );
/* Check status values. */
- #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
/* Note: POSIX mandates struct timespec->tv_nsec to be a "long" */
- printf(
- "wall time should be ~600000000 is %ld\n",
- period_status.since_last_period.tv_nsec
- );
- printf(
- "cpu time should be ~100000000 is %ld\n",
- period_status.executed_since_last_period.tv_nsec
- );
- rtems_test_assert( period_status.since_last_period.tv_sec == 0 );
- rtems_test_assert( period_status.since_last_period.tv_nsec >= 600000000 );
- rtems_test_assert( period_status.since_last_period.tv_nsec <= 610000000 );
- rtems_test_assert( period_status.executed_since_last_period.tv_sec == 0 );
- rtems_test_assert(
- period_status.executed_since_last_period.tv_nsec >= 100000000
- );
- rtems_test_assert(
- period_status.executed_since_last_period.tv_nsec <= 110000000
- );
- #else
- printf(
- "wall time should be ~60 is %" PRId32 "\n",
- (int) period_status.since_last_period
- );
- printf(
- "cpu time should be ~10 is %" PRId32 "\n",
- (int) period_status.executed_since_last_period
- );
- rtems_test_assert( period_status.since_last_period >= 60 );
- rtems_test_assert( period_status.since_last_period <= 61 );
- rtems_test_assert( period_status.executed_since_last_period >= 10 );
- rtems_test_assert( period_status.executed_since_last_period <= 12 );
- #endif
+ printf(
+ "wall time should be ~600000000 is %ld\n",
+ period_status.since_last_period.tv_nsec
+ );
+ printf(
+ "cpu time should be ~100000000 is %ld\n",
+ period_status.executed_since_last_period.tv_nsec
+ );
+ rtems_test_assert( period_status.since_last_period.tv_sec == 0 );
+ rtems_test_assert( period_status.since_last_period.tv_nsec >= 600000000 );
+ rtems_test_assert( period_status.since_last_period.tv_nsec <= 610000000 );
+ rtems_test_assert( period_status.executed_since_last_period.tv_sec == 0 );
+ rtems_test_assert(
+ period_status.executed_since_last_period.tv_nsec >= 100000000
+ );
+ rtems_test_assert(
+ period_status.executed_since_last_period.tv_nsec <= 110000000
+ );
/* ensure the missed periods are properly accounted for */
puts( "rtems_rate_monotonic_cancel - OK" );