summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2010-12-16 15:46:34 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2010-12-16 15:46:34 +0000
commit4e21c9a5b18a2a016b932e15c905a31eec893fdb (patch)
tree1cbedd60f053558c3bdfbcea35a6335d37b84a11 /cpukit/libmisc
parent2010-12-16 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff)
downloadrtems-4e21c9a5b18a2a016b932e15c905a31eec893fdb.tar.bz2
2010-12-16 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libmisc/cpuuse/cpuusagereport.c: We have to take the time since the last context switch before the uptime.
Diffstat (limited to 'cpukit/libmisc')
-rw-r--r--cpukit/libmisc/cpuuse/cpuusagereport.c7
1 files changed, 3 insertions, 4 deletions
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 );