36#include "mem/ruby/protocol/RubyRequest.hh"
46using gem5::stl_helpers::operator<<;
59 record_map.insert(std::make_pair(
addr, dflt));
60 AddressMap::iterator
i =
r.first;
73 const AddressMap &record_map, std::string description,
76 const int records_printed = 100;
81 AddressMap::const_iterator
i = record_map.begin();
82 AddressMap::const_iterator end = record_map.end();
83 for (;
i != end; ++
i) {
86 sorted.push_back(record);
90 out <<
"Total_entries_" << description <<
": " << record_map.size()
93 out <<
"Total_Instructions_" << description <<
": " << misses
96 out <<
"Total_data_misses_" << description <<
": " << misses
100 out <<
"total | load store atomic | user supervisor | sharing | touched-by"
111 m_touched_vec.resize(num_of_sequencers+1);
112 m_touched_weighted_vec.resize(num_of_sequencers+1);
113 for (
int j = 0; j < m_touched_vec.size(); j++) {
114 m_touched_vec[j] = 0;
115 m_touched_weighted_vec[j] = 0;
119 int max = sorted.size();
120 while (counter < max && counter < records_printed) {
122 double percent = 100.0 * (record->
getTotal() / double(misses));
123 out << description <<
" | " << percent <<
" % " << *record
132 while (counter < max) {
142 out <<
"all_records_" << description <<
": "
143 << all_records << std::endl
144 <<
"all_records_log_" << description <<
": "
145 << all_records_log << std::endl
146 <<
"remaining_records_" << description <<
": "
147 << remaining_records << std::endl
148 <<
"remaining_records_log_" << description <<
": "
149 << remaining_records_log << std::endl
150 <<
"touched_by_" << description <<
": "
151 << m_touched_vec << std::endl
152 <<
"touched_by_weighted_" << description <<
": "
153 << m_touched_weighted_vec << std::endl
158 : m_profiler(profiler)
185 out <<
"AddressProfiler Stats" << std::endl;
186 out <<
"---------------------" << std::endl;
196 out <<
"Hot Data Blocks" << std::endl;
197 out <<
"---------------" << std::endl;
203 out <<
"Hot MacroData Blocks" << std::endl;
204 out <<
"--------------------" << std::endl;
209 out <<
"Hot Instructions" << std::endl;
210 out <<
"----------------" << std::endl;
218 out <<
"All Instructions Profile:" << std::endl;
219 out <<
"-------------------------" << std::endl;
227 out <<
"Retry Profile" << std::endl;
228 out <<
"-------------" << std::endl;
237 out <<
"retry_histogram_percent: ";
265 const Set& owner,
const Set& sharers,
269 indirection_set.
addSet(sharers);
270 indirection_set.
addSet(owner);
271 indirection_set.
remove(requestor);
272 int num_indirections = indirection_set.
count();
275 bool indirection_miss = (num_indirections > 0);
277 addTraceSample(datablock, PC, RubyRequestType_ST, RubyAccessMode(0),
278 requestor, indirection_miss);
283 const Set& owner,
const Set& sharers,
287 indirection_set.
addSet(owner);
288 indirection_set.
remove(requestor);
289 int num_indirections = indirection_set.
count();
292 bool indirection_miss = (num_indirections > 0);
294 addTraceSample(datablock, PC, RubyRequestType_LD, RubyAccessMode(0),
295 requestor, indirection_miss);
300 RubyRequestType
type,
301 RubyAccessMode access_mode,
NodeID id,
312 update(
type, access_mode,
id, sharing_miss);
319 update(
type, access_mode,
id, sharing_miss);
323 update(
type, access_mode,
id, sharing_miss);
331 update(
type, access_mode,
id, sharing_miss);
339 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
bool getAllInstructions() const
void remove(NodeID index)
void addSet(const Set &obj)
constexpr T mbits(T val, unsigned first, unsigned last)
Mask off the given bits in place like bits() but without shifting.
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
Addr makeLineAddress(Addr addr)
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.