Update statistics to use cycles properly instead of ticks
authorAli Saidi <saidi@eecs.umich.edu>
Fri, 28 Sep 2007 17:21:30 +0000 (13:21 -0400)
committerAli Saidi <saidi@eecs.umich.edu>
Fri, 28 Sep 2007 17:21:30 +0000 (13:21 -0400)
--HG--
extra : convert_revision : 62911280b631ef24720f9ce701d1c19a9b8a9784

src/cpu/base.hh
src/cpu/o3/cpu.cc
src/cpu/simple/timing.cc

index 76f6e46849961c65991c691b4349d1d1f723ed0e..6f4158d47171ede30db021f08742bce475e9e63c 100644 (file)
@@ -84,6 +84,7 @@ class BaseCPU : public MemObject
     inline Tick frequency() const { return Clock::Frequency / clock; }
     inline Tick cycles(int numCycles) const { return clock * numCycles; }
     inline Tick curCycle() const { return curTick / clock; }
+    inline Tick tickToCycles(Tick val) const { return val / clock; }
     // @todo remove me after debugging with legion done
     Tick instCount() { return instCnt; }
 
index 98e200944366838835ff201f8dbf32ed0e376867..b2b7e09c09fae36e48197cd20c4eb67b35d16ec6 100644 (file)
@@ -1409,7 +1409,8 @@ FullO3CPU<Impl>::wakeCPU()
 
     DPRINTF(Activity, "Waking up CPU\n");
 
-    idleCycles += (curTick - 1) - lastRunningCycle;
+    idleCycles += tickToCycles((curTick - 1) - lastRunningCycle);
+    numCycles += tickToCycles((curTick - 1) - lastRunningCycle);
 
     tickEvent.schedule(nextCycle());
 }
index 8d1cf9a17bd22572845345694f16857bea4dbf01..eee5b8cb514b9eea5d0e214ed5eda93537627975 100644 (file)
@@ -180,7 +180,7 @@ TimingSimpleCPU::switchOut()
 {
     assert(status() == Running || status() == Idle);
     _status = SwitchedOut;
-    numCycles += curTick - previousTick;
+    numCycles += tickToCycles(curTick - previousTick);
 
     // If we've been scheduled to resume but are then told to switch out,
     // we'll need to cancel it.
@@ -483,7 +483,7 @@ TimingSimpleCPU::fetch()
         advanceInst(fault);
     }
 
-    numCycles += curTick - previousTick;
+    numCycles += tickToCycles(curTick - previousTick);
     previousTick = curTick;
 }
 
@@ -512,7 +512,7 @@ TimingSimpleCPU::completeIfetch(PacketPtr pkt)
 
     _status = Running;
 
-    numCycles += curTick - previousTick;
+    numCycles += tickToCycles(curTick - previousTick);
     previousTick = curTick;
 
     if (getState() == SimObject::Draining) {
@@ -629,7 +629,7 @@ TimingSimpleCPU::completeDataAccess(PacketPtr pkt)
     assert(_status == DcacheWaitResponse);
     _status = Running;
 
-    numCycles += curTick - previousTick;
+    numCycles += tickToCycles(curTick - previousTick);
     previousTick = curTick;
 
     Fault fault = curStaticInst->completeAcc(pkt, this, traceData);