mem: Add unused prefetch counter in caches
authorRekai Gonzalez Alberquilla <Rekai.GonzalezAlberquilla@arm.com>
Wed, 27 May 2015 12:50:01 +0000 (13:50 +0100)
committerRekai Gonzalez Alberquilla <Rekai.GonzalezAlberquilla@arm.com>
Wed, 27 May 2015 12:50:01 +0000 (13:50 +0100)
Added stat to the cache to account for HardPF'ed blocks that are evicted
before being referenced (over-prefetching).

src/mem/cache/base.cc
src/mem/cache/base.hh
src/mem/cache/cache.cc

index ecbd3526e250c93e8f6beb643846641bc37b293f..3ae52cebd7ba7054567d589b17a1c454fb4382c2 100644 (file)
@@ -444,6 +444,12 @@ BaseCache::regStats()
         .desc("number of cache copies performed")
         ;
 
+    unusedPrefetches
+        .name(name() + ".unused_prefetches")
+        .desc("number of HardPF blocks evicted w/o reference")
+        .flags(nozero)
+        ;
+
     writebacks
         .init(system->maxMasters())
         .name(name() + ".writebacks")
index cd21bce918e98235fc475bb39e4d8b79fc17b57a..9275eb453da07e36087295ef37c020b13379f68b 100644 (file)
@@ -387,6 +387,9 @@ class BaseCache : public MemObject
     /** The number of cache copies performed. */
     Stats::Scalar cacheCopies;
 
+    /** The number of times a HW-prefetched block is evicted w/o reference. */
+    Stats::Scalar unusedPrefetches;
+
     /** Number of blocks written back per thread. */
     Stats::Vector writebacks;
 
index 267497aca4d9962646712e96c99956b842a85bef..5d5760ff31a1a8d183debe102228dc333b526bdb 100644 (file)
@@ -1709,6 +1709,9 @@ Cache::allocateBlock(Addr addr, bool is_secure, PacketList &writebacks)
                     addr, is_secure ? "s" : "ns",
                     blk->isDirty() ? "writeback" : "clean");
 
+            if (blk->wasPrefetched()) {
+                unusedPrefetches++;
+            }
             // Will send up Writeback/CleanEvict snoops via isCachedAbove
             // when pushing this writeback list into the write buffer.
             if (blk->isDirty() || writebackClean) {