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+kokoro@google.com>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
This commit is contained in:
Melissa Jost
2023-03-13 10:55:55 -07:00
committed by Bobby Bruce
parent 2f93672bdd
commit 4b70c1cacc
4 changed files with 20 additions and 1 deletions

View File

@@ -954,6 +954,10 @@ CommitCPUStats::CommitCPUStats(statistics::Group *parent, int thread_id)
"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)"),

View File

@@ -759,6 +759,10 @@ class BaseCPU : public ClockedObject
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;

View File

@@ -1383,9 +1383,16 @@ Commit::updateComInstStats(const DynInstPtr &inst)
{
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.

View File

@@ -1353,16 +1353,20 @@ CPU::instDone(ThreadID tid, const DynInstPtr &inst)
{
// 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());
}