Cache: Fix the LRU policy for classic memory hierarchy
[gem5.git] / src / mem / cache / tags / base.hh
index b7b0c7ef03ac88115ef498c8aad2547b79a2ccf6..576b512e50785dbd6c146cb09081ae9e2159fcde 100644 (file)
@@ -38,8 +38,9 @@
 #define __BASE_TAGS_HH__
 
 #include <string>
-#include "base/statistics.hh"
+
 #include "base/callback.hh"
+#include "base/statistics.hh"
 
 class BaseCache;
 
@@ -63,6 +64,9 @@ class BaseTags
     /** Marked true when the cache is warmed up. */
     bool warmedUp;
 
+    /** the number of blocks in the cache */
+    unsigned numBlocks;
+
     // Statistics
     /**
      * @addtogroup CacheStatistics
@@ -70,19 +74,19 @@ class BaseTags
      */
 
     /** Number of replacements of valid blocks per thread. */
-    Stats::Vector<> replacements;
+    Stats::Vector replacements;
     /** Per cycle average of the number of tags that hold valid data. */
-    Stats::Average<> tagsInUse;
+    Stats::Average tagsInUse;
 
     /** The total number of references to a block before it is replaced. */
-    Stats::Scalar<> totalRefs;
+    Stats::Scalar totalRefs;
 
     /**
      * The number of reference counts sampled. This is different from
      * replacements because we sample all the valid blocks when the simulator
      * exits.
      */
-    Stats::Scalar<> sampledRefs;
+    Stats::Scalar sampledRefs;
 
     /**
      * Average number of references to a block before is was replaced.
@@ -91,7 +95,14 @@ class BaseTags
     Stats::Formula avgRefs;
 
     /** The cycle that the warmup percentage was hit. */
-    Stats::Scalar<> warmupCycle;
+    Stats::Scalar warmupCycle;
+
+    /** Average occupancy of each requestor using the cache */
+    Stats::AverageVector occupancies;
+
+    /** Average occ % of each requestor using the cache */
+    Stats::Formula avgOccs;
+
     /**
      * @}
      */
@@ -130,6 +141,12 @@ class BaseTags
      * exits.
      */
     virtual void cleanupRefs() {}
+
+    /**
+     *iterated through all blocks and clear all locks
+     *Needed to clear all lock tracking at once
+     */
+    virtual void clearLocks() {}
 };
 
 class BaseTagsCallback : public Callback