restrictAllocation(p->restrictAllocation),
initialLoopIter(p->initialLoopIter),
initialLoopAge(p->initialLoopAge),
- optionalAgeReset(p->optionalAgeReset)
+ optionalAgeReset(p->optionalAgeReset),
+ stats(this)
{
assert(initialLoopAge <= ((1 << loopTableAgeBits) - 1));
}
LoopPredictor::updateStats(bool taken, BranchInfo* bi)
{
if (taken == bi->loopPred) {
- loopPredictorCorrect++;
+ stats.correct++;
} else {
- loopPredictorWrong++;
+ stats.wrong++;
}
}
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
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
*/
void init() override;
- /**
- * Register stats for this object
- */
- void regStats() override;
-
LoopPredictor(LoopPredictorParams *p);
size_t getSizeInBits() const;