Bobby Bruce has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/67395?usp=email )
Change subject: cpu-o3: Move O3 IEW stats to BaseCPU::ExecuteCPUStats
......................................................................
cpu-o3: Move O3 IEW stats to BaseCPU::ExecuteCPUStats
Moved numInsts, numBranches, numNop, numRefs, numLoadInsts, numRate to
Base. Merged numRefs into numMemRefs of ExecuteCPUStats. Renamed
numRate to instRate. Updated formatting in ExecuteCPUStats group.
Change-Id: I1fd3a989d917eb2ffaa865b067b80e266d6f55bc
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67395
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Bobby Bruce <bbr...@ucdavis.edu>
Maintainer: Bobby Bruce <bbr...@ucdavis.edu>
---
M src/cpu/base.cc
M src/cpu/base.hh
M src/cpu/o3/iew.cc
M src/cpu/o3/iew.hh
4 files changed, 55 insertions(+), 75 deletions(-)
Approvals:
Bobby Bruce: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/cpu/base.cc b/src/cpu/base.cc
index 490e489..cee7647 100644
--- a/src/cpu/base.cc
+++ b/src/cpu/base.cc
@@ -203,7 +203,11 @@
baseStats.numCycles;
fetchStats.emplace_back(fetchStatptr);
- executeStats.emplace_back(new ExecuteCPUStats(this, i));
+ // create executeStat object for thread i and set rate formulas
+ ExecuteCPUStats* executeStatptr = new ExecuteCPUStats(this, i);
+ executeStatptr->instRate = executeStatptr->numInsts /
+ baseStats.numCycles;
+ executeStats.emplace_back(executeStatptr);
// create commitStat object for thread i and set ipc, cpi formulas
CommitCPUStats* commitStatptr = new CommitCPUStats(this, i);
@@ -900,6 +904,19 @@
BaseCPU::
ExecuteCPUStats::ExecuteCPUStats(statistics::Group *parent, int thread_id)
: statistics::Group(parent, csprintf("executeStats%i",
thread_id).c_str()),
+ ADD_STAT(numInsts, statistics::units::Count::get(),
+ "Number of executed instructions"),
+ ADD_STAT(numNop, statistics::units::Count::get(),
+ "Number of nop insts executed"),
+ ADD_STAT(numBranches, statistics::units::Count::get(),
+ "Number of branches executed"),
+ ADD_STAT(numLoadInsts, statistics::units::Count::get(),
+ "Number of load instructions executed"),
+ ADD_STAT(numStoreInsts, statistics::units::Count::get(),
+ "Number of stores executed"),
+ ADD_STAT(instRate, statistics::units::Rate<
+ statistics::units::Count, statistics::units::Cycle>::get(),
+ "Inst execution rate"),
ADD_STAT(dcacheStallCycles, statistics::units::Cycle::get(),
"DCache total stall cycles"),
ADD_STAT(numCCRegReads, statistics::units::Count::get(),
@@ -938,36 +955,38 @@
"Number of ops (including micro ops) which were discarded
before "
"commit")
{
+ numStoreInsts = numMemRefs - numLoadInsts;
+
dcacheStallCycles
- .prereq(dcacheStallCycles);
+ .prereq(dcacheStallCycles);
numCCRegReads
- .prereq(numCCRegReads)
- .flags(statistics::nozero);
+ .prereq(numCCRegReads)
+ .flags(statistics::nozero);
numCCRegWrites
- .prereq(numCCRegWrites)
- .flags(statistics::nozero);
+ .prereq(numCCRegWrites)
+ .flags(statistics::nozero);
numFpAluAccesses
- .prereq(numFpAluAccesses);
+ .prereq(numFpAluAccesses);
numFpRegReads
- .prereq(numFpRegReads);
+ .prereq(numFpRegReads);
numIntAluAccesses
- .prereq(numIntAluAccesses);
+ .prereq(numIntAluAccesses);
numIntRegReads
- .prereq(numIntRegReads);
+ .prereq(numIntRegReads);
numIntRegWrites
- .prereq(numIntRegWrites);
+ .prereq(numIntRegWrites);
numMiscRegReads
- .prereq(numMiscRegReads);
+ .prereq(numMiscRegReads);
numMiscRegWrites
- .prereq(numMiscRegWrites);
+ .prereq(numMiscRegWrites);
numVecPredRegReads
- .prereq(numVecPredRegReads);
+ .prereq(numVecPredRegReads);
numVecPredRegWrites
- .prereq(numVecPredRegWrites);
+ .prereq(numVecPredRegWrites);
numVecRegReads
- .prereq(numVecRegReads);
+ .prereq(numVecRegReads);
numVecRegWrites
- .prereq(numVecRegWrites);
+ .prereq(numVecRegWrites);
}
BaseCPU::
diff --git a/src/cpu/base.hh b/src/cpu/base.hh
index 5d0d3ca..fc22abc 100644
--- a/src/cpu/base.hh
+++ b/src/cpu/base.hh
@@ -716,6 +716,19 @@
{
ExecuteCPUStats(statistics::Group *parent, int thread_id);
+ /* Stat for total number of executed instructions */
+ statistics::Scalar numInsts;
+ /* Number of executed nops */
+ statistics::Scalar numNop;
+ /* Number of executed branches */
+ statistics::Scalar numBranches;
+ /* Stat for total number of executed load instructions */
+ statistics::Scalar numLoadInsts;
+ /* Number of executed store instructions */
+ statistics::Formula numStoreInsts;
+ /* Number of instructions executed per cycle */
+ statistics::Formula instRate;
+
/* Number of cycles stalled for D-cache responses */
statistics::Scalar dcacheStallCycles;
diff --git a/src/cpu/o3/iew.cc b/src/cpu/o3/iew.cc
index 7cf6c54..92d281c 100644
--- a/src/cpu/o3/iew.cc
+++ b/src/cpu/o3/iew.cc
@@ -217,52 +217,14 @@
IEW::IEWStats::ExecutedInstStats::ExecutedInstStats(CPU *cpu)
: statistics::Group(cpu),
- ADD_STAT(numInsts, statistics::units::Count::get(),
- "Number of executed instructions"),
- ADD_STAT(numLoadInsts, statistics::units::Count::get(),
- "Number of load instructions executed"),
ADD_STAT(numSquashedInsts, statistics::units::Count::get(),
"Number of squashed instructions skipped in execute"),
ADD_STAT(numSwp, statistics::units::Count::get(),
- "Number of swp insts executed"),
- ADD_STAT(numNop, statistics::units::Count::get(),
- "Number of nop insts executed"),
- ADD_STAT(numRefs, statistics::units::Count::get(),
- "Number of memory reference insts executed"),
- ADD_STAT(numBranches, statistics::units::Count::get(),
- "Number of branches executed"),
- ADD_STAT(numStoreInsts, statistics::units::Count::get(),
- "Number of stores executed"),
- ADD_STAT(numRate, statistics::units::Rate<
- statistics::units::Count, statistics::units::Cycle>::get(),
- "Inst execution rate", numInsts / cpu->baseStats.numCycles)
+ "Number of swp insts executed")
{
- numLoadInsts
- .init(cpu->numThreads)
- .flags(statistics::total);
-
numSwp
.init(cpu->numThreads)
.flags(statistics::total);
-
- numNop
- .init(cpu->numThreads)
- .flags(statistics::total);
-
- numRefs
- .init(cpu->numThreads)
- .flags(statistics::total);
-
- numBranches
- .init(cpu->numThreads)
- .flags(statistics::total);
-
- numStoreInsts
- .flags(statistics::total);
- numStoreInsts = numRefs - numLoadInsts;
-
- numRate
- .flags(statistics::total);
}
void
@@ -1053,7 +1015,7 @@
instQueue.recordProducer(inst);
- iewStats.executedInstStats.numNop[tid]++;
+ cpu->executeStats[tid]->numNop++;
add_to_iq = false;
} else {
@@ -1561,7 +1523,7 @@
{
ThreadID tid = inst->threadNumber;
- iewStats.executedInstStats.numInsts++;
+ cpu->executeStats[tid]->numInsts++;
#if TRACING_ON
if (debug::O3PipeView) {
@@ -1573,16 +1535,16 @@
// Control operations
//
if (inst->isControl())
- iewStats.executedInstStats.numBranches[tid]++;
+ cpu->executeStats[tid]->numBranches++;
//
// Memory operations
//
if (inst->isMemRef()) {
- iewStats.executedInstStats.numRefs[tid]++;
+ cpu->executeStats[tid]->numMemRefs++;
if (inst->isLoad()) {
- iewStats.executedInstStats.numLoadInsts[tid]++;
+ cpu->executeStats[tid]->numLoadInsts++;
}
}
}
diff --git a/src/cpu/o3/iew.hh b/src/cpu/o3/iew.hh
index 80fed29..4fe8227 100644
--- a/src/cpu/o3/iew.hh
+++ b/src/cpu/o3/iew.hh
@@ -455,25 +455,11 @@
{
ExecutedInstStats(CPU *cpu);
- /** Stat for total number of executed instructions. */
- statistics::Scalar numInsts;
- /** Stat for total number of executed load instructions. */
- statistics::Vector numLoadInsts;
/** Stat for total number of squashed instructions skipped at
* execute. */
statistics::Scalar numSquashedInsts;
/** Number of executed software prefetches. */
statistics::Vector numSwp;
- /** Number of executed nops. */
- statistics::Vector numNop;
- /** Number of executed meomory references. */
- statistics::Vector numRefs;
- /** Number of executed branches. */
- statistics::Vector numBranches;
- /** Number of executed store instructions. */
- statistics::Formula numStoreInsts;
- /** Number of instructions executed per cycle. */
- statistics::Formula numRate;
} executedInstStats;
/** Number of instructions sent to commit. */
--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/67395?usp=email
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: I1fd3a989d917eb2ffaa865b067b80e266d6f55bc
Gerrit-Change-Number: 67395
Gerrit-PatchSet: 6
Gerrit-Owner: Melissa Jost <melissakj...@gmail.com>
Gerrit-Reviewer: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org