O3: Add stat that counts how many cycles the O3 cpu was quiesced.
authorAli Saidi <Ali.Saidi@ARM.com>
Thu, 1 Dec 2011 08:15:22 +0000 (00:15 -0800)
committerAli Saidi <Ali.Saidi@ARM.com>
Thu, 1 Dec 2011 08:15:22 +0000 (00:15 -0800)
--HG--
extra : rebase_source : 043b9307eef3c5b87f8e6370765641e016ed1fa7

src/cpu/o3/cpu.cc
src/cpu/o3/cpu.hh

index 819495d622cb9b9e7be9adce215bbcf5e2c22b01..94fc5cdf3c1ffdeb6b481afd870c76ec8c83dd24 100644 (file)
@@ -442,6 +442,12 @@ FullO3CPU<Impl>::regStats()
               "to idling")
         .prereq(idleCycles);
 
+    quiesceCycles
+        .name(name() + ".quiesceCycles")
+        .desc("Total number of cycles that CPU has spent quiesced or waiting "
+              "for an interrupt")
+        .prereq(quiesceCycles);
+
     // Number of Instructions simulated
     // --------------------------------
     // Should probably be in Base CPU but need templated
@@ -688,6 +694,8 @@ FullO3CPU<Impl>::activateContext(ThreadID tid, int delay)
         activityRec.activity();
         fetch.wakeFromQuiesce();
 
+        quiesceCycles += tickToCycles((curTick() - 1) - lastRunningCycle);
+
         lastActivatedCycle = curTick();
 
         _status = Running;
@@ -722,6 +730,9 @@ FullO3CPU<Impl>::suspendContext(ThreadID tid)
     if ((activeThreads.size() == 1 && !deallocated) ||
         activeThreads.size() == 0)
         unscheduleTickEvent();
+
+    DPRINTF(Quiesce, "Suspending Context\n");
+    lastRunningCycle = curTick();
     _status = Idle;
 }
 
@@ -1205,6 +1216,8 @@ FullO3CPU<Impl>::takeOverFrom(BaseCPU *oldCPU)
     }
     if (!tickEvent.scheduled())
         schedule(tickEvent, nextCycle());
+
+    lastRunningCycle = curTick();
 }
 
 template <class Impl>
index dd9f5d40fe2cf962ed55e2e72c824199741c9175..b2606c1e2f93de167a084f9d9f237c8fed52d1d7 100644 (file)
@@ -720,6 +720,9 @@ class FullO3CPU : public BaseO3CPU
     Stats::Scalar timesIdled;
     /** Stat for total number of cycles the CPU spends descheduled. */
     Stats::Scalar idleCycles;
+    /** Stat for total number of cycles the CPU spends descheduled due to a
+     * quiesce operation or waiting for an interrupt. */
+    Stats::Scalar quiesceCycles;
     /** Stat for the number of committed instructions per thread. */
     Stats::Vector committedInsts;
     /** Stat for the total number of committed instructions. */