From 9625e90b8e7a1aadba2b955dc13206aea6d0067a Mon Sep 17 00:00:00 2001 From: Hoa Nguyen Date: Wed, 20 Jan 2021 02:15:49 -0800 Subject: [PATCH] arch-arm,arch-riscv,arch-x86: Add units to stats Change-Id: I6bf506c223207306d71511491e024546b209030f Signed-off-by: Hoa Nguyen Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39416 Tested-by: kokoro Maintainer: Gabe Black Reviewed-by: Giacomo Travaglini Reviewed-by: Daniel Carvalho --- src/arch/arm/table_walker.cc | 44 +++++++++++++----------- src/arch/arm/tlb.cc | 65 ++++++++++++++++++++---------------- src/arch/riscv/tlb.cc | 23 +++++++------ src/arch/x86/tlb.cc | 8 ++--- 4 files changed, 78 insertions(+), 62 deletions(-) diff --git a/src/arch/arm/table_walker.cc b/src/arch/arm/table_walker.cc index 7f19adb39..5ef41fbee 100644 --- a/src/arch/arm/table_walker.cc +++ b/src/arch/arm/table_walker.cc @@ -2317,25 +2317,31 @@ TableWalker::pageSizeNtoStatBin(uint8_t N) TableWalker::TableWalkerStats::TableWalkerStats(Stats::Group *parent) : Stats::Group(parent), - ADD_STAT(walks, "Table walker walks requested"), - ADD_STAT(walksShortDescriptor, "Table walker walks initiated with" - " short descriptors"), - ADD_STAT(walksLongDescriptor, "Table walker walks initiated with" - " long descriptors"), - ADD_STAT(walksShortTerminatedAtLevel, "Level at which table walker" - " walks with short descriptors terminate"), - ADD_STAT(walksLongTerminatedAtLevel, "Level at which table walker" - " walks with long descriptors terminate"), - ADD_STAT(squashedBefore, "Table walks squashed before starting"), - ADD_STAT(squashedAfter, "Table walks squashed after completion"), - ADD_STAT(walkWaitTime, "Table walker wait (enqueue to first request)" - " latency"), - ADD_STAT(walkServiceTime, "Table walker service (enqueue to completion)" - " latency"), - ADD_STAT(pendingWalks, "Table walker pending requests distribution"), - ADD_STAT(pageSizes, "Table walker page sizes translated"), - ADD_STAT(requestOrigin, "Table walker requests started/completed," - " data/inst") + ADD_STAT(walks, UNIT_COUNT, "Table walker walks requested"), + ADD_STAT(walksShortDescriptor, UNIT_COUNT, + "Table walker walks initiated with short descriptors"), + ADD_STAT(walksLongDescriptor, UNIT_COUNT, + "Table walker walks initiated with long descriptors"), + ADD_STAT(walksShortTerminatedAtLevel, UNIT_COUNT, + "Level at which table walker walks with short descriptors " + "terminate"), + ADD_STAT(walksLongTerminatedAtLevel, UNIT_COUNT, + "Level at which table walker walks with long descriptors " + "terminate"), + ADD_STAT(squashedBefore, UNIT_COUNT, + "Table walks squashed before starting"), + ADD_STAT(squashedAfter, UNIT_COUNT, + "Table walks squashed after completion"), + ADD_STAT(walkWaitTime, UNIT_TICK, + "Table walker wait (enqueue to first request) latency"), + ADD_STAT(walkServiceTime, UNIT_TICK, + "Table walker service (enqueue to completion) latency"), + ADD_STAT(pendingWalks, UNIT_TICK, + "Table walker pending requests distribution"), + ADD_STAT(pageSizes, UNIT_COUNT, + "Table walker page sizes translated"), + ADD_STAT(requestOrigin, UNIT_COUNT, + "Table walker requests started/completed, data/inst") { walksShortDescriptor .flags(Stats::nozero); diff --git a/src/arch/arm/tlb.cc b/src/arch/arm/tlb.cc index 6f16f6cf7..fd72d258b 100644 --- a/src/arch/arm/tlb.cc +++ b/src/arch/arm/tlb.cc @@ -507,34 +507,43 @@ TLB::takeOverFrom(BaseTLB *_otlb) TLB::TlbStats::TlbStats(Stats::Group *parent) : Stats::Group(parent), - ADD_STAT(instHits,"ITB inst hits"), - ADD_STAT(instMisses, "ITB inst misses"), - ADD_STAT(readHits, "DTB read hits"), - ADD_STAT(readMisses, "DTB read misses"), - ADD_STAT(writeHits, "DTB write hits"), - ADD_STAT(writeMisses, "DTB write misses"), - ADD_STAT(inserts, "Number of times an entry is inserted into the TLB"), - ADD_STAT(flushTlb, "Number of times complete TLB was flushed"), - ADD_STAT(flushTlbMva, "Number of times TLB was flushed by MVA"), - ADD_STAT(flushTlbMvaAsid, "Number of times TLB was flushed by MVA & ASID"), - ADD_STAT(flushTlbAsid, "Number of times TLB was flushed by ASID"), - ADD_STAT(flushedEntries, "Number of entries that have been flushed" - " from TLB"), - ADD_STAT(alignFaults, "Number of TLB faults due to alignment" - " restrictions"), - ADD_STAT(prefetchFaults, "Number of TLB faults due to prefetch"), - ADD_STAT(domainFaults, "Number of TLB faults due to domain restrictions"), - ADD_STAT(permsFaults, "Number of TLB faults due to permissions" - " restrictions"), - ADD_STAT(readAccesses, "DTB read accesses", readHits + readMisses), - ADD_STAT(writeAccesses, "DTB write accesses", writeHits + writeMisses), - ADD_STAT(instAccesses, "ITB inst accesses", instHits + instMisses), - ADD_STAT(hits, "Total TLB (inst and data) hits", - readHits + writeHits + instHits), - ADD_STAT(misses, "Total TLB (inst and data) misses", - readMisses + writeMisses + instMisses), - ADD_STAT(accesses, "Total TLB (inst and data) accesses", - readAccesses + writeAccesses + instAccesses) + ADD_STAT(instHits, UNIT_COUNT, "ITB inst hits"), + ADD_STAT(instMisses, UNIT_COUNT, "ITB inst misses"), + ADD_STAT(readHits, UNIT_COUNT, "DTB read hits"), + ADD_STAT(readMisses, UNIT_COUNT, "DTB read misses"), + ADD_STAT(writeHits, UNIT_COUNT, "DTB write hits"), + ADD_STAT(writeMisses, UNIT_COUNT, "DTB write misses"), + ADD_STAT(inserts, UNIT_COUNT, + "Number of times an entry is inserted into the TLB"), + ADD_STAT(flushTlb, UNIT_COUNT, "Number of times complete TLB was flushed"), + ADD_STAT(flushTlbMva, UNIT_COUNT, + "Number of times TLB was flushed by MVA"), + ADD_STAT(flushTlbMvaAsid, UNIT_COUNT, + "Number of times TLB was flushed by MVA & ASID"), + ADD_STAT(flushTlbAsid, UNIT_COUNT, + "Number of times TLB was flushed by ASID"), + ADD_STAT(flushedEntries, UNIT_COUNT, + "Number of entries that have been flushed from TLB"), + ADD_STAT(alignFaults, UNIT_COUNT, + "Number of TLB faults due to alignment restrictions"), + ADD_STAT(prefetchFaults, UNIT_COUNT, + "Number of TLB faults due to prefetch"), + ADD_STAT(domainFaults, UNIT_COUNT, + "Number of TLB faults due to domain restrictions"), + ADD_STAT(permsFaults, UNIT_COUNT, + "Number of TLB faults due to permissions restrictions"), + ADD_STAT(readAccesses, UNIT_COUNT, "DTB read accesses", + readHits + readMisses), + ADD_STAT(writeAccesses, UNIT_COUNT, "DTB write accesses", + writeHits + writeMisses), + ADD_STAT(instAccesses, UNIT_COUNT, "ITB inst accesses", + instHits + instMisses), + ADD_STAT(hits, UNIT_COUNT, "Total TLB (inst and data) hits", + readHits + writeHits + instHits), + ADD_STAT(misses, UNIT_COUNT, "Total TLB (inst and data) misses", + readMisses + writeMisses + instMisses), + ADD_STAT(accesses, UNIT_COUNT, "Total TLB (inst and data) accesses", + readAccesses + writeAccesses + instAccesses) { } diff --git a/src/arch/riscv/tlb.cc b/src/arch/riscv/tlb.cc index 491f15feb..84eb6e2bf 100644 --- a/src/arch/riscv/tlb.cc +++ b/src/arch/riscv/tlb.cc @@ -498,16 +498,17 @@ TLB::unserialize(CheckpointIn &cp) TLB::TlbStats::TlbStats(Stats::Group *parent) : Stats::Group(parent), - ADD_STAT(read_hits, "read hits"), - ADD_STAT(read_misses, "read misses"), - ADD_STAT(read_accesses, "read accesses"), - ADD_STAT(write_hits, "write hits"), - ADD_STAT(write_misses, "write misses"), - ADD_STAT(write_accesses, "write accesses"), - ADD_STAT(hits, "Total TLB (read and write) hits", read_hits + write_hits), - ADD_STAT(misses, "Total TLB (read and write) misses", - read_misses + write_misses), - ADD_STAT(accesses, "Total TLB (read and write) accesses", - read_accesses + write_accesses) + ADD_STAT(read_hits, UNIT_COUNT, "read hits"), + ADD_STAT(read_misses, UNIT_COUNT, "read misses"), + ADD_STAT(read_accesses, UNIT_COUNT, "read accesses"), + ADD_STAT(write_hits, UNIT_COUNT, "write hits"), + ADD_STAT(write_misses, UNIT_COUNT, "write misses"), + ADD_STAT(write_accesses, UNIT_COUNT, "write accesses"), + ADD_STAT(hits, UNIT_COUNT, "Total TLB (read and write) hits", + read_hits + write_hits), + ADD_STAT(misses, UNIT_COUNT, "Total TLB (read and write) misses", + read_misses + write_misses), + ADD_STAT(accesses, UNIT_COUNT, "Total TLB (read and write) accesses", + read_accesses + write_accesses) { } diff --git a/src/arch/x86/tlb.cc b/src/arch/x86/tlb.cc index 045015f92..6d6b14e8c 100644 --- a/src/arch/x86/tlb.cc +++ b/src/arch/x86/tlb.cc @@ -520,10 +520,10 @@ TLB::getWalker() TLB::TlbStats::TlbStats(Stats::Group *parent) : Stats::Group(parent), - ADD_STAT(rdAccesses, "TLB accesses on read requests"), - ADD_STAT(wrAccesses, "TLB accesses on write requests"), - ADD_STAT(rdMisses, "TLB misses on read requests"), - ADD_STAT(wrMisses, "TLB misses on write requests") + ADD_STAT(rdAccesses, UNIT_COUNT, "TLB accesses on read requests"), + ADD_STAT(wrAccesses, UNIT_COUNT, "TLB accesses on write requests"), + ADD_STAT(rdMisses, UNIT_COUNT, "TLB misses on read requests"), + ADD_STAT(wrMisses, UNIT_COUNT, "TLB misses on write requests") { } -- 2.30.2