36#include "mem/ruby/protocol/RubyRequest.hh"
47using gem5::stl_helpers::operator<<;
60 record_map.insert(std::make_pair(
addr, dflt));
61 AddressMap::iterator
i =
r.first;
74 const AddressMap &record_map, std::string description,
77 const int records_printed = 100;
82 AddressMap::const_iterator
i = record_map.begin();
83 AddressMap::const_iterator end = record_map.end();
84 for (;
i != end; ++
i) {
87 sorted.push_back(record);
91 out <<
"Total_entries_" << description <<
": " << record_map.size()
94 out <<
"Total_Instructions_" << description <<
": " << misses
97 out <<
"Total_data_misses_" << description <<
": " << misses
101 out <<
"total | load store atomic | user supervisor | sharing | touched-by"
112 m_touched_vec.resize(num_of_sequencers+1);
113 m_touched_weighted_vec.resize(num_of_sequencers+1);
114 for (
int j = 0; j < m_touched_vec.size(); j++) {
115 m_touched_vec[j] = 0;
116 m_touched_weighted_vec[j] = 0;
120 int max = sorted.size();
121 while (counter < max && counter < records_printed) {
123 double percent = 100.0 * (record->
getTotal() / double(misses));
124 out << description <<
" | " << percent <<
" % " << *record
133 while (counter < max) {
143 out <<
"all_records_" << description <<
": "
144 << all_records << std::endl
145 <<
"all_records_log_" << description <<
": "
146 << all_records_log << std::endl
147 <<
"remaining_records_" << description <<
": "
148 << remaining_records << std::endl
149 <<
"remaining_records_log_" << description <<
": "
150 << remaining_records_log << std::endl
151 <<
"touched_by_" << description <<
": "
152 << m_touched_vec << std::endl
153 <<
"touched_by_weighted_" << description <<
": "
154 << m_touched_weighted_vec << std::endl
159 : m_profiler(profiler)
186 out <<
"AddressProfiler Stats" << std::endl;
187 out <<
"---------------------" << std::endl;
197 out <<
"Hot Data Blocks" << std::endl;
198 out <<
"---------------" << std::endl;
204 out <<
"Hot MacroData Blocks" << std::endl;
205 out <<
"--------------------" << std::endl;
210 out <<
"Hot Instructions" << std::endl;
211 out <<
"----------------" << std::endl;
219 out <<
"All Instructions Profile:" << std::endl;
220 out <<
"-------------------------" << std::endl;
228 out <<
"Retry Profile" << std::endl;
229 out <<
"-------------" << std::endl;
238 out <<
"retry_histogram_percent: ";
266 const Set& owner,
const Set& sharers,
270 indirection_set.
addSet(sharers);
271 indirection_set.
addSet(owner);
272 indirection_set.
remove(requestor);
273 int num_indirections = indirection_set.
count();
276 bool indirection_miss = (num_indirections > 0);
278 addTraceSample(datablock, PC, RubyRequestType_ST, RubyAccessMode(0),
279 requestor, indirection_miss);
284 const Set& owner,
const Set& sharers,
288 indirection_set.
addSet(owner);
289 indirection_set.
remove(requestor);
290 int num_indirections = indirection_set.
count();
293 bool indirection_miss = (num_indirections > 0);
295 addTraceSample(datablock, PC, RubyRequestType_LD, RubyAccessMode(0),
296 requestor, indirection_miss);
301 RubyRequestType
type,
302 RubyAccessMode access_mode,
NodeID id,
314 update(
type, access_mode,
id, sharing_miss);
319 Addr macro_addr = mbits<Addr>(data_addr, 63, 10);
321 update(
type, access_mode,
id, sharing_miss);
325 update(
type, access_mode,
id, sharing_miss);
333 update(
type, access_mode,
id, sharing_miss);
341 if (
type == AccessType_Read) {
static bool less_equal(const AccessTraceForAddress *n1, const AccessTraceForAddress *n2)
void addSample(int value)
void setAddress(Addr addr)
void profileGetX(Addr datablock, Addr PC, const Set &owner, const Set &sharers, NodeID requestor)
void setHotLines(bool hot_lines)
Histogram m_retryProfileHistoRead
AddressProfiler(int num_of_sequencers, Profiler *profiler)
void profileRetry(Addr data_addr, AccessType type, int count)
std::unordered_map< Addr, AccessTraceForAddress > AddressMap
Histogram m_retryProfileHistoWrite
int64_t m_sharing_miss_counter
void addTraceSample(Addr data_addr, Addr pc_addr, RubyRequestType type, RubyAccessMode access_mode, NodeID id, bool sharing_miss)
Histogram m_gets_sharing_histogram
AddressMap m_programCounterAccessTrace
AddressMap m_dataAccessTrace
AddressMap m_macroBlockAccessTrace
Histogram m_getx_sharing_histogram
void setAllInstructions(bool all_instructions)
Histogram m_retryProfileHisto
void profileGetS(Addr datablock, Addr PC, const Set &owner, const Set &sharers, NodeID requestor)
AddressMap m_retryProfileMap
void printStats(std::ostream &out) const
void printPercent(std::ostream &out) const
RubySystem * m_ruby_system
bool getAllInstructions() const
uint32_t getBlockSizeBits()
void remove(NodeID index)
void addSet(const Set &obj)
Addr makeLineAddress(Addr addr, int cacheLineBits)
void printSorted(std::ostream &out, int num_of_sequencers, const AddressMap &record_map, std::string description, Profiler *profiler)
AccessTraceForAddress & lookupTraceForAddress(Addr addr, AddressMap &record_map)
AddressProfiler::AddressMap AddressMap
Copyright (c) 2024 Arm Limited All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.