Eden Avivi has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/33475 )
Change subject: mem: convert base prefetcher and queued to new style stats
......................................................................
mem: convert base prefetcher and queued to new style stats
Base and Queued inside src/mem/cache/prefetch converted
Change-Id: I3d5907b58efefc4d8522b89f073507f2548bff2f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33475
Reviewed-by: Daniel Carvalho <[email protected]>
Maintainer: Jason Lowe-Power <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/mem/cache/prefetch/base.cc
M src/mem/cache/prefetch/base.hh
M src/mem/cache/prefetch/queued.cc
M src/mem/cache/prefetch/queued.hh
4 files changed, 40 insertions(+), 58 deletions(-)
Approvals:
Daniel Carvalho: Looks good to me, approved
Jason Lowe-Power: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/mem/cache/prefetch/base.cc b/src/mem/cache/prefetch/base.cc
index d4223aa..4e484e5 100644
--- a/src/mem/cache/prefetch/base.cc
+++ b/src/mem/cache/prefetch/base.cc
@@ -94,7 +94,8 @@
onWrite(p->on_write), onData(p->on_data), onInst(p->on_inst),
masterId(p->sys->getMasterId(this)),
pageBytes(p->sys->getPageBytes()),
prefetchOnAccess(p->prefetch_on_access),
- useVirtualAddresses(p->use_virtual_addresses), issuedPrefetches(0),
+ useVirtualAddresses(p->use_virtual_addresses),
+ prefetchStats(this), issuedPrefetches(0),
usefulPrefetches(0), tlb(nullptr)
{
}
@@ -109,19 +110,13 @@
blkSize = cache->getBlockSize();
lBlkSize = floorLog2(blkSize);
}
-
-void
-Base::regStats()
+Base::StatGroup::StatGroup(Stats::Group *parent)
+ : Stats::Group(parent),
+ ADD_STAT(pfIssued, "number of hwpf issued")
{
- ClockedObject::regStats();
-
- pfIssued
- .name(name() + ".num_hwpf_issued")
- .desc("number of hwpf issued")
- ;
-
}
+
bool
Base::observeAccess(const PacketPtr &pkt, bool miss) const
{
diff --git a/src/mem/cache/prefetch/base.hh b/src/mem/cache/prefetch/base.hh
index 783fb01..5f7ad81 100644
--- a/src/mem/cache/prefetch/base.hh
+++ b/src/mem/cache/prefetch/base.hh
@@ -49,6 +49,7 @@
#include <cstdint>
#include "arch/generic/tlb.hh"
+#include "arch/isa_traits.hh"
#include "base/statistics.hh"
#include "base/types.hh"
#include "mem/packet.hh"
@@ -317,8 +318,11 @@
Addr pageOffset(Addr a) const;
/** Build the address of the i-th block inside the page */
Addr pageIthBlockAddress(Addr page, uint32_t i) const;
-
- Stats::Scalar pfIssued;
+ struct StatGroup : public Stats::Group
+ {
+ StatGroup(Stats::Group *parent);
+ Stats::Scalar pfIssued;
+ } prefetchStats;
/** Total prefetches issued */
uint64_t issuedPrefetches;
@@ -348,10 +352,6 @@
virtual Tick nextPrefetchReadyTime() const = 0;
- /**
- * Register local statistics.
- */
- void regStats() override;
/**
* Register probe points for this object.
diff --git a/src/mem/cache/prefetch/queued.cc
b/src/mem/cache/prefetch/queued.cc
index c2ae090..6b89c2b 100644
--- a/src/mem/cache/prefetch/queued.cc
+++ b/src/mem/cache/prefetch/queued.cc
@@ -97,7 +97,7 @@
latency(p->latency), queueSquash(p->queue_squash),
queueFilter(p->queue_filter), cacheSnoop(p->cache_snoop),
tagPrefetch(p->tag_prefetch),
- throttleControlPct(p->throttle_control_percentage)
+ throttleControlPct(p->throttle_control_percentage), statsQueued(this)
{
}
@@ -174,13 +174,13 @@
addr_prio.first = blockAddress(addr_prio.first);
if (!samePage(addr_prio.first, pfi.getAddr())) {
- pfSpanPage += 1;
+ statsQueued.pfSpanPage += 1;
}
bool can_cross_page = (tlb != nullptr);
if (can_cross_page || samePage(addr_prio.first, pfi.getAddr())) {
PrefetchInfo new_pfi(pfi,addr_prio.first);
- pfIdentified++;
+ statsQueued.pfIdentified++;
DPRINTF(HWPrefetch, "Found a pf candidate addr: %#x, "
"inserting into prefetch queue.\n", new_pfi.getAddr());
// Create and insert the request
@@ -214,7 +214,7 @@
PacketPtr pkt = pfq.front().pkt;
pfq.pop_front();
- pfIssued++;
+ prefetchStats.pfIssued++;
issuedPrefetches += 1;
assert(pkt != nullptr);
DPRINTF(HWPrefetch, "Generating prefetch for %#x.\n", pkt->getAddr());
@@ -222,31 +222,17 @@
processMissingTranslations(queueSize - pfq.size());
return pkt;
}
-
-void
-Queued::regStats()
+Queued::QueuedStats::QueuedStats(Stats::Group *parent)
+ : Stats::Group(parent),
+ ADD_STAT(pfIdentified, "number of prefetch candidates identified"),
+ ADD_STAT(pfBufferHit,
+ "number of redundant prefetches already in prefetch queue"),
+ ADD_STAT(pfInCache,
+ "number of redundant prefetches already in cache/mshr dropped"),
+ ADD_STAT(pfRemovedFull,
+ "number of prefetches dropped due to prefetch queue size"),
+ ADD_STAT(pfSpanPage, "number of prefetches that crossed the page")
{
- Base::regStats();
-
- pfIdentified
- .name(name() + ".pfIdentified")
- .desc("number of prefetch candidates identified");
-
- pfBufferHit
- .name(name() + ".pfBufferHit")
- .desc("number of redundant prefetches already in prefetch queue");
-
- pfInCache
- .name(name() + ".pfInCache")
- .desc("number of redundant prefetches already in cache/mshr
dropped");
-
- pfRemovedFull
- .name(name() + ".pfRemovedFull")
- .desc("number of prefetches dropped due to prefetch queue size");
-
- pfSpanPage
- .name(name() + ".pfSpanPage")
- .desc("number of prefetches that crossed the page");
}
@@ -285,7 +271,7 @@
// check if this prefetch is already redundant
if (cacheSnoop && (inCache(target_paddr, it->pfInfo.isSecure()) ||
inMissQueue(target_paddr, it->pfInfo.isSecure()))) {
- pfInCache++;
+ statsQueued.pfInCache++;
DPRINTF(HWPrefetch, "Dropping redundant in "
"cache/MSHR prefetch addr:%#x\n", target_paddr);
} else {
@@ -314,7 +300,7 @@
/* If the address is already in the queue, update priority and leave */
if (it != queue.end()) {
- pfBufferHit++;
+ statsQueued.pfBufferHit++;
if (it->priority < priority) {
/* Update priority value and position in the queue */
it->priority = priority;
@@ -421,7 +407,7 @@
if (has_target_pa && cacheSnoop &&
(inCache(target_paddr, new_pfi.isSecure()) ||
inMissQueue(target_paddr, new_pfi.isSecure()))) {
- pfInCache++;
+ statsQueued.pfInCache++;
DPRINTF(HWPrefetch, "Dropping redundant in "
"cache/MSHR prefetch addr:%#x\n", target_paddr);
return;
@@ -452,7 +438,7 @@
{
/* Verify prefetch buffer space for request */
if (queue.size() == queueSize) {
- pfRemovedFull++;
+ statsQueued.pfRemovedFull++;
/* Lowest priority packet */
iterator it = queue.end();
panic_if (it == queue.begin(),
diff --git a/src/mem/cache/prefetch/queued.hh
b/src/mem/cache/prefetch/queued.hh
index 5af9093..96cf311 100644
--- a/src/mem/cache/prefetch/queued.hh
+++ b/src/mem/cache/prefetch/queued.hh
@@ -167,13 +167,16 @@
/** Percentage of requests that can be throttled */
const unsigned int throttleControlPct;
- // STATS
- Stats::Scalar pfIdentified;
- Stats::Scalar pfBufferHit;
- Stats::Scalar pfInCache;
- Stats::Scalar pfRemovedFull;
- Stats::Scalar pfSpanPage;
-
+ struct QueuedStats : public Stats::Group
+ {
+ QueuedStats(Stats::Group *parent);
+ // STATS
+ Stats::Scalar pfIdentified;
+ Stats::Scalar pfBufferHit;
+ Stats::Scalar pfInCache;
+ Stats::Scalar pfRemovedFull;
+ Stats::Scalar pfSpanPage;
+ } statsQueued;
public:
using AddrPriority = std::pair<Addr, int32_t>;
@@ -193,8 +196,6 @@
return pfq.empty() ? MaxTick : pfq.front().tick;
}
- void regStats() override;
-
private:
/**
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/33475
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I3d5907b58efefc4d8522b89f073507f2548bff2f
Gerrit-Change-Number: 33475
Gerrit-PatchSet: 6
Gerrit-Owner: Eden Avivi <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Eden Avivi <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-CC: Andreas Sandberg <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s