* libmisc/cpuuse/cpuusagereport.c: We have to take the time since the
	last context switch before the uptime.
This commit is contained in:
Sebastian Huber
2010-12-16 15:46:34 +00:00
parent 18657d189d
commit 4e21c9a5b1
2 changed files with 8 additions and 4 deletions

View File

@@ -1,3 +1,8 @@
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.
2010-12-16 Sebastian Huber <sebastian.huber@embedded-brains.de>
* score/src/watchdognanoseconds.c: New file.

View File

@@ -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 );