Bobby Bruce has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/69101?usp=email )

Change subject: cpu-o3: Use base instructions committed counters in O3CPU
......................................................................

cpu-o3: Use base instructions committed counters in O3CPU

Copied committedInsts from O3 cpu to BaseCPU as numInstsNotNOP because
it tracks the instructions committed that are not NOPs or prefetches.
This change also does the same for commitedOps. InstsCommitted from O3
is duplicated by CommitCPUStats::numInsts.  The same thing has been done
with opsCommitted.

Change-Id: If24d22fee552c65fc0c63dfad90fc59b17100f34
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69101
Tested-by: kokoro <noreply+kok...@google.com>
Maintainer: Bobby Bruce <bbr...@ucdavis.edu>
Reviewed-by: Bobby Bruce <bbr...@ucdavis.edu>
---
M src/cpu/base.cc
M src/cpu/base.hh
M src/cpu/o3/commit.cc
M src/cpu/o3/cpu.cc
4 files changed, 20 insertions(+), 1 deletion(-)

Approvals:
  kokoro: Regressions pass
  Bobby Bruce: Looks good to me, approved; Looks good to me, approved




diff --git a/src/cpu/base.cc b/src/cpu/base.cc
index d7dda13..801a95b 100644
--- a/src/cpu/base.cc
+++ b/src/cpu/base.cc
@@ -954,6 +954,10 @@
              "Number of instructions committed (thread level)"),
     ADD_STAT(numOps, statistics::units::Count::get(),
"Number of ops (including micro ops) committed (thread level)"),
+    ADD_STAT(numInstsNotNOP, statistics::units::Count::get(),
+ "Number of instructions committed excluding NOPs or prefetches"),
+    ADD_STAT(numOpsNotNOP, statistics::units::Count::get(),
+             "Number of Ops (including micro ops) Simulated"),
     ADD_STAT(cpi, statistics::units::Rate<
                 statistics::units::Cycle, statistics::units::Count>::get(),
              "CPI: cycles per instruction (thread level)"),
diff --git a/src/cpu/base.hh b/src/cpu/base.hh
index 5e2432f..f173967 100644
--- a/src/cpu/base.hh
+++ b/src/cpu/base.hh
@@ -759,6 +759,10 @@
         statistics::Scalar numInsts;
         statistics::Scalar numOps;

+ /* Number of instructions committed that are not NOP or prefetches */
+        statistics::Scalar numInstsNotNOP;
+        statistics::Scalar numOpsNotNOP;
+
         /* CPI/IPC for total cycle counts and macro insts */
         statistics::Formula cpi;
         statistics::Formula ipc;
diff --git a/src/cpu/o3/commit.cc b/src/cpu/o3/commit.cc
index b3da2d9..63bf7ae 100644
--- a/src/cpu/o3/commit.cc
+++ b/src/cpu/o3/commit.cc
@@ -1383,9 +1383,16 @@
 {
     ThreadID tid = inst->threadNumber;

-    if (!inst->isMicroop() || inst->isLastMicroop())
+    if (!inst->isMicroop() || inst->isLastMicroop()) {
+        // update both old and new stats
         stats.instsCommitted[tid]++;
+        cpu->commitStats[tid]->numInsts++;
+        cpu->baseStats.numInsts++;
+    }
+    // update both old and new stats
     stats.opsCommitted[tid]++;
+    cpu->commitStats[tid]->numOps++;
+    cpu->baseStats.numOps++;

     // To match the old model, don't count nops and instruction
     // prefetches towards the total commit count.
diff --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc
index 6732c43..444692d 100644
--- a/src/cpu/o3/cpu.cc
+++ b/src/cpu/o3/cpu.cc
@@ -1353,16 +1353,20 @@
 {
     // Keep an instruction count.
     if (!inst->isMicroop() || inst->isLastMicroop()) {
+        // update both old and new stats
         thread[tid]->numInst++;
         thread[tid]->threadStats.numInsts++;
         cpuStats.committedInsts[tid]++;
+        commitStats[tid]->numInstsNotNOP++;

         // Check for instruction-count-based events.
         thread[tid]->comInstEventQueue.serviceEvents(thread[tid]->numInst);
     }
+    // update both old and new stats
     thread[tid]->numOp++;
     thread[tid]->threadStats.numOps++;
     cpuStats.committedOps[tid]++;
+    commitStats[tid]->numOpsNotNOP++;

     probeInstCommit(inst->staticInst, inst->pcState().instAddr());
 }

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

Gerrit-MessageType: merged
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: If24d22fee552c65fc0c63dfad90fc59b17100f34
Gerrit-Change-Number: 69101
Gerrit-PatchSet: 9
Gerrit-Owner: Melissa Jost <melissakj...@gmail.com>
Gerrit-Reviewer: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org

Reply via email to