cpu: fix system total instructions accounting
authorNikos Nikoleris <nikos.nikoleris@gmail.com>
Fri, 3 Apr 2015 16:42:10 +0000 (11:42 -0500)
committerNikos Nikoleris <nikos.nikoleris@gmail.com>
Fri, 3 Apr 2015 16:42:10 +0000 (11:42 -0500)
The totalInstructions counter is only incremented when the whole instruction is
commited and not on every microop. It was incorrectly reset in atomic and
timing cpus.

Committed by: Nilay Vaish <nilay@cs.wisc.edu>"

src/cpu/minor/execute.cc
src/cpu/o3/cpu.cc
src/cpu/simple/atomic.cc
src/cpu/simple/timing.cc

index f7b773377c79c609e075e065c5646c8adda2f25b..706fdf010e695b5931a3d8be886a2861f682c267 100644 (file)
@@ -840,15 +840,15 @@ Execute::doInstCommitAccounting(MinorDynInstPtr inst)
         thread->numInst++;
         thread->numInsts++;
         cpu.stats.numInsts++;
+        cpu.system->totalNumInsts++;
+
+        /* Act on events related to instruction counts */
+        cpu.comInstEventQueue[inst->id.threadId]->serviceEvents(thread->numInst);
+        cpu.system->instEventQueue.serviceEvents(cpu.system->totalNumInsts);
     }
     thread->numOp++;
     thread->numOps++;
     cpu.stats.numOps++;
-    cpu.system->totalNumInsts++;
-
-    /* Act on events related to instruction counts */
-    cpu.comInstEventQueue[inst->id.threadId]->serviceEvents(thread->numInst);
-    cpu.system->instEventQueue.serviceEvents(cpu.system->totalNumInsts);
 
     /* Set the CP SeqNum to the numOps commit number */
     if (inst->traceData)
index fc7643be201ec1338e4e0d560dcb08b694808dd8..715a530d74807ea1115cd26f641c969eca272c19 100644 (file)
@@ -1440,16 +1440,16 @@ FullO3CPU<Impl>::instDone(ThreadID tid, DynInstPtr &inst)
         thread[tid]->numInst++;
         thread[tid]->numInsts++;
         committedInsts[tid]++;
+        system->totalNumInsts++;
+
+        // Check for instruction-count-based events.
+        comInstEventQueue[tid]->serviceEvents(thread[tid]->numInst);
+        system->instEventQueue.serviceEvents(system->totalNumInsts);
     }
     thread[tid]->numOp++;
     thread[tid]->numOps++;
     committedOps[tid]++;
 
-    system->totalNumInsts++;
-    // Check for instruction-count-based events.
-    comInstEventQueue[tid]->serviceEvents(thread[tid]->numInst);
-    system->instEventQueue.serviceEvents(system->totalNumInsts);
-
     probeInstCommit(inst->staticInst);
 }
 
index 64280bda020f688fd2663442ae7247fc55e03965..4c1c45355f1c198758904b3fb616d61f4c847d07 100644 (file)
@@ -168,8 +168,6 @@ AtomicSimpleCPU::drainResume()
         _status = BaseSimpleCPU::Idle;
         notIdleFraction = 0;
     }
-
-    system->totalNumInsts = 0;
 }
 
 bool
index 8b95696a34afed4b4408776df8d8372dbdcccae8..a3c4e27e878aed97fcae9054e0b8588c81a316e5 100644 (file)
@@ -94,8 +94,6 @@ TimingSimpleCPU::TimingSimpleCPU(TimingSimpleCPUParams *p)
       fetchEvent(this), drainManager(NULL)
 {
     _status = Idle;
-
-    system->totalNumInsts = 0;
 }