cpu: Add Units to cpu stats

Change-Id: I387b2e9f6ecf62757242056f732bd443c457ebea
Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39095
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
This commit is contained in:
Hoa Nguyen
2021-01-14 04:10:48 -08:00
parent c5c0dd9a24
commit 65bbd5fa2a
25 changed files with 506 additions and 387 deletions

View File

@@ -69,19 +69,24 @@ BPredUnit::BPredUnit(const Params &params)
BPredUnit::BPredUnitStats::BPredUnitStats(Stats::Group *parent)
: Stats::Group(parent),
ADD_STAT(lookups, "Number of BP lookups"),
ADD_STAT(condPredicted, "Number of conditional branches predicted"),
ADD_STAT(condIncorrect, "Number of conditional branches incorrect"),
ADD_STAT(BTBLookups, "Number of BTB lookups"),
ADD_STAT(BTBHits, "Number of BTB hits"),
ADD_STAT(BTBHitRatio, "BTB Hit Ratio", BTBHits / BTBLookups),
ADD_STAT(RASUsed, "Number of times the RAS was used to get a target."),
ADD_STAT(RASIncorrect, "Number of incorrect RAS predictions."),
ADD_STAT(indirectLookups, "Number of indirect predictor lookups."),
ADD_STAT(indirectHits, "Number of indirect target hits."),
ADD_STAT(indirectMisses, "Number of indirect misses."),
ADD_STAT(indirectMispredicted, "Number of mispredicted indirect"
" branches.")
ADD_STAT(lookups, UNIT_COUNT, "Number of BP lookups"),
ADD_STAT(condPredicted, UNIT_COUNT,
"Number of conditional branches predicted"),
ADD_STAT(condIncorrect, UNIT_COUNT,
"Number of conditional branches incorrect"),
ADD_STAT(BTBLookups, UNIT_COUNT, "Number of BTB lookups"),
ADD_STAT(BTBHits, UNIT_COUNT, "Number of BTB hits"),
ADD_STAT(BTBHitRatio, UNIT_RATIO, "BTB Hit Ratio", BTBHits / BTBLookups),
ADD_STAT(RASUsed, UNIT_COUNT,
"Number of times the RAS was used to get a target."),
ADD_STAT(RASIncorrect, UNIT_COUNT,
"Number of incorrect RAS predictions."),
ADD_STAT(indirectLookups, UNIT_COUNT,
"Number of indirect predictor lookups."),
ADD_STAT(indirectHits, UNIT_COUNT, "Number of indirect target hits."),
ADD_STAT(indirectMisses, UNIT_COUNT, "Number of indirect misses."),
ADD_STAT(indirectMispredicted, UNIT_COUNT,
"Number of mispredicted indirect branches.")
{
BTBHitRatio.precision(6);
}

View File

@@ -347,10 +347,12 @@ LoopPredictor::condBranchUpdate(ThreadID tid, Addr branch_pc, bool taken,
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")
ADD_STAT(correct, UNIT_COUNT,
"Number of times the loop predictor is the provider and the "
"prediction is correct"),
ADD_STAT(wrong, UNIT_COUNT,
"Number of times the loop predictor is the provider and the "
"prediction is wrong")
{
}

View File

@@ -400,9 +400,11 @@ StatisticalCorrector::getSizeInBits() const
StatisticalCorrector::StatisticalCorrectorStats::StatisticalCorrectorStats(
Stats::Group *parent)
: Stats::Group(parent),
ADD_STAT(correct, "Number of time the SC predictor is the"
" provider and the prediction is correct"),
ADD_STAT(wrong, "Number of time the SC predictor is the"
" provider and the prediction is wrong")
ADD_STAT(correct, UNIT_COUNT,
"Number of time the SC predictor is the provider and the "
"prediction is correct"),
ADD_STAT(wrong, UNIT_COUNT,
"Number of time the SC predictor is the provider and the "
"prediction is wrong")
{
}

View File

@@ -719,32 +719,39 @@ TAGEBase::getGHR(ThreadID tid, BranchInfo *bi) const
TAGEBase::TAGEBaseStats::TAGEBaseStats(
Stats::Group *parent, unsigned nHistoryTables)
: Stats::Group(parent),
ADD_STAT(longestMatchProviderCorrect, "Number of times TAGE Longest"
" Match is the provider and the prediction is correct"),
ADD_STAT(altMatchProviderCorrect, "Number of times TAGE Alt Match"
" is the provider and the prediction is correct"),
ADD_STAT(bimodalAltMatchProviderCorrect, "Number of times TAGE Alt"
" Match is the bimodal and it is the provider and the prediction"
" is correct"),
ADD_STAT(bimodalProviderCorrect, "Number of times there are no"
" hits on the TAGE tables and the bimodal prediction is correct"),
ADD_STAT(longestMatchProviderWrong, "Number of times TAGE Longest"
" Match is the provider and the prediction is wrong"),
ADD_STAT(altMatchProviderWrong, "Number of times TAGE Alt Match is"
" the provider and the prediction is wrong"),
ADD_STAT(bimodalAltMatchProviderWrong, "Number of times TAGE Alt Match"
" is the bimodal and it is the provider and the prediction is"
" wrong"),
ADD_STAT(bimodalProviderWrong, "Number of times there are no hits"
" on the TAGE tables and the bimodal prediction is wrong"),
ADD_STAT(altMatchProviderWouldHaveHit, "Number of times TAGE"
" Longest Match is the provider, the prediction is wrong and"
" Alt Match prediction was correct"),
ADD_STAT(longestMatchProviderWouldHaveHit, "Number of times"
" TAGE Alt Match is the provider, the prediction is wrong and"
" Longest Match prediction was correct"),
ADD_STAT(longestMatchProvider, "TAGE provider for longest match"),
ADD_STAT(altMatchProvider, "TAGE provider for alt match")
ADD_STAT(longestMatchProviderCorrect, UNIT_COUNT,
"Number of times TAGE Longest Match is the provider and the "
"prediction is correct"),
ADD_STAT(altMatchProviderCorrect, UNIT_COUNT,
"Number of times TAGE Alt Match is the provider and the "
"prediction is correct"),
ADD_STAT(bimodalAltMatchProviderCorrect, UNIT_COUNT,
"Number of times TAGE Alt Match is the bimodal and it is the "
"provider and the prediction is correct"),
ADD_STAT(bimodalProviderCorrect, UNIT_COUNT,
"Number of times there are no hits on the TAGE tables and the "
"bimodal prediction is correct"),
ADD_STAT(longestMatchProviderWrong, UNIT_COUNT,
"Number of times TAGE Longest Match is the provider and the "
"prediction is wrong"),
ADD_STAT(altMatchProviderWrong, UNIT_COUNT,
"Number of times TAGE Alt Match is the provider and the "
"prediction is wrong"),
ADD_STAT(bimodalAltMatchProviderWrong, UNIT_COUNT,
"Number of times TAGE Alt Match is the bimodal and it is the "
"provider and the prediction is wrong"),
ADD_STAT(bimodalProviderWrong, UNIT_COUNT,
"Number of times there are no hits on the TAGE tables and the "
"bimodal prediction is wrong"),
ADD_STAT(altMatchProviderWouldHaveHit, UNIT_COUNT,
"Number of times TAGE Longest Match is the provider, the "
"prediction is wrong and Alt Match prediction was correct"),
ADD_STAT(longestMatchProviderWouldHaveHit, UNIT_COUNT,
"Number of times TAGE Alt Match is the provider, the "
"prediction is wrong and Longest Match prediction was correct"),
ADD_STAT(longestMatchProvider, UNIT_COUNT,
"TAGE provider for longest match"),
ADD_STAT(altMatchProvider, UNIT_COUNT, "TAGE provider for alt match")
{
longestMatchProvider.init(nHistoryTables + 1);
altMatchProvider.init(nHistoryTables + 1);