From c6f7e060eaeb951a86dc640855e88c6f8260a347 Mon Sep 17 00:00:00 2001 From: Glenn Humphrey Date: Wed, 2 Dec 2009 18:15:16 +0000 Subject: 2009-12-02 Glenn Humphrey * 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. --- cpukit/ChangeLog | 13 +++++++ cpukit/configure.ac | 5 +++ cpukit/libcsupport/src/__times.c | 4 +- cpukit/libmisc/cpuuse/cpuusagedata.c | 9 +---- cpukit/libmisc/cpuuse/cpuusagereport.c | 16 ++++---- cpukit/libmisc/cpuuse/cpuusagereset.c | 7 ++-- cpukit/rtems/include/rtems/rtems/ratemon.h | 22 ++--------- cpukit/rtems/include/rtems/rtems/types.h | 5 +-- cpukit/rtems/src/ratemongetstatistics.c | 12 ++---- cpukit/rtems/src/ratemongetstatus.c | 35 ++++++----------- cpukit/rtems/src/ratemonperiod.c | 61 ++++++++++++++---------------- cpukit/rtems/src/ratemonreportstatistics.c | 29 +++++--------- cpukit/score/include/rtems/score/thread.h | 16 +------- cpukit/score/src/threaddispatch.c | 4 +- cpukit/score/src/threadinitialize.c | 4 +- cpukit/score/src/threadtickletimeslice.c | 2 +- 16 files changed, 99 insertions(+), 145 deletions(-) diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 554f09d8e7..f3d5f95f12 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,16 @@ +2009-12-02 Glenn Humphrey + + * 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. + 2009-12-02 Ralf Corsépius * shttpd/def.h: Use __m32c__ for m32c. diff --git a/cpukit/configure.ac b/cpukit/configure.ac index eca8f670f7..cac444653f 100644 --- a/cpukit/configure.ac +++ b/cpukit/configure.ac @@ -154,6 +154,11 @@ 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]) + RTEMS_CPUOPT([__RTEMS_USE_TICKS_CPU_USAGE_STATISTICS__], [test x"${USE_TICKS_FOR_CPU_USAGE_STATISTICS}" = x"1"], [1], diff --git a/cpukit/libcsupport/src/__times.c b/cpukit/libcsupport/src/__times.c index 44a1a8a23d..5991d91753 100644 --- a/cpukit/libcsupport/src/__times.c +++ b/cpukit/libcsupport/src/__times.c @@ -22,7 +22,7 @@ #include #include #include -#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS +#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ #include #endif @@ -51,7 +51,7 @@ clock_t _times( * this thread. */ - #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ { Timestamp_Control per_tick; uint32_t ticks; diff --git a/cpukit/libmisc/cpuuse/cpuusagedata.c b/cpukit/libmisc/cpuuse/cpuusagedata.c index 277d7f9c5e..8a09bacc8a 100644 --- a/cpukit/libmisc/cpuuse/cpuusagedata.c +++ b/cpukit/libmisc/cpuuse/cpuusagedata.c @@ -16,18 +16,13 @@ #endif #include - #include - -#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) || \ - defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS) +#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ #include - #endif -#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS +#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ struct timespec CPU_usage_Uptime_at_last_reset; #else uint32_t CPU_usage_Ticks_at_last_reset; #endif - diff --git a/cpukit/libmisc/cpuuse/cpuusagereport.c b/cpukit/libmisc/cpuuse/cpuusagereport.c index 6d916e1cc0..84ee21fc07 100644 --- a/cpukit/libmisc/cpuuse/cpuusagereport.c +++ b/cpukit/libmisc/cpuuse/cpuusagereport.c @@ -27,11 +27,11 @@ #include #include -#if defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS) +#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ #include #endif -#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS +#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; @@ -53,7 +53,7 @@ void rtems_cpu_usage_report_with_plugin( Objects_Information *information; char name[13]; uint32_t ival, fval; - #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ Timestamp_Control uptime, total, ran; #else uint32_t total_units = 0; @@ -67,7 +67,7 @@ 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. */ - #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ _TOD_Get_uptime( &uptime ); _Timestamp_Subtract( &CPU_usage_Uptime_at_last_reset, &uptime, &total ); #else @@ -91,7 +91,7 @@ void rtems_cpu_usage_report_with_plugin( "-------------------------------------------------------------------------------\n" " CPU USAGE BY THREAD\n" "------------+----------------------------------------+---------------+---------\n" - #if defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS) + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ " ID | NAME | SECONDS | PERCENT\n" #else " ID | NAME | TICKS | PERCENT\n" @@ -121,7 +121,7 @@ void rtems_cpu_usage_report_with_plugin( name ); - #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ /* * If this is the currently executing thread, account for time * since the last context switch. @@ -152,7 +152,7 @@ void rtems_cpu_usage_report_with_plugin( uint64_t ival_64; ival_64 = the_thread->cpu_time_used; - ival_64 *= 10000; + ival_64 *= 100000; ival = ival_64 / total_units; } else { ival = 0; @@ -171,7 +171,7 @@ void rtems_cpu_usage_report_with_plugin( } } - #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ (*print)( context, "------------+----------------------------------------+---------------+---------\n" diff --git a/cpukit/libmisc/cpuuse/cpuusagereset.c b/cpukit/libmisc/cpuuse/cpuusagereset.c index 233631dda2..80c041e3fe 100644 --- a/cpukit/libmisc/cpuuse/cpuusagereset.c +++ b/cpukit/libmisc/cpuuse/cpuusagereset.c @@ -28,18 +28,17 @@ static void CPU_usage_Per_thread_handler( Thread_Control *the_thread ) { - #ifdef RTEMS_ENABLE_NANOSECOND_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 } - /* * External data that is shared by cpu usage code but not declared in .h files. */ -#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS +#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; @@ -50,7 +49,7 @@ static void CPU_usage_Per_thread_handler( */ void rtems_cpu_usage_reset( void ) { - #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ _TOD_Get_uptime( &CPU_usage_Uptime_at_last_reset ); _Thread_Time_of_last_context_switch = CPU_usage_Uptime_at_last_reset; #else diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h b/cpukit/rtems/include/rtems/rtems/ratemon.h index 20cccc5d46..04f45d29a6 100644 --- a/cpukit/rtems/include/rtems/rtems/ratemon.h +++ b/cpukit/rtems/include/rtems/rtems/ratemon.h @@ -54,25 +54,11 @@ extern "C" { #endif -/* - * The user can define this at configure time and go back to ticks - * resolution. - */ -#if !defined(__RTEMS_USE_TICKS_RATE_MONOTONIC_STATISTICS__) - /** - * Enable the nanosecond accurate statistics - * - * When not defined, the older style tick accurate granularity - * is used. - */ - #define RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS -#endif - /** * This is the public type used for the rate monotonic timing * statistics. */ -#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) +#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ #include typedef struct timespec rtems_rate_monotonic_period_time_t; @@ -84,7 +70,7 @@ extern "C" { * This is the internal type used for the rate monotonic timing * statistics. */ -#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) +#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ #include typedef Timestamp_Control Rate_monotonic_Period_time_t; @@ -435,7 +421,7 @@ void _Rate_monotonic_Initiate_statistics( * * This method resets the statistics information for a period instance. */ -#ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS +#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ #define _Rate_monotonic_Reset_wall_time_statistics( _the_period ) \ do { \ /* set the minimums to a large value */ \ @@ -458,7 +444,7 @@ void _Rate_monotonic_Initiate_statistics( * * This helper method resets the period CPU usage statistics structure. */ -#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS +#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ #define _Rate_monotonic_Reset_cpu_use_statistics( _the_period ) \ do { \ /* set the minimums to a large value */ \ diff --git a/cpukit/rtems/include/rtems/rtems/types.h b/cpukit/rtems/include/rtems/rtems/types.h index 4c867c5cf4..8d8e77fd9c 100644 --- a/cpukit/rtems/include/rtems/rtems/types.h +++ b/cpukit/rtems/include/rtems/rtems/types.h @@ -124,15 +124,14 @@ typedef Watchdog_Interval rtems_interval; * @brief Represents the CPU usage per thread. * * When using nano seconds granularity timing, RTEMS may internally use a - * variety of represenations. + * variety of representations. */ -#ifndef __RTEMS_USE_TICKS_CPU_USAGE_STATISTICS__ +#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ typedef struct timespec rtems_thread_cpu_usage_t; #else typedef uint32_t rtems_thread_cpu_usage_t; #endif - /** * @brief Data structure to manage and manipulate calendar time. */ diff --git a/cpukit/rtems/src/ratemongetstatistics.c b/cpukit/rtems/src/ratemongetstatistics.c index 9b6eb4b173..611eb0d3c3 100644 --- a/cpukit/rtems/src/ratemongetstatistics.c +++ b/cpukit/rtems/src/ratemongetstatistics.c @@ -61,21 +61,17 @@ rtems_status_code rtems_rate_monotonic_get_statistics( src = &the_period->Statistics; dst->count = src->count; dst->missed_count = src->missed_count; - #if defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS) + #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 ); - #else - statistics->min_wall_time = src->min_wall_time; - statistics->max_wall_time = src->max_wall_time; - statistics->total_wall_time = src->total_wall_time; - #endif - - #if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) _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; 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 #include -#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) || \ - defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS) +#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ #include #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; diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/ratemonperiod.c index 9d2ed6006a..a09de1d3e2 100644 --- a/cpukit/rtems/src/ratemonperiod.c +++ b/cpukit/rtems/src/ratemonperiod.c @@ -30,13 +30,10 @@ void _Rate_monotonic_Initiate_statistics( Thread_Control *owning_thread = the_period->owner; /* - * If any statistics are at nanosecond granularity, we need to - * obtain the uptime. + * If using nanosecond statistics, we need to obtain the uptime. */ - #if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) || \ - defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS) - - struct timespec uptime; + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ + Timestamp_Control uptime; _TOD_Get_uptime( &uptime ); #endif @@ -44,7 +41,7 @@ void _Rate_monotonic_Initiate_statistics( /* * Set the starting point and the CPU time used for the statistics. */ - #ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ the_period->time_at_period = uptime; #else the_period->time_at_period = _Watchdog_Ticks_since_boot; @@ -53,14 +50,14 @@ void _Rate_monotonic_Initiate_statistics( the_period->owner_executed_at_period = owning_thread->cpu_time_used; /* - * If using nanosecond granularity for CPU Usage Statistics and the - * period's thread is currently executing, then we need to take into - * account how much time the executing thread has run since the last - * context switch. When this routine is invoked from - * rtems_rate_monotonic_period, the owner will be the executing thread. - * When this routine is invoked from _Rate_monotonic_Timeout, it will not. + * If using nanosecond statistics and the period's thread is currently + * executing, then we need to take into account how much time the + * executing thread has run since the last context switch. When this + * routine is invoked from rtems_rate_monotonic_period, the owner will + * be the executing thread. When this routine is invoked from + * _Rate_monotonic_Timeout, it will not. */ - #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ if (owning_thread == _Thread_Executing) { rtems_thread_cpu_usage_t ran; @@ -85,13 +82,13 @@ void _Rate_monotonic_Update_statistics( Rate_monotonic_Statistics *stats; Thread_CPU_usage_t executed; Rate_monotonic_Period_time_t since_last_period; - #if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) || \ - defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS) - Timestamp_Control uptime; - /* - * Obtain the current time since boot - */ + /* + * If using nanosecond statistics, we need to obtain the uptime. + */ + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ + Timestamp_Control uptime; + _TOD_Get_uptime( &uptime ); #endif @@ -113,7 +110,7 @@ void _Rate_monotonic_Update_statistics( /* * Grab basic information for time statistics. */ - #ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ _Timespec_Subtract( &the_period->time_at_period, &uptime, @@ -123,7 +120,7 @@ void _Rate_monotonic_Update_statistics( since_last_period = _Watchdog_Ticks_since_boot - the_period->time_at_period; #endif - #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ { Thread_CPU_usage_t ran, used; @@ -159,8 +156,7 @@ void _Rate_monotonic_Update_statistics( /* * Update CPU time */ - - #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ _Timestamp_Add_to( &stats->total_cpu_time, &executed ); if ( _Timestamp_Less_than( &executed, &stats->min_cpu_time ) ) @@ -181,8 +177,15 @@ void _Rate_monotonic_Update_statistics( /* * Update Wall time */ + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ + _Timestamp_Add_to( &stats->total_wall_time, &since_last_period ); - #ifndef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS + if ( _Timestamp_Less_than( &since_last_period, &stats->min_wall_time ) ) + stats->min_wall_time = since_last_period; + + if ( _Timestamp_Greater_than( &since_last_period, &stats->max_wall_time ) ) + stats->max_wall_time = since_last_period; + #else /* Sanity check wall time */ if ( since_last_period < executed ) @@ -195,14 +198,6 @@ void _Rate_monotonic_Update_statistics( if ( since_last_period > stats->max_wall_time ) stats->max_wall_time = since_last_period; - #else - _Timestamp_Add_to( &stats->total_wall_time, &since_last_period ); - - if ( _Timestamp_Less_than( &since_last_period, &stats->min_wall_time ) ) - stats->min_wall_time = since_last_period; - - if ( _Timestamp_Greater_than( &since_last_period, &stats->max_wall_time ) ) - stats->max_wall_time = since_last_period; #endif } diff --git a/cpukit/rtems/src/ratemonreportstatistics.c b/cpukit/rtems/src/ratemonreportstatistics.c index 2aa5129bcc..791bb544ec 100644 --- a/cpukit/rtems/src/ratemonreportstatistics.c +++ b/cpukit/rtems/src/ratemonreportstatistics.c @@ -23,8 +23,7 @@ #include #include -#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) || \ - defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS) +#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ /* We print to 1/10's of milliseconds */ #define NANOSECONDS_DIVIDER 1000 #define PERCENT_FMT "%04" PRId32 @@ -54,10 +53,8 @@ void rtems_rate_monotonic_report_statistics_with_plugin( return; (*print)( context, "Period information by period\n" ); - #if defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS) + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ (*print)( context, "--- CPU times are in seconds ---\n" ); - #endif - #if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) (*print)( context, "--- Wall times are in seconds ---\n" ); #endif /* @@ -74,28 +71,22 @@ ididididid NNNN ccccc mmmmmm X \n"); */ (*print)( context, " ID OWNER COUNT MISSED " - #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ " " #endif "CPU TIME " - #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS - " " - #endif - #ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS - " " + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ + " " #endif " WALL TIME\n" ); (*print)( context, " " - #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ " " #endif "MIN/MAX/AVG " - #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS - " " - #endif - #ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS - " " + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ + " " #endif " MIN/MAX/AVG\n" ); @@ -141,7 +132,7 @@ ididididid NNNN ccccc mmmmmm X * print CPU Usage part of statistics */ { - #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_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; @@ -177,7 +168,7 @@ ididididid NNNN ccccc mmmmmm X * print wall time part of statistics */ { - #ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_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; diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h index 9e09efc950..214f8ce1f5 100644 --- a/cpukit/score/include/rtems/score/thread.h +++ b/cpukit/score/include/rtems/score/thread.h @@ -47,17 +47,9 @@ extern "C" { * The user can define this at configure time and go back to ticks * resolution. */ -#ifndef __RTEMS_USE_TICKS_CPU_USAGE_STATISTICS__ +#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ #include - /** - * This macro enables the nanosecond accurate statistics - * - * When not defined, the older style tick accurate granularity - * is used. - */ - #define RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS - typedef Timestamp_Control Thread_CPU_usage_t; #else typedef uint32_t Thread_CPU_usage_t; @@ -76,10 +68,6 @@ extern "C" { #include #include -#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS - /* XXX include something for timespec */ -#endif - /** * The following defines the "return type" of a thread. * @@ -516,7 +504,7 @@ SCORE_EXTERN Thread_Control *_Thread_Allocated_fp; */ SCORE_EXTERN struct _reent **_Thread_libc_reent; -#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS +#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ /** * This contains the time since boot when the last context switch occurred. diff --git a/cpukit/score/src/threaddispatch.c b/cpukit/score/src/threaddispatch.c index e3c0ded97d..58a303a503 100644 --- a/cpukit/score/src/threaddispatch.c +++ b/cpukit/score/src/threaddispatch.c @@ -30,7 +30,7 @@ #include #include -#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS +#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ #include #endif @@ -102,7 +102,7 @@ void _Thread_Dispatch( void ) heir->cpu_time_budget = _Thread_Ticks_per_timeslice; _ISR_Enable( level ); - #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS + #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ { Timestamp_Control uptime, ran; _TOD_Get_uptime( &uptime ); diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c index fe9a5c3dea..671354ed88 100644 --- a/cpukit/score/src/threadinitialize.c +++ b/cpukit/score/src/threadinitialize.c @@ -200,10 +200,10 @@ bool _Thread_Initialize( /* * Initialize the CPU usage statistics */ - #ifdef RTEMS_ENABLE_NANOSECOND_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; + the_thread->cpu_time_used = 0; #endif /* diff --git a/cpukit/score/src/threadtickletimeslice.c b/cpukit/score/src/threadtickletimeslice.c index ab6469b3c3..76324fc13e 100644 --- a/cpukit/score/src/threadtickletimeslice.c +++ b/cpukit/score/src/threadtickletimeslice.c @@ -49,7 +49,7 @@ void _Thread_Tickle_timeslice( void ) executing = _Thread_Executing; - #ifndef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS + #ifdef __RTEMS_USE_TICKS_FOR_STATISTICS__ /* * Increment the number of ticks this thread has been executing */ -- cgit v1.2.3