diff options
Diffstat (limited to 'cpukit/rtems/src/ratemonperiod.c')
-rw-r--r-- | cpukit/rtems/src/ratemonperiod.c | 73 |
1 files changed, 28 insertions, 45 deletions
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; } |