forked from Imagelibrary/rtems
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.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user