Eden Avivi has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/33475 )

Change subject: mem: convert queued to new style stats
......................................................................

mem: convert queued to new style stats

Queued inside src/mem/cache/prefetch converted and dependent on base

Change-Id: I3d5907b58efefc4d8522b89f073507f2548bff2f
---
M src/mem/cache/prefetch/queued.cc
M src/mem/cache/prefetch/queued.hh
2 files changed, 30 insertions(+), 43 deletions(-)



diff --git a/src/mem/cache/prefetch/queued.cc b/src/mem/cache/prefetch/queued.cc
index c2ae090..841a91d 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), stats_queued(this)
 {
 }

@@ -174,13 +174,13 @@
         addr_prio.first = blockAddress(addr_prio.first);

         if (!samePage(addr_prio.first, pfi.getAddr())) {
-            pfSpanPage += 1;
+            stats_queued.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++;
+            stats_queued.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++;
+    stats_pbase.pfIssued++;
     issuedPrefetches += 1;
     assert(pkt != nullptr);
     DPRINTF(HWPrefetch, "Generating prefetch for %#x.\n", pkt->getAddr());
@@ -222,32 +222,19 @@
     processMissingTranslations(queueSize - pfq.size());
     return pkt;
 }
-
-void
-Queued::regStats()
-{
-    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");
-}
+//Base::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")
+    {
+    }


 void
@@ -285,7 +272,7 @@
         // check if this prefetch is already redundant
         if (cacheSnoop && (inCache(target_paddr, it->pfInfo.isSecure()) ||
                     inMissQueue(target_paddr, it->pfInfo.isSecure()))) {
-            pfInCache++;
+            stats_queued.pfInCache++;
             DPRINTF(HWPrefetch, "Dropping redundant in "
                     "cache/MSHR prefetch addr:%#x\n", target_paddr);
         } else {
@@ -314,7 +301,7 @@

     /* If the address is already in the queue, update priority and leave */
     if (it != queue.end()) {
-        pfBufferHit++;
+        stats_queued.pfBufferHit++;
         if (it->priority < priority) {
             /* Update priority value and position in the queue */
             it->priority = priority;
@@ -421,7 +408,7 @@
     if (has_target_pa && cacheSnoop &&
             (inCache(target_paddr, new_pfi.isSecure()) ||
             inMissQueue(target_paddr, new_pfi.isSecure()))) {
-        pfInCache++;
+        stats_queued.pfInCache++;
         DPRINTF(HWPrefetch, "Dropping redundant in "
                 "cache/MSHR prefetch addr:%#x\n", target_paddr);
         return;
@@ -452,7 +439,7 @@
 {
     /* Verify prefetch buffer space for request */
     if (queue.size() == queueSize) {
-        pfRemovedFull++;
+        stats_queued.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..106c989 100644
--- a/src/mem/cache/prefetch/queued.hh
+++ b/src/mem/cache/prefetch/queued.hh
@@ -167,13 +167,15 @@
     /** 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;
+    } stats_queued;
   public:
     using AddrPriority = std::pair<Addr, int32_t>;

@@ -193,8 +195,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: 1
Gerrit-Owner: Eden Avivi <eav...@ucdavis.edu>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to