cpu: add BTBUpdates for BPredUnitStats

Current BPredUnitStats only contains BTBLookups. However, the number
of BTB updates is also needed to evaluate power consumption via McPAT.
Thus, this patch add BTBUpdates for BPredUnitStats.

Change-Id: I4c079b53f6585b5452022fe3fb516563c7d07f4e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63651
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
Luming Wang
2022-09-14 08:19:17 +00:00
parent e1ba253438
commit fe6fc29b07
2 changed files with 6 additions and 0 deletions

View File

@@ -82,6 +82,8 @@ BPredUnit::BPredUnitStats::BPredUnitStats(statistics::Group *parent)
"Number of conditional branches incorrect"),
ADD_STAT(BTBLookups, statistics::units::Count::get(),
"Number of BTB lookups"),
ADD_STAT(BTBUpdates, statistics::units::Count::get(),
"Number of BTB updates"),
ADD_STAT(BTBHits, statistics::units::Count::get(), "Number of BTB hits"),
ADD_STAT(BTBHitRatio, statistics::units::Ratio::get(), "BTB Hit Ratio",
BTBHits / BTBLookups),
@@ -479,6 +481,7 @@ BPredUnit::squash(const InstSeqNum &squashed_sn,
"PC %#x\n", tid, squashed_sn,
hist_it->seqNum, hist_it->pc);
++stats.BTBUpdates;
BTB.update(hist_it->pc, corr_target, tid);
}
} else {

View File

@@ -191,6 +191,7 @@ class BPredUnit : public SimObject
void
BTBUpdate(Addr instPC, const PCStateBase &target)
{
++stats.BTBUpdates;
BTB.update(instPC, target, 0);
}
@@ -314,6 +315,8 @@ class BPredUnit : public SimObject
statistics::Scalar condIncorrect;
/** Stat for number of BTB lookups. */
statistics::Scalar BTBLookups;
/** Stat for number of BTB updates. */
statistics::Scalar BTBUpdates;
/** Stat for number of BTB hits. */
statistics::Scalar BTBHits;
/** Stat for the ratio between BTB hits and BTB lookups. */