Nikos Nikoleris has submitted this change and it was merged. ( https://gem5-review.googlesource.com/10428 )

Change subject: mem-cache: Move reference count stats update to blk invalidation
......................................................................

mem-cache: Move reference count stats update to blk invalidation

The tags in the cache keep track of the number of references to the
blocks as well as the average number of references between an
insertion and the next invalidation. Previously the stats where
updated only on block insertion and invalidations were ignored. This
changes moves the update of the counters to the block invalidation
function.

Change-Id: Ie7672c13813ec278a65232694024d2e5e17c4612
Reviewed-on: https://gem5-review.googlesource.com/10428
Maintainer: Nikos Nikoleris <nikos.nikole...@arm.com>
Reviewed-by: Daniel Carvalho <oda...@yahoo.com.br>
---
M src/mem/cache/tags/base.cc
M src/mem/cache/tags/base.hh
2 files changed, 8 insertions(+), 11 deletions(-)

Approvals:
  Daniel Carvalho: Looks good to me, approved
  Nikos Nikoleris: Looks good to me, approved



diff --git a/src/mem/cache/tags/base.cc b/src/mem/cache/tags/base.cc
index 0087de8..dfd6976 100644
--- a/src/mem/cache/tags/base.cc
+++ b/src/mem/cache/tags/base.cc
@@ -78,16 +78,8 @@
     // Get address
     Addr addr = pkt->getAddr();

-    // If we're replacing a block that was previously valid update
-    // stats for it. This can't be done in findBlock() because a
-    // found block might not actually be replaced there if the
-    // coherence protocol says it can't be.
     if (blk->isValid()) {
-        totalRefs += blk->refCount;
-        ++sampledRefs;
-
         invalidate(blk);
-        blk->invalidate();
     }

     // Previous block, if existed, has been removed, and now we have
diff --git a/src/mem/cache/tags/base.hh b/src/mem/cache/tags/base.hh
index c04329f..47bab43 100644
--- a/src/mem/cache/tags/base.hh
+++ b/src/mem/cache/tags/base.hh
@@ -239,16 +239,21 @@
     }

     /**
-     * This function updates the tags when a block is invalidated but
-     * does not invalidate the block itself.
-     * @param blk The block to invalidate.
+     * This function updates the tags when a block is invalidated
+     *
+     * @param blk A valid block to invalidate.
      */
     virtual void invalidate(CacheBlk *blk)
     {
         assert(blk);
         assert(blk->isValid());
+
         tagsInUse--;
         occupancies[blk->srcMasterId]--;
+        totalRefs += blk->refCount;
+        sampledRefs++;
+
+        blk->invalidate();
     }

     /**

--
To view, visit https://gem5-review.googlesource.com/10428
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Ie7672c13813ec278a65232694024d2e5e17c4612
Gerrit-Change-Number: 10428
Gerrit-PatchSet: 7
Gerrit-Owner: Nikos Nikoleris <nikos.nikole...@arm.com>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: Nikos Nikoleris <nikos.nikole...@arm.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to