From 4e21c9a5b18a2a016b932e15c905a31eec893fdb Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 16 Dec 2010 15:46:34 +0000 Subject: 2010-12-16 Sebastian Huber * libmisc/cpuuse/cpuusagereport.c: We have to take the time since the last context switch before the uptime. --- cpukit/libmisc/cpuuse/cpuusagereport.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'cpukit/libmisc') diff --git a/cpukit/libmisc/cpuuse/cpuusagereport.c b/cpukit/libmisc/cpuuse/cpuusagereport.c index 8b7eb00300..5f4f51bd1f 100644 --- a/cpukit/libmisc/cpuuse/cpuusagereport.c +++ b/cpukit/libmisc/cpuuse/cpuusagereport.c @@ -53,7 +53,7 @@ void rtems_cpu_usage_report_with_plugin( char name[13]; uint32_t ival, fval; #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ - Timestamp_Control uptime, total, ran; + Timestamp_Control uptime, total, ran, last_context_switch; #else uint32_t total_units = 0; #endif @@ -67,6 +67,7 @@ void rtems_cpu_usage_report_with_plugin( * guideline as to what each number means proportionally. */ #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ + last_context_switch = _Thread_Time_of_last_context_switch; _TOD_Get_uptime( &uptime ); _Timestamp_Subtract( &CPU_usage_Uptime_at_last_reset, &uptime, &total ); #else @@ -132,9 +133,7 @@ void rtems_cpu_usage_report_with_plugin( ran = the_thread->cpu_time_used; if ( _Thread_Executing->Object.id == the_thread->Object.id ) { Timestamp_Control used; - _Timestamp_Subtract( - &_Thread_Time_of_last_context_switch, &uptime, &used - ); + _Timestamp_Subtract( &last_context_switch, &uptime, &used ); _Timestamp_Add_to( &ran, &used ); }; _Timestamp_Divide( &ran, &total, &ival, &fval ); -- cgit v1.2.3