mem-cache: Move replacements stat to the base cache class
authorNikos Nikoleris <nikos.nikoleris@arm.com>
Thu, 10 May 2018 10:30:21 +0000 (11:30 +0100)
committerNikos Nikoleris <nikos.nikoleris@arm.com>
Thu, 17 May 2018 14:37:40 +0000 (14:37 +0000)
Change-Id: I25dbcfcddfe1c422a76eb1af3f726c1360d8d110
Reviewed-on: https://gem5-review.googlesource.com/10426
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
src/mem/cache/base.cc
src/mem/cache/base.hh
src/mem/cache/cache.cc
src/mem/cache/tags/base.cc
src/mem/cache/tags/base.hh

index 2c7d9fb68be70c241392918c5a77a319e3f95dbb..8143acd674164fad7be64fca354a49bbaaf3cd94 100644 (file)
@@ -758,4 +758,8 @@ BaseCache::regStats()
         overallAvgMshrUncacheableLatency.subname(i, system->getMasterName(i));
     }
 
+    replacements
+        .name(name() + ".replacements")
+        .desc("number of replacements")
+        ;
 }
index b006d4b64e85179da777048152ff26521746c558..69c4818258192ddb7676de762146ed48760539d7 100644 (file)
@@ -453,6 +453,9 @@ class BaseCache : public MemObject
     /** The average overall latency of an MSHR miss. */
     Stats::Formula overallAvgMshrUncacheableLatency;
 
+    /** Number of replacements of valid blocks. */
+    Stats::Scalar replacements;
+
     /**
      * @}
      */
index b9625beeee535b7780f9060698b90a4e90ef0abd..73c7e1956ad6384df0acd3d879d734aa02ef5527 100644 (file)
@@ -1827,6 +1827,7 @@ Cache::allocateBlock(Addr addr, bool is_secure, PacketList &writebacks)
             } else {
                 writebacks.push_back(cleanEvictBlk(blk));
             }
+            replacements++;
         }
     }
 
index 1d6ed46637329d07b7993f11040a20d26c4f205c..75d117e9cf93adee8de0bcae6d2b67663cc9669b 100644 (file)
@@ -48,7 +48,6 @@
 
 #include "mem/cache/tags/base.hh"
 
-#include "cpu/smt.hh" //maxThreadsPerCPU
 #include "mem/cache/base.hh"
 #include "sim/sim_exit.hh"
 
@@ -92,7 +91,6 @@ BaseTags::insertBlock(PacketPtr pkt, CacheBlk *blk)
     // found block might not actually be replaced there if the
     // coherence protocol says it can't be.
     if (blk->isValid()) {
-        replacements[0]++;
         totalRefs += blk->refCount;
         ++sampledRefs;
 
@@ -125,13 +123,6 @@ BaseTags::regStats()
 
     using namespace Stats;
 
-    replacements
-        .init(maxThreadsPerCPU)
-        .name(name() + ".replacements")
-        .desc("number of replacements")
-        .flags(total)
-        ;
-
     tagsInUse
         .name(name() + ".tagsinuse")
         .desc("Cycle average of tags in use")
index 4cf67747b85f8b23ea6bbb052f9dbcb64a037d38..c04329fe9f5aca0d28a6b96fdd13015876254fcd 100644 (file)
@@ -104,8 +104,6 @@ class BaseTags : public ClockedObject
      * @{
      */
 
-    /** Number of replacements of valid blocks per thread. */
-    Stats::Vector replacements;
     /** Per cycle average of the number of tags that hold valid data. */
     Stats::Average tagsInUse;