action(uu_profileMiss, "\u", desc="Profile the demand miss") {
peek(mandatoryQueue_in, CacheMsg) {
- // profile_miss(in_msg, id);
+ if (L1DcacheMemory.isTagPresent(address)) {
+ L1DcacheMemory.profileMiss(in_msg);
+ } else {
+ L1IcacheMemory.profileMiss(in_msg);
+ }
}
}
}
}
+ GenericRequestType convertToGenericType(CoherenceRequestType type) {
+ if(type == CoherenceRequestType:GETS) {
+ return GenericRequestType:GETS;
+ } else if(type == CoherenceRequestType:GETX) {
+ return GenericRequestType:GETX;
+ } else {
+ DEBUG_EXPR(type);
+ error("invalid CoherenceRequestType");
+ }
+ }
+
// ** OUT_PORTS **
out_port(globalRequestNetwork_out, RequestMsg, GlobalRequestFromL2Cache);
out_port(localRequestNetwork_out, RequestMsg, L1RequestFromL2Cache);
L2cacheMemory.deallocate(address);
}
- //action(uu_profileMiss, "\u", desc="Profile the demand miss") {
- // peek(L1requestNetwork_in, RequestMsg) {
- // AccessModeType not implemented
- //profile_L2Cache_miss(convertToGenericType(in_msg.Type), in_msg.AccessMode, MessageSizeTypeToInt(in_msg.MessageSize), in_msg.Prefetch, machineIDToNodeID(in_msg.Requestor));
- // }
- //}
+ action(uu_profileMiss, "\u", desc="Profile the demand miss") {
+ peek(L1requestNetwork_in, RequestMsg) {
+ L2cacheMemory.profileGenericRequest(convertToGenericType(in_msg.Type),
+ in_msg.AccessMode,
+ in_msg.Prefetch);
+ }
+ }
action(w_assertIncomingDataAndCacheDataMatch, "w", desc="Assert that the incoming data and the data in the cache match") {
transition(NP, {L1_GETS, L1_GETX}) {
a_broadcastLocalRequest;
r_markNewSharer;
- //uu_profileMiss;
+ uu_profileMiss;
o_popL1RequestQueue;
}
a_broadcastLocalRequest;
tt_sendLocalAckWithCollectedTokens; // send any tokens we have collected
r_markNewSharer;
- //uu_profileMiss;
+ uu_profileMiss;
o_popL1RequestQueue;
}
a_broadcastLocalRequest;
tt_sendLocalAckWithCollectedTokens; // send any tokens we have collected
r_markNewSharer;
- //uu_profileMiss;
+ uu_profileMiss;
o_popL1RequestQueue;
}
tt_sendLocalAckWithCollectedTokens;
r_markNewSharer;
r_setMRU;
- //uu_profileMiss;
+ uu_profileMiss;
o_popL1RequestQueue;
}
k_dataAndAllTokensFromL2CacheToL1Requestor;
r_markNewSharer;
r_setMRU;
- //uu_profileMiss;
+ uu_profileMiss;
o_popL1RequestQueue;
}
transition(I_L, {L1_GETX, L1_GETS}) {
a_broadcastLocalRequest;
r_markNewSharer;
- //uu_profileMiss;
+ uu_profileMiss;
o_popL1RequestQueue;
}
tt_sendLocalAckWithCollectedTokens;
r_markNewSharer;
r_setMRU;
- //uu_profileMiss;
+ uu_profileMiss;
o_popL1RequestQueue;
}
DataBlock DataBlk, desc="DataBlk attached to this request";
MessageSizeType MessageSize, desc="size category of the message";
}
-
-//GenericRequestType convertToGenericType(CoherenceRequestType type) {
-// if(type == CoherenceRequestType:GETS) {
-// return GenericRequestType:GETS;
-// } else if(type == CoherenceRequestType:GETX) {
-// return GenericRequestType:GETX;
-// } else {
-// DEBUG_EXPR(type);
-// error("invalid CoherenceRequestType");
-// }
-//}
void profile_L1Cache_miss(CacheMsg msg, NodeID l1cacheID);
// used by CMP protocols
-void profile_L2Cache_miss(GenericRequestType requestType, AccessModeType type, int msgSize, PrefetchBit pfBit, NodeID l2cacheID);
void profile_request(std::string L1CacheStateStr, std::string L2CacheStateStr,
std::string directoryStateStr, std::string requestTypeStr);
void profileMessageReordering(bool wasReordered);
void changePermission(Address, AccessPermission);
bool isTagPresent(Address);
void profileMiss(CacheMsg);
+
+ void profileGenericRequest(GenericRequestType,
+ AccessModeType,
+ PrefetchBit);
+
void setMRU(Address);
}
using namespace std;
CacheProfiler::CacheProfiler(const string& description)
- : m_requestTypeVec(int(CacheRequestType_NUM))
+ : m_cacheRequestType(int(CacheRequestType_NUM)), m_genericRequestType(int(GenericRequestType_NUM))
{
m_description = description;
int requests = 0;
for (int i = 0; i < int(CacheRequestType_NUM); i++) {
- requests += m_requestTypeVec[i];
+ requests += m_cacheRequestType[i];
+ }
+
+ for (int i = 0; i < int(GenericRequestType_NUM); i++) {
+ requests += m_genericRequestType[i];
}
assert(m_misses == requests);
if (requests > 0) {
for (int i = 0; i < int(CacheRequestType_NUM); i++) {
- if (m_requestTypeVec[i] > 0) {
+ if (m_cacheRequestType[i] > 0) {
out << description << "_request_type_"
<< CacheRequestType_to_string(CacheRequestType(i))
<< ": "
- << 100.0 * (double)m_requestTypeVec[i] /
+ << 100.0 * (double)m_cacheRequestType[i] /
+ (double)requests
+ << "%" << endl;
+ }
+ }
+
+ for (int i = 0; i < int(GenericRequestType_NUM); i++) {
+ if (m_genericRequestType[i] > 0) {
+ out << description << "_request_type_"
+ << GenericRequestType_to_string(GenericRequestType(i))
+ << ": "
+ << 100.0 * (double)m_genericRequestType[i] /
(double)requests
<< "%" << endl;
}
}
}
- out << description << "_request_size: " << m_requestSize << endl;
out << endl;
}
CacheProfiler::clearStats()
{
for (int i = 0; i < int(CacheRequestType_NUM); i++) {
- m_requestTypeVec[i] = 0;
+ m_cacheRequestType[i] = 0;
+ }
+ for (int i = 0; i < int(GenericRequestType_NUM); i++) {
+ m_genericRequestType[i] = 0;
}
- m_requestSize.clear();
m_misses = 0;
m_demand_misses = 0;
m_prefetches = 0;
}
void
-CacheProfiler::addStatSample(CacheRequestType requestType,
- AccessModeType type, int msgSize,
+CacheProfiler::addCacheStatSample(CacheRequestType requestType,
+ AccessModeType accessType,
+ PrefetchBit pfBit)
+{
+ m_cacheRequestType[requestType]++;
+ addStatSample(accessType, pfBit);
+}
+
+void
+CacheProfiler::addGenericStatSample(GenericRequestType requestType,
+ AccessModeType accessType,
+ PrefetchBit pfBit)
+{
+ m_genericRequestType[requestType]++;
+ addStatSample(accessType, pfBit);
+}
+
+void
+CacheProfiler::addStatSample(AccessModeType accessType,
PrefetchBit pfBit)
{
m_misses++;
- m_requestTypeVec[requestType]++;
-
- m_accessModeTypeHistogram[type]++;
- m_requestSize.add(msgSize);
+ m_accessModeTypeHistogram[accessType]++;
if (pfBit == PrefetchBit_No) {
m_demand_misses++;
} else if (pfBit == PrefetchBit_Yes) {
#include "mem/protocol/AccessModeType.hh"
#include "mem/protocol/CacheRequestType.hh"
+#include "mem/protocol/GenericRequestType.hh"
#include "mem/protocol/PrefetchBit.hh"
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/common/Histogram.hh"
void printStats(std::ostream& out) const;
void clearStats();
- void addStatSample(CacheRequestType requestType, AccessModeType type,
- int msgSize, PrefetchBit pfBit);
+ void addCacheStatSample(CacheRequestType requestType,
+ AccessModeType type,
+ PrefetchBit pfBit);
+
+ void addGenericStatSample(GenericRequestType requestType,
+ AccessModeType type,
+ PrefetchBit pfBit);
void print(std::ostream& out) const;
// Private copy constructor and assignment operator
CacheProfiler(const CacheProfiler& obj);
CacheProfiler& operator=(const CacheProfiler& obj);
+ void addStatSample(AccessModeType type, PrefetchBit pfBit);
std::string m_description;
- Histogram m_requestSize;
int64 m_misses;
int64 m_demand_misses;
int64 m_prefetches;
int64 m_hw_prefetches;
int64 m_accessModeTypeHistogram[AccessModeType_NUM];
- std::vector<int> m_requestTypeVec;
+ std::vector<int> m_cacheRequestType;
+ std::vector<int> m_genericRequestType;
};
inline std::ostream&
const std::string& requestTypeStr);
void profile_miss(const CacheMsg& msg, NodeID id);
void profile_L1Cache_miss(const CacheMsg& msg, NodeID id);
-void profile_L2Cache_miss(GenericRequestType requestType, AccessModeType type,
- int msgSize, PrefetchBit pfBit, NodeID l2cacheID);
void profile_token_retry(const Address& addr, AccessType type, int count);
void profile_filter_action(int action);
void profile_persistent_prediction(const Address& addr, AccessType type);
void
CacheMemory::profileMiss(const CacheMsg& msg)
{
- m_profiler_ptr->addStatSample(msg.getType(), msg.getAccessMode(),
- msg.getSize(), msg.getPrefetch());
+ m_profiler_ptr->addCacheStatSample(msg.getType(),
+ msg.getAccessMode(),
+ msg.getPrefetch());
+}
+
+void
+CacheMemory::profileGenericRequest(GenericRequestType requestType,
+ AccessModeType accessType,
+ PrefetchBit pfBit)
+{
+ m_profiler_ptr->addGenericStatSample(requestType,
+ accessType,
+ pfBit);
}
void
#include "mem/protocol/AccessPermission.hh"
#include "mem/protocol/CacheMsg.hh"
#include "mem/protocol/CacheRequestType.hh"
+#include "mem/protocol/GenericRequestType.hh"
#include "mem/protocol/MachineType.hh"
#include "mem/ruby/common/Address.hh"
#include "mem/ruby/common/DataBlock.hh"
void profileMiss(const CacheMsg & msg);
+ void profileGenericRequest(GenericRequestType requestType,
+ AccessModeType accessType,
+ PrefetchBit pfBit);
+
void getMemoryValue(const Address& addr, char* value,
unsigned int size_in_bytes);
void setMemoryValue(const Address& addr, char* value,