36 #include "mem/ruby/protocol/RubyRequest.hh" 41 using m5::stl_helpers::operator<<;
54 record_map.insert(make_pair(addr, dflt));
55 AddressMap::iterator
i = r.first;
68 string description,
Profiler *profiler)
70 const int records_printed = 100;
75 AddressMap::const_iterator
i = record_map.begin();
76 AddressMap::const_iterator end = record_map.end();
77 for (; i != end; ++
i) {
80 sorted.push_back(record);
84 out <<
"Total_entries_" << description <<
": " << record_map.size()
87 out <<
"Total_Instructions_" << description <<
": " << misses << endl;
89 out <<
"Total_data_misses_" << description <<
": " << misses << endl;
91 out <<
"total | load store atomic | user supervisor | sharing | touched-by" 102 m_touched_vec.resize(num_of_sequencers+1);
103 m_touched_weighted_vec.resize(num_of_sequencers+1);
104 for (
int j = 0;
j < m_touched_vec.size();
j++) {
105 m_touched_vec[
j] = 0;
106 m_touched_weighted_vec[
j] = 0;
110 int max = sorted.size();
111 while (counter < max && counter < records_printed) {
113 double percent = 100.0 * (record->
getTotal() / double(misses));
114 out << description <<
" | " << percent <<
" % " << *record << endl;
122 while (counter < max) {
132 out <<
"all_records_" << description <<
": " 133 << all_records << endl
134 <<
"all_records_log_" << description <<
": " 135 << all_records_log << endl
136 <<
"remaining_records_" << description <<
": " 137 << remaining_records << endl
138 <<
"remaining_records_log_" << description <<
": " 139 << remaining_records_log << endl
140 <<
"touched_by_" << description <<
": " 141 << m_touched_vec << endl
142 <<
"touched_by_weighted_" << description <<
": " 143 << m_touched_weighted_vec << endl
148 : m_profiler(profiler)
175 out <<
"AddressProfiler Stats" << endl;
176 out <<
"---------------------" << endl;
184 out <<
"Hot Data Blocks" << endl;
185 out <<
"---------------" << endl;
191 out <<
"Hot MacroData Blocks" << endl;
192 out <<
"--------------------" << endl;
197 out <<
"Hot Instructions" << endl;
198 out <<
"----------------" << endl;
206 out <<
"All Instructions Profile:" << endl;
207 out <<
"-------------------------" << endl;
215 out <<
"Retry Profile" << endl;
216 out <<
"-------------" << endl;
222 out <<
"retry_histogram_percent: ";
250 const Set& owner,
const Set& sharers,
254 indirection_set.
addSet(sharers);
255 indirection_set.
addSet(owner);
256 indirection_set.
remove(requestor);
257 int num_indirections = indirection_set.
count();
260 bool indirection_miss = (num_indirections > 0);
262 addTraceSample(datablock, PC, RubyRequestType_ST, RubyAccessMode(0),
263 requestor, indirection_miss);
268 const Set& owner,
const Set& sharers,
272 indirection_set.
addSet(owner);
273 indirection_set.
remove(requestor);
274 int num_indirections = indirection_set.
count();
277 bool indirection_miss = (num_indirections > 0);
279 addTraceSample(datablock, PC, RubyRequestType_LD, RubyAccessMode(0),
280 requestor, indirection_miss);
285 RubyRequestType
type,
286 RubyAccessMode access_mode,
NodeID id,
297 update(type, access_mode,
id, sharing_miss);
302 Addr macro_addr = mbits<Addr>(data_addr, 63, 10);
304 update(type, access_mode,
id, sharing_miss);
308 update(type, access_mode,
id, sharing_miss);
316 update(type, access_mode,
id, sharing_miss);
324 if (type == AccessType_Read) {
void printStats(std::ostream &out) const
Histogram m_gets_sharing_histogram
std::unordered_map< Addr, AccessTraceForAddress > AddressMap
AddressMap m_dataAccessTrace
Histogram m_retryProfileHisto
Overload hash function for BasicBlockRange type.
void remove(NodeID index)
void setHotLines(bool hot_lines)
void printPercent(std::ostream &out) const
Histogram m_retryProfileHistoWrite
AddressProfiler(int num_of_sequencers, Profiler *profiler)
void setAddress(Addr addr)
void profileGetX(Addr datablock, Addr PC, const Set &owner, const Set &sharers, NodeID requestor)
void addTraceSample(Addr data_addr, Addr pc_addr, RubyRequestType type, RubyAccessMode access_mode, NodeID id, bool sharing_miss)
int64_t m_sharing_miss_counter
AccessTraceForAddress & lookupTraceForAddress(Addr addr, AddressMap &record_map)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Addr makeLineAddress(Addr addr)
AddressProfiler::AddressMap AddressMap
void addSet(const Set &obj)
void addSample(int value)
Histogram m_getx_sharing_histogram
void setAllInstructions(bool all_instructions)
void profileRetry(Addr data_addr, AccessType type, int count)
AddressMap m_programCounterAccessTrace
void printSorted(ostream &out, int num_of_sequencers, const AddressMap &record_map, string description, Profiler *profiler)
void profileGetS(Addr datablock, Addr PC, const Set &owner, const Set &sharers, NodeID requestor)
Histogram m_retryProfileHistoRead
bool getAllInstructions() const
AddressMap m_macroBlockAccessTrace
static bool less_equal(const AccessTraceForAddress *n1, const AccessTraceForAddress *n2)
AddressMap m_retryProfileMap