cpu-o3: Copy O3 IEW stats to BaseCPU::ExecuteCPUStats
Move 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: Ibe4c121ac1e04f1c989d4786a52acd5878a43df0 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69103 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu> Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
This commit is contained in:
committed by
Bobby Bruce
parent
53a12bc8ad
commit
1d035e1e20
@@ -203,7 +203,12 @@ BaseCPU::BaseCPU(const Params &p, bool is_checker)
|
||||
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);
|
||||
commitStatptr->ipc = commitStatptr->numInsts / baseStats.numCycles;
|
||||
@@ -899,6 +904,19 @@ FetchCPUStats::FetchCPUStats(statistics::Group *parent, int thread_id)
|
||||
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(),
|
||||
@@ -937,6 +955,8 @@ ExecuteCPUStats::ExecuteCPUStats(statistics::Group *parent, int thread_id)
|
||||
"Number of ops (including micro ops) which were discarded before "
|
||||
"commit")
|
||||
{
|
||||
numStoreInsts = numMemRefs - numLoadInsts;
|
||||
|
||||
dcacheStallCycles
|
||||
.prereq(dcacheStallCycles);
|
||||
numCCRegReads
|
||||
|
||||
@@ -717,6 +717,19 @@ class BaseCPU : public ClockedObject
|
||||
{
|
||||
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;
|
||||
|
||||
|
||||
@@ -1053,7 +1053,9 @@ IEW::dispatchInsts(ThreadID tid)
|
||||
|
||||
instQueue.recordProducer(inst);
|
||||
|
||||
// update both old and new stats
|
||||
iewStats.executedInstStats.numNop[tid]++;
|
||||
cpu->executeStats[tid]->numNop++;
|
||||
|
||||
add_to_iq = false;
|
||||
} else {
|
||||
@@ -1561,7 +1563,9 @@ IEW::updateExeInstStats(const DynInstPtr& inst)
|
||||
{
|
||||
ThreadID tid = inst->threadNumber;
|
||||
|
||||
// update both old and new stats
|
||||
iewStats.executedInstStats.numInsts++;
|
||||
cpu->executeStats[tid]->numInsts++;
|
||||
|
||||
#if TRACING_ON
|
||||
if (debug::O3PipeView) {
|
||||
@@ -1572,17 +1576,24 @@ IEW::updateExeInstStats(const DynInstPtr& inst)
|
||||
//
|
||||
// Control operations
|
||||
//
|
||||
if (inst->isControl())
|
||||
if (inst->isControl()) {
|
||||
// update both old and new stats
|
||||
iewStats.executedInstStats.numBranches[tid]++;
|
||||
cpu->executeStats[tid]->numBranches++;
|
||||
}
|
||||
|
||||
//
|
||||
// Memory operations
|
||||
//
|
||||
if (inst->isMemRef()) {
|
||||
// update both old and new stats
|
||||
iewStats.executedInstStats.numRefs[tid]++;
|
||||
cpu->executeStats[tid]->numMemRefs++;
|
||||
|
||||
if (inst->isLoad()) {
|
||||
// update both old and new stats
|
||||
iewStats.executedInstStats.numLoadInsts[tid]++;
|
||||
cpu->executeStats[tid]->numLoadInsts++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user