cpu-o3: convert rob to new style stats
authorEmily Brickey <esbrickey@ucdavis.edu>
Tue, 25 Aug 2020 21:42:27 +0000 (14:42 -0700)
committerJason Lowe-Power <power.jg@gmail.com>
Wed, 9 Sep 2020 14:37:37 +0000 (14:37 +0000)
Change-Id: I84430d50c49742cd536dd75ce25184c2316dce51
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33398
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/cpu/o3/cpu.cc
src/cpu/o3/rob.hh
src/cpu/o3/rob_impl.hh

index c5b4a825f1cfac200b978d0c245393eaeec836ca..bbc6b82093fe24e2d311d115bbb86b269b97fd45 100644 (file)
@@ -443,7 +443,6 @@ FullO3CPU<Impl>::regStats()
 
     this->rename.regStats();
     this->iew.regStats();
-    this->rob.regStats();
 
     intRegfileReads
         .name(name() + ".int_regfile_reads")
index eb8d1d6b19d1b19a95b536a19d5ca7b9cdb6eeb2..4b87dc4d9ed88af262e1382cc655910e238182e1 100644 (file)
@@ -257,9 +257,6 @@ class ROB
      */
     size_t countInsts(ThreadID tid);
 
-    /** Registers statistics. */
-    void regStats();
-
   private:
     /** Reset the ROB state */
     void resetState();
@@ -323,10 +320,15 @@ class ROB
     /** Number of active threads. */
     ThreadID numThreads;
 
-    // The number of rob_reads
-    Stats::Scalar robReads;
-    // The number of rob_writes
-    Stats::Scalar robWrites;
+
+    struct ROBStats : public Stats::Group {
+        ROBStats(Stats::Group *parent);
+
+        // The number of rob_reads
+        Stats::Scalar reads;
+        // The number of rob_writes
+        Stats::Scalar writes;
+    } stats;
 };
 
 #endif //__CPU_O3_ROB_HH__
index 80ea1e69b22555f1878dd65d3bb1ddd958a5964c..bfc368bc99dbd3416475f35cac3ae8ed40abb14b 100644 (file)
@@ -58,7 +58,8 @@ ROB<Impl>::ROB(O3CPU *_cpu, DerivO3CPUParams *params)
       numEntries(params->numROBEntries),
       squashWidth(params->squashWidth),
       numInstsInROB(0),
-      numThreads(params->numThreads)
+      numThreads(params->numThreads),
+      stats(_cpu)
 {
     //Figure out rob policy
     if (robPolicy == SMTQueuePolicy::Dynamic) {
@@ -204,7 +205,7 @@ ROB<Impl>::insertInst(const DynInstPtr &inst)
 {
     assert(inst);
 
-    robWrites++;
+    stats.writes++;
 
     DPRINTF(ROB, "Adding inst PC %s to the ROB.\n", inst->pcState());
 
@@ -239,7 +240,7 @@ template <class Impl>
 void
 ROB<Impl>::retireHead(ThreadID tid)
 {
-    robWrites++;
+    stats.writes++;
 
     assert(numInstsInROB > 0);
 
@@ -274,7 +275,7 @@ template <class Impl>
 bool
 ROB<Impl>::isHeadReady(ThreadID tid)
 {
-    robReads++;
+    stats.reads++;
     if (threadEntries[tid] != 0) {
         return instList[tid].front()->readyToCommit();
     }
@@ -319,7 +320,7 @@ template <class Impl>
 void
 ROB<Impl>::doSquash(ThreadID tid)
 {
-    robWrites++;
+    stats.writes++;
     DPRINTF(ROB, "[tid:%i] Squashing instructions until [sn:%llu].\n",
             tid, squashedSeqNum[tid]);
 
@@ -528,17 +529,11 @@ ROB<Impl>::readTailInst(ThreadID tid)
 }
 
 template <class Impl>
-void
-ROB<Impl>::regStats()
+ROB<Impl>::ROBStats::ROBStats(Stats::Group *parent)
+    : Stats::Group(parent, "rob"),
+      ADD_STAT(reads, "The number of ROB reads"),
+      ADD_STAT(writes, "The number of ROB writes")
 {
-    using namespace Stats;
-    robReads
-        .name(name() + ".rob_reads")
-        .desc("The number of ROB reads");
-
-    robWrites
-        .name(name() + ".rob_writes")
-        .desc("The number of ROB writes");
 }
 
 template <class Impl>