Hoa Nguyen has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/36075 )
Change subject: cpu-minor,stats: Update stats style of MinorCPU
......................................................................
cpu-minor,stats: Update stats style of MinorCPU
Change-Id: Id14e6816cc82603459bf68461ae40bf2b63080eb
Signed-off-by: Hoa Nguyen <hoangu...@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/36075
Reviewed-by: Daniel Carvalho <oda...@yahoo.com.br>
Maintainer: Giacomo Travaglini <giacomo.travagl...@arm.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/cpu/minor/cpu.cc
M src/cpu/minor/stats.cc
M src/cpu/minor/stats.hh
3 files changed, 26 insertions(+), 49 deletions(-)
Approvals:
Daniel Carvalho: Looks good to me, approved
Giacomo Travaglini: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/cpu/minor/cpu.cc b/src/cpu/minor/cpu.cc
index de74256..0af81c5 100644
--- a/src/cpu/minor/cpu.cc
+++ b/src/cpu/minor/cpu.cc
@@ -47,7 +47,8 @@
MinorCPU::MinorCPU(const MinorCPUParams ¶ms) :
BaseCPU(params),
- threadPolicy(params.threadPolicy)
+ threadPolicy(params.threadPolicy),
+ stats(this)
{
/* This is only written for one thread at the moment */
Minor::MinorThread *thread;
@@ -118,7 +119,6 @@
MinorCPU::regStats()
{
BaseCPU::regStats();
- stats.regStats(name(), *this);
pipeline->regStats();
}
diff --git a/src/cpu/minor/stats.cc b/src/cpu/minor/stats.cc
index 5de820d..b43a4a1 100644
--- a/src/cpu/minor/stats.cc
+++ b/src/cpu/minor/stats.cc
@@ -40,51 +40,32 @@
namespace Minor
{
-MinorStats::MinorStats()
-{ }
-
-void
-MinorStats::regStats(const std::string &name, BaseCPU &baseCpu)
+MinorStats::MinorStats(BaseCPU *base_cpu)
+ : Stats::Group(base_cpu),
+ ADD_STAT(numInsts, "Number of instructions committed"),
+ ADD_STAT(numOps, "Number of ops (including micro ops) committed"),
+ ADD_STAT(numDiscardedOps,
+ "Number of ops (including micro ops) which were discarded
before "
+ "commit"),
+ ADD_STAT(numFetchSuspends,
+ "Number of times Execute suspended instruction fetching"),
+ ADD_STAT(quiesceCycles,
+ "Total number of cycles that CPU has spent quiesced or
waiting "
+ "for an interrupt"),
+ ADD_STAT(cpi, "CPI: cycles per instruction"),
+ ADD_STAT(ipc, "IPC: instructions per cycle"),
+ ADD_STAT(committedInstType, "Class of committed instruction")
{
- numInsts
- .name(name + ".committedInsts")
- .desc("Number of instructions committed");
+ quiesceCycles.prereq(quiesceCycles);
- numOps
- .name(name + ".committedOps")
- .desc("Number of ops (including micro ops) committed");
+ cpi.precision(6);
+ cpi = base_cpu->numCycles / numInsts;
- numDiscardedOps
- .name(name + ".discardedOps")
- .desc("Number of ops (including micro ops) which were discarded "
- "before commit");
-
- numFetchSuspends
- .name(name + ".numFetchSuspends")
- .desc("Number of times Execute suspended instruction fetching");
-
- quiesceCycles
- .name(name + ".quiesceCycles")
- .desc("Total number of cycles that CPU has spent quiesced or
waiting "
- "for an interrupt")
- .prereq(quiesceCycles);
-
- cpi
- .name(name + ".cpi")
- .desc("CPI: cycles per instruction")
- .precision(6);
- cpi = baseCpu.numCycles / numInsts;
-
- ipc
- .name(name + ".ipc")
- .desc("IPC: instructions per cycle")
- .precision(6);
- ipc = numInsts / baseCpu.numCycles;
+ ipc.precision(6);
+ ipc = numInsts / base_cpu->numCycles;
committedInstType
- .init(baseCpu.numThreads, Enums::Num_OpClass)
- .name(name + ".op_class")
- .desc("Class of committed instruction")
+ .init(base_cpu->numThreads, Enums::Num_OpClass)
.flags(Stats::total | Stats::pdf | Stats::dist);
committedInstType.ysubnames(Enums::OpClassStrings);
}
diff --git a/src/cpu/minor/stats.hh b/src/cpu/minor/stats.hh
index 3ee678a..e42b56f 100644
--- a/src/cpu/minor/stats.hh
+++ b/src/cpu/minor/stats.hh
@@ -52,9 +52,10 @@
{
/** Currently unused stats class. */
-class MinorStats
+struct MinorStats : public Stats::Group
{
- public:
+ MinorStats(BaseCPU *parent);
+
/** Number of simulated instructions */
Stats::Scalar numInsts;
@@ -77,11 +78,6 @@
/** Number of instructions by type (OpClass) */
Stats::Vector2d committedInstType;
- public:
- MinorStats();
-
- public:
- void regStats(const std::string &name, BaseCPU &baseCpu);
};
}
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/36075
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: Id14e6816cc82603459bf68461ae40bf2b63080eb
Gerrit-Change-Number: 36075
Gerrit-PatchSet: 13
Gerrit-Owner: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-Reviewer: ZHENGRONG WANG <seanyukig...@gmail.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-CC: Ayaz Akram <yazak...@ucdavis.edu>
Gerrit-CC: Jason Lowe-Power <power...@gmail.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s