changeset 043b9307eef3 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=043b9307eef3
description:
        O3: Add stat that counts how many cycles the O3 cpu was quiesced.

diffstat:

 src/cpu/o3/cpu.cc |  13 +++++++++++++
 src/cpu/o3/cpu.hh |   3 +++
 2 files changed, 16 insertions(+), 0 deletions(-)

diffs (57 lines):

diff -r 755f4f6eae52 -r 043b9307eef3 src/cpu/o3/cpu.cc
--- a/src/cpu/o3/cpu.cc Thu Dec 01 00:17:14 2011 -0500
+++ b/src/cpu/o3/cpu.cc Thu Dec 01 00:15:22 2011 -0800
@@ -442,6 +442,12 @@
               "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 @@
         activityRec.activity();
         fetch.wakeFromQuiesce();
 
+        quiesceCycles += tickToCycles((curTick() - 1) - lastRunningCycle);
+
         lastActivatedCycle = curTick();
 
         _status = Running;
@@ -722,6 +730,9 @@
     if ((activeThreads.size() == 1 && !deallocated) ||
         activeThreads.size() == 0)
         unscheduleTickEvent();
+
+    DPRINTF(Quiesce, "Suspending Context\n");
+    lastRunningCycle = curTick();
     _status = Idle;
 }
 
@@ -1205,6 +1216,8 @@
     }
     if (!tickEvent.scheduled())
         schedule(tickEvent, nextCycle());
+
+    lastRunningCycle = curTick();
 }
 
 template <class Impl>
diff -r 755f4f6eae52 -r 043b9307eef3 src/cpu/o3/cpu.hh
--- a/src/cpu/o3/cpu.hh Thu Dec 01 00:17:14 2011 -0500
+++ b/src/cpu/o3/cpu.hh Thu Dec 01 00:15:22 2011 -0800
@@ -720,6 +720,9 @@
     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. */
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to