diff options
author | Joel Hestness <hestness@cs.utexas.edu> | 2012-07-10 22:51:54 -0700 |
---|---|---|
committer | Joel Hestness <hestness@cs.utexas.edu> | 2012-07-10 22:51:54 -0700 |
commit | 467093ebf238a1954e00576daf14a9f246b51e79 (patch) | |
tree | 1e3a355e93a62174b112e97e81f5d7aa62299016 /src/mem/ruby/system/CacheMemory.cc | |
parent | c10f348120ae4a61c782815280673fba5ee71157 (diff) | |
download | gem5-467093ebf238a1954e00576daf14a9f246b51e79.tar.xz |
ruby: tag and data cache access support
Updates to Ruby to support statistics counting of cache accesses. This feature
serves multiple purposes beyond simple stats collection. It provides the
foundation for ruby to model the cache tag and data arrays as physical
resources, as well as provide the necessary input data for McPAT power
modeling.
Diffstat (limited to 'src/mem/ruby/system/CacheMemory.cc')
-rw-r--r-- | src/mem/ruby/system/CacheMemory.cc | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/mem/ruby/system/CacheMemory.cc b/src/mem/ruby/system/CacheMemory.cc index 9144a8dff..a626dc13f 100644 --- a/src/mem/ruby/system/CacheMemory.cc +++ b/src/mem/ruby/system/CacheMemory.cc @@ -29,6 +29,7 @@ #include "base/intmath.hh" #include "debug/RubyCache.hh" #include "debug/RubyCacheTrace.hh" +#include "debug/RubyStats.hh" #include "mem/protocol/AccessPermission.hh" #include "mem/ruby/system/CacheMemory.hh" #include "mem/ruby/system/System.hh" @@ -476,3 +477,50 @@ CacheMemory::isLocked(const Address& address, int context) return m_cache[cacheSet][loc]->m_locked == context; } +void +CacheMemory::recordRequestType(CacheRequestType requestType) { + DPRINTF(RubyStats, "Recorded statistic: %s\n", + CacheRequestType_to_string(requestType)); + switch(requestType) { + case CacheRequestType_DataArrayRead: + numDataArrayReads++; + return; + case CacheRequestType_DataArrayWrite: + numDataArrayWrites++; + return; + case CacheRequestType_TagArrayRead: + numTagArrayReads++; + return; + case CacheRequestType_TagArrayWrite: + numTagArrayWrites++; + return; + default: + warn("CacheMemory access_type not found: %s", + CacheRequestType_to_string(requestType)); + } +} + +void +CacheMemory::regStats() { + using namespace Stats; + + numDataArrayReads + .name(name() + ".num_data_array_reads") + .desc("number of data array reads") + ; + + numDataArrayWrites + .name(name() + ".num_data_array_writes") + .desc("number of data array writes") + ; + + numTagArrayReads + .name(name() + ".num_tag_array_reads") + .desc("number of tag array reads") + ; + + numTagArrayWrites + .name(name() + ".num_tag_array_writes") + .desc("number of tag array writes") + ; +} |