From 646c4a23ca44aab5468c896034288151c89be782 Mon Sep 17 00:00:00 2001 From: Lena Olson Date: Mon, 19 Aug 2013 03:52:35 -0400 Subject: cpu: Accurately count idle cycles for simple cpu Added a couple missing updates to the notIdleFraction stat. Without these, it sometimes gives a (not) idle fraction that is greater than 1 or less than 0. --- src/cpu/ozone/cpu_impl.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/cpu/ozone') diff --git a/src/cpu/ozone/cpu_impl.hh b/src/cpu/ozone/cpu_impl.hh index fe8ae2551..f64f287ea 100644 --- a/src/cpu/ozone/cpu_impl.hh +++ b/src/cpu/ozone/cpu_impl.hh @@ -282,7 +282,7 @@ OzoneCPU::activateContext(int thread_num, int delay) assert(thread_num == 0); assert(_status == Idle); - notIdleFraction++; + notIdleFraction = 1; scheduleTickEvent(delay); _status = Running; if (thread.quiesceEvent && thread.quiesceEvent->scheduled()) @@ -300,7 +300,7 @@ OzoneCPU::suspendContext(int thread_num) // @todo: Figure out how to initially set the status properly so // this is running. // assert(_status == Running); - notIdleFraction--; + notIdleFraction = 0; unscheduleTickEvent(); _status = Idle; } -- cgit v1.2.3