mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-11-16 12:34:45 +00:00
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.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
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.
|
||||
|
||||
2009-10-30 Glenn Humphrey <glenn.humphrey@oarcorp.com>
|
||||
|
||||
PR pr1462/cpukit
|
||||
|
||||
@@ -413,7 +413,11 @@ void _Rate_monotonic_Initiate_statistics(
|
||||
(_the_period)->Statistics.min_wall_time.tv_nsec = 0x7fffffff; \
|
||||
} 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
|
||||
|
||||
/**
|
||||
@@ -429,7 +433,11 @@ void _Rate_monotonic_Initiate_statistics(
|
||||
(_the_period)->Statistics.min_cpu_time.tv_nsec = 0x7fffffff; \
|
||||
} 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
|
||||
|
||||
/**
|
||||
|
||||
@@ -90,9 +90,6 @@ void _Rate_monotonic_Update_statistics(
|
||||
rtems_rate_monotonic_period_statistics *stats;
|
||||
rtems_thread_cpu_usage_t executed;
|
||||
rtems_rate_monotonic_period_time_t since_last_period;
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
|
||||
rtems_rate_monotonic_period_time_t period_start;
|
||||
#endif
|
||||
#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) || \
|
||||
defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
|
||||
struct timespec uptime;
|
||||
@@ -112,7 +109,6 @@ void _Rate_monotonic_Update_statistics(
|
||||
/*
|
||||
* Update the counts.
|
||||
*/
|
||||
|
||||
stats = &the_period->Statistics;
|
||||
stats->count++;
|
||||
|
||||
@@ -122,14 +118,14 @@ void _Rate_monotonic_Update_statistics(
|
||||
/*
|
||||
* Grab basic information for time statistics.
|
||||
*/
|
||||
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
|
||||
period_start = the_period->time_at_period;
|
||||
_Timespec_Subtract( &period_start, &uptime, &since_last_period );
|
||||
the_period->time_at_period = uptime;
|
||||
_Timespec_Subtract(
|
||||
&the_period->time_at_period,
|
||||
&uptime,
|
||||
&since_last_period
|
||||
);
|
||||
#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
|
||||
@@ -155,6 +151,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
|
||||
@@ -186,6 +186,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 )
|
||||
@@ -329,7 +334,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 );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user