diff options
author | Glenn Humphrey <glenn.humphrey@oarcorp.com> | 2009-12-02 18:15:16 +0000 |
---|---|---|
committer | Glenn Humphrey <glenn.humphrey@oarcorp.com> | 2009-12-02 18:15:16 +0000 |
commit | c6f7e060eaeb951a86dc640855e88c6f8260a347 (patch) | |
tree | 7d6ef3b0be5fec6206861601980974b5749baa04 /cpukit/rtems/src | |
parent | 2009-12-02 Ralf Corsépius <ralf.corsepius@rtems.org> (diff) | |
download | rtems-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 '')
-rw-r--r-- | cpukit/rtems/src/ratemongetstatistics.c | 12 | ||||
-rw-r--r-- | cpukit/rtems/src/ratemongetstatus.c | 35 | ||||
-rw-r--r-- | cpukit/rtems/src/ratemonperiod.c | 61 | ||||
-rw-r--r-- | cpukit/rtems/src/ratemonreportstatistics.c | 29 |
4 files changed, 53 insertions, 84 deletions
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 <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; 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 <rtems/bspIo.h> #include <rtems/score/timespec.h> -#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; |