summaryrefslogtreecommitdiff
path: root/src/mem
diff options
context:
space:
mode:
authorLisa Hsu <Lisa.Hsu@amd.com>2010-02-24 13:46:55 -0800
committerLisa Hsu <Lisa.Hsu@amd.com>2010-02-24 13:46:55 -0800
commit7f3cd9a9fd636c1e48dcec20de3f6c14214d0ce4 (patch)
treeca8a2c9e806fcf32ba58aea14ccc056132e0ce9d /src/mem
parent1d3228481f3c5f9a4ad041cd21d57139f5f8f331 (diff)
downloadgem5-7f3cd9a9fd636c1e48dcec20de3f6c14214d0ce4.tar.xz
cache stats: account for writebacks and/or device occupancy in the cache.
Plus, a minor bugfix that neglects to update blk->contextSrc in certain cases on a cache insert.
Diffstat (limited to 'src/mem')
-rw-r--r--src/mem/cache/tags/base.cc2
-rw-r--r--src/mem/cache/tags/lru.cc8
2 files changed, 8 insertions, 2 deletions
diff --git a/src/mem/cache/tags/base.cc b/src/mem/cache/tags/base.cc
index 8c6c145ca..41cc11b23 100644
--- a/src/mem/cache/tags/base.cc
+++ b/src/mem/cache/tags/base.cc
@@ -88,7 +88,7 @@ BaseTags::regStats(const string &name)
;
occupancies
- .init(cache->numCpus())
+ .init(cache->numCpus() + 1)
.name(name + ".occ_blocks")
.desc("Average occupied blocks per context")
.flags(nozero | nonan)
diff --git a/src/mem/cache/tags/lru.cc b/src/mem/cache/tags/lru.cc
index 0da2a72e9..0667c5428 100644
--- a/src/mem/cache/tags/lru.cc
+++ b/src/mem/cache/tags/lru.cc
@@ -162,6 +162,8 @@ LRU::findVictim(Addr addr, PacketList &writebacks)
if (blk->contextSrc != -1) {
occupancies[blk->contextSrc % cache->numCpus()]--;
blk->contextSrc = -1;
+ } else {
+ occupancies[cache->numCpus()]--;
}
DPRINTF(CacheRepl, "set %x: selecting blk %x for replacement\n",
@@ -188,8 +190,10 @@ LRU::insertBlock(Addr addr, BlkType *blk, int context_src)
// deal with what we are bringing in
if (context_src != -1) {
occupancies[context_src % cache->numCpus()]++;
- blk->contextSrc = context_src;
+ } else {
+ occupancies[cache->numCpus()]++;
}
+ blk->contextSrc = context_src;
unsigned set = extractSet(addr);
sets[set].moveToHead(blk);
@@ -206,6 +210,8 @@ LRU::invalidateBlk(BlkType *blk)
if (blk->contextSrc != -1) {
occupancies[blk->contextSrc % cache->numCpus()]--;
blk->contextSrc = -1;
+ } else {
+ occupancies[cache->numCpus()]--;
}
}
}