inorder: add execution unit stats
authorKorey Sewell <ksewell@umich.edu>
Sun, 31 Jan 2010 23:29:49 +0000 (18:29 -0500)
committerKorey Sewell <ksewell@umich.edu>
Sun, 31 Jan 2010 23:29:49 +0000 (18:29 -0500)
src/cpu/inorder/resources/execution_unit.cc
src/cpu/inorder/resources/execution_unit.hh

index 6c44e2456acf9d288fbc173468c87652edcb5307..4292912315a83b0ef5a3110c0a30722b24382882 100644 (file)
@@ -54,6 +54,17 @@ ExecutionUnit::regStats()
         .name(name() + ".predictedNotTakenIncorrect")
         .desc("Number of Branches Incorrectly Predicted As Not Taken).");
 
+    lastExecuteCycle = curTick;
+
+    cyclesExecuted
+        .name(name() + ".cyclesExecuted")
+        .desc("Number of Cycles Execution Unit was used.");
+
+    utilization
+        .name(name() + ".utilization")
+        .desc("Utilization of Execution Unit (cycles / totalCycles).");
+    utilization = cyclesExecuted / cpu->numCycles;
+
     Resource::regStats();
 }
 
@@ -75,6 +86,12 @@ ExecutionUnit::execute(int slot_num)
     {
       case ExecuteInst:
         {
+            if (curTick != lastExecuteCycle) {
+                lastExecuteCycle = curTick;
+                cyclesExecuted++;
+            }
+
+
             if (inst->isMemRef()) {
                 panic("%s not configured to handle memory ops.\n", resName);
             } else if (inst->isControl()) {
index 46691bbf25e13c10a758953087353807409fa595..37651e873179a2acbc19b9508cadc7f7fa5cb9c1 100644 (file)
@@ -71,6 +71,11 @@ class ExecutionUnit : public Resource {
     /////////////////////////////////////////////////////////////////
     Stats::Scalar predictedTakenIncorrect;
     Stats::Scalar predictedNotTakenIncorrect;
+
+    Stats::Scalar cyclesExecuted;
+    Tick lastExecuteCycle;
+
+    Stats::Formula utilization;
 };