summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-11-10 23:27:34 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-11-10 23:27:34 +0000
commita91e372e9aa0279883df2a6287568e13677e4009 (patch)
treed843d1ff7172ad8a592778ee8fbbcceb2bafeae4 /cpukit/rtems
parent2009-11-09 Till Straumann <strauman@slac.stanford.edu> (diff)
downloadrtems-a91e372e9aa0279883df2a6287568e13677e4009.tar.bz2
2009-11-10 Jennifer Averett <jennifer.averett@OARcorp.com>
PR 1462/cpukit * rtems/include/rtems/rtems/ratemon.h, rtems/src/ratemonperiod.c: Fine tune previous patch after analysis in application.
Diffstat (limited to 'cpukit/rtems')
-rw-r--r--cpukit/rtems/include/rtems/rtems/ratemon.h12
-rw-r--r--cpukit/rtems/src/ratemonperiod.c21
2 files changed, 24 insertions, 9 deletions
diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h b/cpukit/rtems/include/rtems/rtems/ratemon.h
index b3552e639a..19eed0c2cf 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemon.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemon.h
@@ -446,7 +446,11 @@ void _Rate_monotonic_Initiate_statistics(
); \
} while (0)
#else
- #define _Rate_monotonic_Reset_wall_time_statistics( _the_period )
+ #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
/**
@@ -465,7 +469,11 @@ void _Rate_monotonic_Initiate_statistics(
); \
} while (0)
#else
- #define _Rate_monotonic_Reset_cpu_use_statistics( _the_period )
+ #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
/**
diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/ratemonperiod.c
index ffa8f397a3..5796f0fe07 100644
--- a/cpukit/rtems/src/ratemonperiod.c
+++ b/cpukit/rtems/src/ratemonperiod.c
@@ -104,7 +104,6 @@ void _Rate_monotonic_Update_statistics(
/*
* Update the counts.
*/
-
stats = &the_period->Statistics;
stats->count++;
@@ -114,15 +113,14 @@ void _Rate_monotonic_Update_statistics(
/*
* Grab basic information for time statistics.
*/
-
#ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
- _Timestamp_Subtract(
- &the_period->time_at_period, &uptime, &since_last_period
+ _Timespec_Subtract(
+ &the_period->time_at_period,
+ &uptime,
+ &since_last_period
);
- the_period->time_at_period = uptime;
#else
since_last_period = _Watchdog_Ticks_since_boot - the_period->time_at_period;
- the_period->time_at_period = _Watchdog_Ticks_since_boot;
#endif
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
@@ -150,6 +148,10 @@ void _Rate_monotonic_Update_statistics(
);
}
#else
+ /* partial period, cpu usage info reset while executing. Throw away */
+ if (the_period->owner->cpu_time_used <
+ the_period->owner_executed_at_period)
+ return;
executed = the_period->owner->cpu_time_used -
the_period->owner_executed_at_period;
#endif
@@ -181,6 +183,11 @@ void _Rate_monotonic_Update_statistics(
*/
#ifndef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
+
+ /* Sanity check wall time */
+ if ( since_last_period < executed )
+ since_last_period = executed;
+
stats->total_wall_time += since_last_period;
if ( since_last_period < stats->min_wall_time )
@@ -323,7 +330,7 @@ rtems_status_code rtems_rate_monotonic_period(
/*
* Update statistics from the concluding period
*/
- _Rate_monotonic_Update_statistics( the_period );
+ _Rate_monotonic_Initiate_statistics( the_period );
_ISR_Enable( level );