Emily Brickey has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/33935 )
Change subject: cpu: convert loop_predictor to new style stats
......................................................................
cpu: convert loop_predictor to new style stats
Change-Id: Ib0383fc6d5f884fd6c020bcd938eee2f802ad412
---
M src/cpu/pred/loop_predictor.cc
M src/cpu/pred/loop_predictor.hh
2 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/src/cpu/pred/loop_predictor.cc b/src/cpu/pred/loop_predictor.cc
index 4b23fd1..5dad797 100644
--- a/src/cpu/pred/loop_predictor.cc
+++ b/src/cpu/pred/loop_predictor.cc
@@ -57,7 +57,8 @@
restrictAllocation(p->restrictAllocation),
initialLoopIter(p->initialLoopIter),
initialLoopAge(p->initialLoopAge),
- optionalAgeReset(p->optionalAgeReset)
+ optionalAgeReset(p->optionalAgeReset),
+ stats(this)
{
assert(initialLoopAge <= ((1 << loopTableAgeBits) - 1));
}
@@ -314,9 +315,9 @@
LoopPredictor::updateStats(bool taken, BranchInfo* bi)
{
if (taken == bi->loopPred) {
- loopPredictorCorrect++;
+ stats.correct++;
} else {
- loopPredictorWrong++;
+ stats.wrong++;
}
}
@@ -344,18 +345,13 @@
loopUpdate(branch_pc, taken, bi, tage_pred);
}
-void
-LoopPredictor::regStats()
+LoopPredictor::LoopPredictorStats::LoopPredictorStats(Stats::Group *parent)
+ : Stats::Group(parent),
+ ADD_STAT(correct, "Number of times the loop predictor is"
+ " the provider and the prediction is correct"),
+ ADD_STAT(wrong, "Number of times the loop predictor is the"
+ " provider and the prediction is wrong")
{
- loopPredictorCorrect
- .name(name() + ".loopPredictorCorrect")
- .desc("Number of times the loop predictor is the provider and "
- "the prediction is correct");
-
- loopPredictorWrong
- .name(name() + ".loopPredictorWrong")
- .desc("Number of times the loop predictor is the provider and "
- "the prediction is wrong");
}
size_t
diff --git a/src/cpu/pred/loop_predictor.hh b/src/cpu/pred/loop_predictor.hh
index e6af53d..b26bc71 100644
--- a/src/cpu/pred/loop_predictor.hh
+++ b/src/cpu/pred/loop_predictor.hh
@@ -83,9 +83,11 @@
const unsigned initialLoopAge;
const bool optionalAgeReset;
- // stats
- Stats::Scalar loopPredictorCorrect;
- Stats::Scalar loopPredictorWrong;
+ struct LoopPredictorStats : public Stats::Group {
+ LoopPredictorStats(Stats::Group *parent);
+ Stats::Scalar correct;
+ Stats::Scalar wrong;
+ } stats;
/**
* Updates an unsigned counter based on up/down parameter
@@ -250,11 +252,6 @@
*/
void init() override;
- /**
- * Register stats for this object
- */
- void regStats() override;
-
LoopPredictor(LoopPredictorParams *p);
size_t getSizeInBits() const;
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/33935
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: Ib0383fc6d5f884fd6c020bcd938eee2f802ad412
Gerrit-Change-Number: 33935
Gerrit-PatchSet: 1
Gerrit-Owner: Emily Brickey <esbric...@ucdavis.edu>
Gerrit-MessageType: newchange
_______________________________________________
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