Eden Avivi has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/33402 )

Change subject: cpu-minor: convert fetch2 to new style stats
......................................................................

cpu-minor: convert fetch2 to new style stats

Change-Id: I172b051a19253d842175dad682618419be7f483d
---
M src/cpu/minor/fetch2.cc
M src/cpu/minor/fetch2.hh
2 files changed, 45 insertions(+), 50 deletions(-)



diff --git a/src/cpu/minor/fetch2.cc b/src/cpu/minor/fetch2.cc
index d090edd..bf01068 100644
--- a/src/cpu/minor/fetch2.cc
+++ b/src/cpu/minor/fetch2.cc
@@ -69,7 +69,7 @@
     processMoreThanOneInput(params.fetch2CycleInput),
     branchPredictor(*params.branchPred),
     fetchInfo(params.numThreads),
-    threadPriority(0)
+    threadPriority(0), stats(&cpu_, this)
 {
     if (outputWidth < 1)
fatal("%s: decodeInputWidth must be >= 1 (%d)\n", name, outputWidth);
@@ -413,17 +413,17 @@

                     // Collect some basic inst class stats
                     if (decoded_inst->isLoad())
-                        loadInstructions++;
+                        stats.loadInstructions++;
                     else if (decoded_inst->isStore())
-                        storeInstructions++;
+                        stats.storeInstructions++;
                     else if (decoded_inst->isAtomic())
-                        amoInstructions++;
+                        stats.amoInstructions++;
                     else if (decoded_inst->isVector())
-                        vecInstructions++;
+                        stats.vecInstructions++;
                     else if (decoded_inst->isFloating())
-                        fpInstructions++;
+                        stats.fpInstructions++;
                     else if (decoded_inst->isInteger())
-                        intInstructions++;
+                        stats.intInstructions++;

                     DPRINTF(Fetch, "Instruction extracted from line %s"
                         " lineWidth: %d output_index: %d inputIndex: %d"
@@ -601,42 +601,34 @@
     return (*inp.outputWire).isBubble() &&
            (*predictionOut.inputWire).isBubble();
 }
-
-void
-Fetch2::regStats()
-{
-    using namespace Stats;
-
-    intInstructions
-        .name(name() + ".int_instructions")
-        .desc("Number of integer instructions successfully decoded")
-        .flags(total);
-
-    fpInstructions
-        .name(name() + ".fp_instructions")
-        .desc("Number of floating point instructions successfully decoded")
-        .flags(total);
-
-    vecInstructions
-        .name(name() + ".vec_instructions")
-        .desc("Number of SIMD instructions successfully decoded")
-        .flags(total);
-
-    loadInstructions
-        .name(name() + ".load_instructions")
-        .desc("Number of memory load instructions successfully decoded")
-        .flags(total);
-
-    storeInstructions
-        .name(name() + ".store_instructions")
-        .desc("Number of memory store instructions successfully decoded")
-        .flags(total);
-
-    amoInstructions
-        .name(name() + ".amo_instructions")
-        .desc("Number of memory atomic instructions successfully decoded")
-        .flags(total);
-}
+Fetch2::Fetch2Stats::Fetch2Stats(MinorCPU *cpu, Fetch2 *fetch2)
+      : Stats::Group(cpu, "fetch2"),
+      ADD_STAT(intInstructions,
+       "Number of integer instructions successfully decoded"),
+      ADD_STAT(fpInstructions,
+       "Number of floating point instructions successfully decoded"),
+      ADD_STAT(vecInstructions,
+       "Number of SIMD instructions successfully decoded"),
+      ADD_STAT(loadInstructions,
+       "Number of memory load instructions successfully decoded"),
+      ADD_STAT(storeInstructions,
+       "Number of memory store instructions successfully decoded"),
+      ADD_STAT(amoInstructions,
+       "Number of memory atomic instructions successfully decoded")
+      {
+        intInstructions
+            .flags(Stats::total);
+        fpInstructions
+            .flags(Stats::total);
+        vecInstructions
+            .flags(Stats::total);
+        loadInstructions
+            .flags(Stats::total);
+        storeInstructions
+            .flags(Stats::total);
+        amoInstructions
+            .flags(Stats::total);
+      }

 void
 Fetch2::minorTrace() const
diff --git a/src/cpu/minor/fetch2.hh b/src/cpu/minor/fetch2.hh
index d9726a9..e18b11e 100644
--- a/src/cpu/minor/fetch2.hh
+++ b/src/cpu/minor/fetch2.hh
@@ -163,13 +163,17 @@
     std::vector<Fetch2ThreadInfo> fetchInfo;
     ThreadID threadPriority;

+    struct Fetch2Stats : public Stats::Group
+    {
+        Fetch2Stats(MinorCPU *cpu, Fetch2 *fetch2);
     /** Stats */
-    Stats::Scalar intInstructions;
-    Stats::Scalar fpInstructions;
-    Stats::Scalar vecInstructions;
-    Stats::Scalar loadInstructions;
-    Stats::Scalar storeInstructions;
-    Stats::Scalar amoInstructions;
+        Stats::Scalar intInstructions;
+        Stats::Scalar fpInstructions;
+        Stats::Scalar vecInstructions;
+        Stats::Scalar loadInstructions;
+        Stats::Scalar storeInstructions;
+        Stats::Scalar amoInstructions;
+    } stats;

   protected:
     /** Get a piece of data to work on from the inputBuffer, or 0 if there
@@ -212,7 +216,6 @@

     void minorTrace() const;

-    void regStats();

     /** Is this stage drained?  For Fetch2, draining is initiated by
      *  Execute halting Fetch1 causing Fetch2 to naturally drain.

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/33402
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I172b051a19253d842175dad682618419be7f483d
Gerrit-Change-Number: 33402
Gerrit-PatchSet: 1
Gerrit-Owner: Eden Avivi <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to