diff options
author | Lisa Hsu <Lisa.Hsu@amd.com> | 2010-02-24 13:46:55 -0800 |
---|---|---|
committer | Lisa Hsu <Lisa.Hsu@amd.com> | 2010-02-24 13:46:55 -0800 |
commit | 7f3cd9a9fd636c1e48dcec20de3f6c14214d0ce4 (patch) | |
tree | ca8a2c9e806fcf32ba58aea14ccc056132e0ce9d /src/mem/cache | |
parent | 1d3228481f3c5f9a4ad041cd21d57139f5f8f331 (diff) | |
download | gem5-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/cache')
-rw-r--r-- | src/mem/cache/tags/base.cc | 2 | ||||
-rw-r--r-- | src/mem/cache/tags/lru.cc | 8 |
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()]--; } } } |