summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/cpuuse/cpuusagereset.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-07-18 21:31:49 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-07-18 21:31:49 +0000
commit793dd46d64ec6e0fac46395cdf53cf053366b93e (patch)
tree33ad52b4cd81cacb37143ba8550a58296b078724 /cpukit/libmisc/cpuuse/cpuusagereset.c
parent2007-07-18 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-793dd46d64ec6e0fac46395cdf53cf053366b93e.tar.bz2
2007-07-18 Joel Sherrill <joel.sherrill@oarcorp.com>
* libmisc/Makefile.am, libmisc/cpuuse/cpuusagereport.c, libmisc/cpuuse/cpuusagereset.c: Fix bug where cpu usage calculation was always using uptime not time since last cpu usage reset when using nanoseconds granularity. * libmisc/cpuuse/cpuusagedata.c: New file.
Diffstat (limited to '')
-rw-r--r--cpukit/libmisc/cpuuse/cpuusagereset.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/cpukit/libmisc/cpuuse/cpuusagereset.c b/cpukit/libmisc/cpuuse/cpuusagereset.c
index 6622b93c90..3f351b1c51 100644
--- a/cpukit/libmisc/cpuuse/cpuusagereset.c
+++ b/cpukit/libmisc/cpuuse/cpuusagereset.c
@@ -40,10 +40,15 @@ static void CPU_usage_Per_thread_handler(
*/
void rtems_cpu_usage_reset( void )
{
- #ifndef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
+ #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
+ extern struct timespec CPU_usage_Uptime_at_last_reset;
+
+ _TOD_Get_uptime( &CPU_usage_Uptime_at_last_reset );
+ #else
extern uint32_t CPU_usage_Ticks_at_last_reset;
CPU_usage_Ticks_at_last_reset = _Watchdog_Ticks_since_boot;
+
#endif
rtems_iterate_over_all_threads(CPU_usage_Per_thread_handler);