Nathanael Premillieu has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/47602 )

Change subject: mem-cache: add a prefetch useful stat
......................................................................

mem-cache: add a prefetch useful stat

Count how many time a prefetch is useful, meaning
a hit has happened on a prefetched cache block.
Another stat (pfUsefulButMiss) has been added to count
the special case where there is a hit on prefetched block
but it is counted as a miss because the block is not in
the requested coherency state.

Change-Id: I253216b9ac96d5f21139b710c489d6eb3fce7136
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/47602
Reviewed-by: Daniel Carvalho <[email protected]>
Reviewed-by: Nikos Nikoleris <[email protected]>
Maintainer: Daniel Carvalho <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/mem/cache/prefetch/base.cc
M src/mem/cache/prefetch/base.hh
2 files changed, 16 insertions(+), 1 deletion(-)

Approvals:
  Nikos Nikoleris: Looks good to me, approved
  Daniel Carvalho: Looks good to me, approved; 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 58a7439..88d50b9 100644
--- a/src/mem/cache/prefetch/base.cc
+++ b/src/mem/cache/prefetch/base.cc
@@ -122,7 +122,12 @@
     ADD_STAT(pfIssued, statistics::units::Count::get(),
         "number of hwpf issued"),
     ADD_STAT(pfUnused, statistics::units::Count::get(),
-             "number of HardPF blocks evicted w/o reference")
+             "number of HardPF blocks evicted w/o reference"),
+    ADD_STAT(pfUseful, statistics::units::Count::get(),
+        "number of useful prefetch"),
+    ADD_STAT(pfUsefulButMiss, statistics::units::Count::get(),
+        "number of hit on prefetch but cache block is not in an usable "
+        "state")
 {
     pfUnused.flags(statistics::nozero);
 }
@@ -219,6 +224,11 @@

     if (hasBeenPrefetched(pkt->getAddr(), pkt->isSecure())) {
         usefulPrefetches += 1;
+        prefetchStats.pfUseful++;
+        if (miss)
+            // This case happens when a demand hits on a prefetched line
+            // that's not in the requested coherency state.
+            prefetchStats.pfUsefulButMiss++;
     }

     // Verify this access type is observed by prefetcher
diff --git a/src/mem/cache/prefetch/base.hh b/src/mem/cache/prefetch/base.hh
index b7eef83..ddff8a2 100644
--- a/src/mem/cache/prefetch/base.hh
+++ b/src/mem/cache/prefetch/base.hh
@@ -332,6 +332,11 @@
         /** The number of times a HW-prefetched block is evicted w/o
          * reference. */
         statistics::Scalar pfUnused;
+        /** The number of times a HW-prefetch is useful. */
+        statistics::Scalar pfUseful;
+        /** The number of times there is a hit on prefetch but cache block
+         * is not in an usable state */
+        statistics::Scalar pfUsefulButMiss;
     } prefetchStats;

     /** Total prefetches issued */

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/47602
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: I253216b9ac96d5f21139b710c489d6eb3fce7136
Gerrit-Change-Number: 47602
Gerrit-PatchSet: 7
Gerrit-Owner: Nathanael Premillieu <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Nathanael Premillieu <[email protected]>
Gerrit-Reviewer: Nikos Nikoleris <[email protected]>
Gerrit-Reviewer: kokoro <[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

Reply via email to