cpu: Revert CPU stats changes
This reverts this relationchain: https://gem5-review.googlesource.com/c/public/gem5/+/67396/6 This was pre-maturely submitted before all testing and checking was done. To be safe this has been reverted. When all testing and checks are completed, this revert will be undone. Change-Id: I2a88cadfee03c1fc81932e6548938db108786dd2 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/68717 Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Bobby Bruce <bbruce@ucdavis.edu> Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Bobby Bruce
parent
18ba4e1278
commit
85342dbb0e
250
src/cpu/base.cc
250
src/cpu/base.cc
@@ -191,30 +191,6 @@ BaseCPU::BaseCPU(const Params &p, bool is_checker)
|
||||
modelResetPort.onChange([this](const bool &new_val) {
|
||||
setReset(new_val);
|
||||
});
|
||||
// create a stat group object for each thread on this core
|
||||
fetchStats.reserve(numThreads);
|
||||
executeStats.reserve(numThreads);
|
||||
commitStats.reserve(numThreads);
|
||||
for (int i = 0; i < numThreads; i++) {
|
||||
// create fetchStat object for thread i and set rate formulas
|
||||
FetchCPUStats* fetchStatptr = new FetchCPUStats(this, i);
|
||||
fetchStatptr->fetchRate = fetchStatptr->numInsts / baseStats.numCycles;
|
||||
fetchStatptr->branchRate = fetchStatptr->numBranches /
|
||||
baseStats.numCycles;
|
||||
fetchStats.emplace_back(fetchStatptr);
|
||||
|
||||
// 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);
|
||||
commitStatptr->ipc = commitStatptr->numInsts / baseStats.numCycles;
|
||||
commitStatptr->cpi = baseStats.numCycles / commitStatptr->numInsts;
|
||||
commitStats.emplace_back(commitStatptr);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -407,28 +383,13 @@ BaseCPU::probeInstCommit(const StaticInstPtr &inst, Addr pc)
|
||||
BaseCPU::
|
||||
BaseCPUStats::BaseCPUStats(statistics::Group *parent)
|
||||
: statistics::Group(parent),
|
||||
ADD_STAT(numInsts, statistics::units::Count::get(),
|
||||
"Number of instructions committed (core level)"),
|
||||
ADD_STAT(numOps, statistics::units::Count::get(),
|
||||
"Number of ops (including micro ops) committed (core level)"),
|
||||
ADD_STAT(numCycles, statistics::units::Cycle::get(),
|
||||
"Number of cpu cycles simulated"),
|
||||
ADD_STAT(cpi, statistics::units::Rate<
|
||||
statistics::units::Cycle, statistics::units::Count>::get(),
|
||||
"CPI: cycles per instruction (core level)"),
|
||||
ADD_STAT(ipc, statistics::units::Rate<
|
||||
statistics::units::Count, statistics::units::Cycle>::get(),
|
||||
"IPC: instructions per cycle (core level)"),
|
||||
ADD_STAT(numWorkItemsStarted, statistics::units::Count::get(),
|
||||
"Number of work items this cpu started"),
|
||||
ADD_STAT(numWorkItemsCompleted, statistics::units::Count::get(),
|
||||
"Number of work items this cpu completed")
|
||||
{
|
||||
cpi.precision(6);
|
||||
cpi = numCycles / numInsts;
|
||||
|
||||
ipc.precision(6);
|
||||
ipc = numInsts / numCycles;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -866,215 +827,4 @@ BaseCPU::GlobalStats::GlobalStats(statistics::Group *parent)
|
||||
hostOpRate = simOps / hostSeconds;
|
||||
}
|
||||
|
||||
BaseCPU::
|
||||
FetchCPUStats::FetchCPUStats(statistics::Group *parent, int thread_id)
|
||||
: statistics::Group(parent, csprintf("fetchStats%i", thread_id).c_str()),
|
||||
ADD_STAT(numInsts, statistics::units::Count::get(),
|
||||
"Number of instructions fetched (thread level)"),
|
||||
ADD_STAT(numOps, statistics::units::Count::get(),
|
||||
"Number of ops (including micro ops) fetched (thread level)"),
|
||||
ADD_STAT(fetchRate, statistics::units::Rate<
|
||||
statistics::units::Count, statistics::units::Cycle>::get(),
|
||||
"Number of inst fetches per cycle"),
|
||||
ADD_STAT(numBranches, statistics::units::Count::get(),
|
||||
"Number of branches fetched"),
|
||||
ADD_STAT(branchRate, statistics::units::Ratio::get(),
|
||||
"Number of branch fetches per cycle"),
|
||||
ADD_STAT(icacheStallCycles, statistics::units::Cycle::get(),
|
||||
"ICache total stall cycles"),
|
||||
ADD_STAT(numFetchSuspends, statistics::units::Count::get(),
|
||||
"Number of times Execute suspended instruction fetching")
|
||||
|
||||
{
|
||||
fetchRate
|
||||
.flags(statistics::total);
|
||||
|
||||
numBranches
|
||||
.prereq(numBranches);
|
||||
|
||||
branchRate
|
||||
.flags(statistics::total);
|
||||
|
||||
icacheStallCycles
|
||||
.prereq(icacheStallCycles);
|
||||
|
||||
}
|
||||
|
||||
// means it is incremented in a vector indexing and not directly
|
||||
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(),
|
||||
"Number of times the CC registers were read"),
|
||||
ADD_STAT(numCCRegWrites, statistics::units::Count::get(),
|
||||
"Number of times the CC registers were written"),
|
||||
ADD_STAT(numFpAluAccesses, statistics::units::Count::get(),
|
||||
"Number of float alu accesses"),
|
||||
ADD_STAT(numFpRegReads, statistics::units::Count::get(),
|
||||
"Number of times the floating registers were read"),
|
||||
ADD_STAT(numFpRegWrites, statistics::units::Count::get(),
|
||||
"Number of times the floating registers were written"),
|
||||
ADD_STAT(numIntAluAccesses, statistics::units::Count::get(),
|
||||
"Number of integer alu accesses"),
|
||||
ADD_STAT(numIntRegReads, statistics::units::Count::get(),
|
||||
"Number of times the integer registers were read"),
|
||||
ADD_STAT(numIntRegWrites, statistics::units::Count::get(),
|
||||
"Number of times the integer registers were written"),
|
||||
ADD_STAT(numMemRefs, statistics::units::Count::get(),
|
||||
"Number of memory refs"),
|
||||
ADD_STAT(numMiscRegReads, statistics::units::Count::get(),
|
||||
"Number of times the Misc registers were read"),
|
||||
ADD_STAT(numMiscRegWrites, statistics::units::Count::get(),
|
||||
"Number of times the Misc registers were written"),
|
||||
ADD_STAT(numVecAluAccesses, statistics::units::Count::get(),
|
||||
"Number of vector alu accesses"),
|
||||
ADD_STAT(numVecPredRegReads, statistics::units::Count::get(),
|
||||
"Number of times the predicate registers were read"),
|
||||
ADD_STAT(numVecPredRegWrites, statistics::units::Count::get(),
|
||||
"Number of times the predicate registers were written"),
|
||||
ADD_STAT(numVecRegReads, statistics::units::Count::get(),
|
||||
"Number of times the vector registers were read"),
|
||||
ADD_STAT(numVecRegWrites, statistics::units::Count::get(),
|
||||
"Number of times the vector registers were written"),
|
||||
ADD_STAT(numDiscardedOps, statistics::units::Count::get(),
|
||||
"Number of ops (including micro ops) which were discarded before "
|
||||
"commit")
|
||||
{
|
||||
numStoreInsts = numMemRefs - numLoadInsts;
|
||||
|
||||
dcacheStallCycles
|
||||
.prereq(dcacheStallCycles);
|
||||
numCCRegReads
|
||||
.prereq(numCCRegReads)
|
||||
.flags(statistics::nozero);
|
||||
numCCRegWrites
|
||||
.prereq(numCCRegWrites)
|
||||
.flags(statistics::nozero);
|
||||
numFpAluAccesses
|
||||
.prereq(numFpAluAccesses);
|
||||
numFpRegReads
|
||||
.prereq(numFpRegReads);
|
||||
numIntAluAccesses
|
||||
.prereq(numIntAluAccesses);
|
||||
numIntRegReads
|
||||
.prereq(numIntRegReads);
|
||||
numIntRegWrites
|
||||
.prereq(numIntRegWrites);
|
||||
numMiscRegReads
|
||||
.prereq(numMiscRegReads);
|
||||
numMiscRegWrites
|
||||
.prereq(numMiscRegWrites);
|
||||
numVecPredRegReads
|
||||
.prereq(numVecPredRegReads);
|
||||
numVecPredRegWrites
|
||||
.prereq(numVecPredRegWrites);
|
||||
numVecRegReads
|
||||
.prereq(numVecRegReads);
|
||||
numVecRegWrites
|
||||
.prereq(numVecRegWrites);
|
||||
}
|
||||
|
||||
BaseCPU::
|
||||
CommitCPUStats::CommitCPUStats(statistics::Group *parent, int thread_id)
|
||||
: statistics::Group(parent, csprintf("commitStats%i", thread_id).c_str()),
|
||||
ADD_STAT(numInsts, statistics::units::Count::get(),
|
||||
"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)"),
|
||||
ADD_STAT(ipc, statistics::units::Rate<
|
||||
statistics::units::Count, statistics::units::Cycle>::get(),
|
||||
"IPC: instructions per cycle (thread level)"),
|
||||
ADD_STAT(numMemRefs, statistics::units::Count::get(),
|
||||
"Number of memory references committed"),
|
||||
ADD_STAT(numFpInsts, statistics::units::Count::get(),
|
||||
"Number of float instructions"),
|
||||
ADD_STAT(numIntInsts, statistics::units::Count::get(),
|
||||
"Number of integer instructions"),
|
||||
ADD_STAT(numLoadInsts, statistics::units::Count::get(),
|
||||
"Number of load instructions"),
|
||||
ADD_STAT(numStoreInsts, statistics::units::Count::get(),
|
||||
"Number of store instructions"),
|
||||
ADD_STAT(numVecInsts, statistics::units::Count::get(),
|
||||
"Number of vector instructions"),
|
||||
ADD_STAT(committedInstType, statistics::units::Count::get(),
|
||||
"Class of committed instruction."),
|
||||
ADD_STAT(committedControl, statistics::units::Count::get(),
|
||||
"Class of control type instructions committed")
|
||||
{
|
||||
numInsts
|
||||
.prereq(numInsts);
|
||||
|
||||
cpi.precision(6);
|
||||
ipc.precision(6);
|
||||
|
||||
committedInstType
|
||||
.init(enums::Num_OpClass)
|
||||
.flags(statistics::total | statistics::pdf | statistics::dist);
|
||||
|
||||
for (unsigned i = 0; i < Num_OpClasses; ++i) {
|
||||
committedInstType.subname(i, enums::OpClassStrings[i]);
|
||||
}
|
||||
|
||||
committedControl
|
||||
.init(StaticInstFlags::Flags::Num_Flags)
|
||||
.flags(statistics::nozero);
|
||||
|
||||
for (unsigned i = 0; i < StaticInstFlags::Flags::Num_Flags; i++) {
|
||||
committedControl.subname(i, StaticInstFlags::FlagsStrings[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BaseCPU::
|
||||
CommitCPUStats::updateComCtrlStats(const StaticInstPtr staticInst)
|
||||
{
|
||||
/* Add a count for every control instruction type */
|
||||
if (staticInst->isControl()) {
|
||||
if (staticInst->isReturn()) {
|
||||
committedControl[gem5::StaticInstFlags::Flags::IsReturn]++;
|
||||
}
|
||||
if (staticInst->isCall()) {
|
||||
committedControl[gem5::StaticInstFlags::Flags::IsCall]++;
|
||||
}
|
||||
if (staticInst->isDirectCtrl()) {
|
||||
committedControl[gem5::StaticInstFlags::Flags::IsDirectControl]++;
|
||||
}
|
||||
if (staticInst->isIndirectCtrl()) {
|
||||
committedControl
|
||||
[gem5::StaticInstFlags::Flags::IsIndirectControl]++;
|
||||
}
|
||||
if (staticInst->isCondCtrl()) {
|
||||
committedControl[gem5::StaticInstFlags::Flags::IsCondControl]++;
|
||||
}
|
||||
if (staticInst->isUncondCtrl()) {
|
||||
committedControl[gem5::StaticInstFlags::Flags::IsUncondControl]++;
|
||||
}
|
||||
committedControl[gem5::StaticInstFlags::Flags::IsControl]++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // namespace gem5
|
||||
|
||||
Reference in New Issue
Block a user