arch-arm: Do not always print 0 stats in ArmTLB

We shouldn't print all TLB stats regardless of their value

For example there is no need to print the number of
read/write hits/misses/accesses in a instruction only TLB as
it will always inevitably be zero

With this patch we are flagging them as nozero, in order
to suppress their printing in the final stats file.
We are still printing them (regardless of their value) in the
unified TLB type

Change-Id: I54e57d856ceb451f6bacdd175a61768d030862aa
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/51667
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Giacomo Travaglini
2021-09-09 11:37:21 +01:00
parent 118677218d
commit 8fe7a740e3
2 changed files with 38 additions and 13 deletions

View File

@@ -62,7 +62,7 @@ TLB::TLB(const ArmTLBParams &p)
: BaseTLB(p), table(new TlbEntry[p.size]), size(p.size),
isStage2(p.is_stage2),
tableWalker(nullptr),
stats(this), rangeMRU(1), vmid(0)
stats(*this), rangeMRU(1), vmid(0)
{
}
@@ -545,14 +545,14 @@ TLB::takeOverFrom(BaseTLB *_otlb)
{
}
TLB::TlbStats::TlbStats(statistics::Group *parent)
: statistics::Group(parent),
ADD_STAT(instHits, statistics::units::Count::get(), "ITB inst hits"),
ADD_STAT(instMisses, statistics::units::Count::get(), "ITB inst misses"),
ADD_STAT(readHits, statistics::units::Count::get(), "DTB read hits"),
ADD_STAT(readMisses, statistics::units::Count::get(), "DTB read misses"),
ADD_STAT(writeHits, statistics::units::Count::get(), "DTB write hits"),
ADD_STAT(writeMisses, statistics::units::Count::get(), "DTB write misses"),
TLB::TlbStats::TlbStats(TLB &parent)
: statistics::Group(&parent), tlb(parent),
ADD_STAT(instHits, statistics::units::Count::get(), "Inst hits"),
ADD_STAT(instMisses, statistics::units::Count::get(), "Inst misses"),
ADD_STAT(readHits, statistics::units::Count::get(), "Read hits"),
ADD_STAT(readMisses, statistics::units::Count::get(), "Read misses"),
ADD_STAT(writeHits, statistics::units::Count::get(), "Write hits"),
ADD_STAT(writeMisses, statistics::units::Count::get(), "Write misses"),
ADD_STAT(inserts, statistics::units::Count::get(),
"Number of times an entry is inserted into the TLB"),
ADD_STAT(flushTlb, statistics::units::Count::get(),
@@ -565,11 +565,11 @@ TLB::TlbStats::TlbStats(statistics::Group *parent)
"Number of times TLB was flushed by ASID"),
ADD_STAT(flushedEntries, statistics::units::Count::get(),
"Number of entries that have been flushed from TLB"),
ADD_STAT(readAccesses, statistics::units::Count::get(), "DTB read accesses",
ADD_STAT(readAccesses, statistics::units::Count::get(), "Read accesses",
readHits + readMisses),
ADD_STAT(writeAccesses, statistics::units::Count::get(), "DTB write accesses",
ADD_STAT(writeAccesses, statistics::units::Count::get(), "Write accesses",
writeHits + writeMisses),
ADD_STAT(instAccesses, statistics::units::Count::get(), "ITB inst accesses",
ADD_STAT(instAccesses, statistics::units::Count::get(), "Inst accesses",
instHits + instMisses),
ADD_STAT(hits, statistics::units::Count::get(),
"Total TLB (inst and data) hits",
@@ -581,6 +581,28 @@ TLB::TlbStats::TlbStats(statistics::Group *parent)
"Total TLB (inst and data) accesses",
readAccesses + writeAccesses + instAccesses)
{
// If this is a pure Data TLB, mark the instruction
// stats as nozero, so that they won't make it in
// into the final stats file
if (tlb.type() == TypeTLB::data) {
instHits.flags(statistics::nozero);
instMisses.flags(statistics::nozero);
instAccesses.flags(statistics::nozero);
}
// If this is a pure Instruction TLB, mark the data
// stats as nozero, so that they won't make it in
// into the final stats file
if (tlb.type() & TypeTLB::instruction) {
readHits.flags(statistics::nozero);
readMisses.flags(statistics::nozero);
writeHits.flags(statistics::nozero);
writeMisses.flags(statistics::nozero);
readAccesses.flags(statistics::nozero);
writeAccesses.flags(statistics::nozero);
}
}
void