From: Emily Brickey Date: Tue, 25 Aug 2020 21:42:27 +0000 (-0700) Subject: cpu-o3: convert rob to new style stats X-Git-Tag: v20.1.0.0~50 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c68bce62a58a185392421a2cf091de9793ea0710;p=gem5.git cpu-o3: convert rob to new style stats Change-Id: I84430d50c49742cd536dd75ce25184c2316dce51 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33398 Reviewed-by: Andreas Sandberg Maintainer: Andreas Sandberg Tested-by: kokoro --- diff --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc index c5b4a825f..bbc6b8209 100644 --- a/src/cpu/o3/cpu.cc +++ b/src/cpu/o3/cpu.cc @@ -443,7 +443,6 @@ FullO3CPU::regStats() this->rename.regStats(); this->iew.regStats(); - this->rob.regStats(); intRegfileReads .name(name() + ".int_regfile_reads") diff --git a/src/cpu/o3/rob.hh b/src/cpu/o3/rob.hh index eb8d1d6b1..4b87dc4d9 100644 --- a/src/cpu/o3/rob.hh +++ b/src/cpu/o3/rob.hh @@ -257,9 +257,6 @@ class ROB */ size_t countInsts(ThreadID tid); - /** Registers statistics. */ - void regStats(); - private: /** Reset the ROB state */ void resetState(); @@ -323,10 +320,15 @@ class ROB /** Number of active threads. */ ThreadID numThreads; - // The number of rob_reads - Stats::Scalar robReads; - // The number of rob_writes - Stats::Scalar robWrites; + + struct ROBStats : public Stats::Group { + ROBStats(Stats::Group *parent); + + // The number of rob_reads + Stats::Scalar reads; + // The number of rob_writes + Stats::Scalar writes; + } stats; }; #endif //__CPU_O3_ROB_HH__ diff --git a/src/cpu/o3/rob_impl.hh b/src/cpu/o3/rob_impl.hh index 80ea1e69b..bfc368bc9 100644 --- a/src/cpu/o3/rob_impl.hh +++ b/src/cpu/o3/rob_impl.hh @@ -58,7 +58,8 @@ ROB::ROB(O3CPU *_cpu, DerivO3CPUParams *params) numEntries(params->numROBEntries), squashWidth(params->squashWidth), numInstsInROB(0), - numThreads(params->numThreads) + numThreads(params->numThreads), + stats(_cpu) { //Figure out rob policy if (robPolicy == SMTQueuePolicy::Dynamic) { @@ -204,7 +205,7 @@ ROB::insertInst(const DynInstPtr &inst) { assert(inst); - robWrites++; + stats.writes++; DPRINTF(ROB, "Adding inst PC %s to the ROB.\n", inst->pcState()); @@ -239,7 +240,7 @@ template void ROB::retireHead(ThreadID tid) { - robWrites++; + stats.writes++; assert(numInstsInROB > 0); @@ -274,7 +275,7 @@ template bool ROB::isHeadReady(ThreadID tid) { - robReads++; + stats.reads++; if (threadEntries[tid] != 0) { return instList[tid].front()->readyToCommit(); } @@ -319,7 +320,7 @@ template void ROB::doSquash(ThreadID tid) { - robWrites++; + stats.writes++; DPRINTF(ROB, "[tid:%i] Squashing instructions until [sn:%llu].\n", tid, squashedSeqNum[tid]); @@ -528,17 +529,11 @@ ROB::readTailInst(ThreadID tid) } template -void -ROB::regStats() +ROB::ROBStats::ROBStats(Stats::Group *parent) + : Stats::Group(parent, "rob"), + ADD_STAT(reads, "The number of ROB reads"), + ADD_STAT(writes, "The number of ROB writes") { - using namespace Stats; - robReads - .name(name() + ".rob_reads") - .desc("The number of ROB reads"); - - robWrites - .name(name() + ".rob_writes") - .desc("The number of ROB writes"); } template