AddressProfiler.cc (6284:a63d1dc4c820) AddressProfiler.cc (6285:ce086eca1ede)
1
2/*
3 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

--- 53 unchanged lines hidden (view full) ---

62{
63 delete m_dataAccessTrace;
64 delete m_macroBlockAccessTrace;
65 delete m_programCounterAccessTrace;
66 delete m_retryProfileMap;
67 delete m_persistentPredictionProfileMap;
68}
69
1
2/*
3 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

--- 53 unchanged lines hidden (view full) ---

62{
63 delete m_dataAccessTrace;
64 delete m_macroBlockAccessTrace;
65 delete m_programCounterAccessTrace;
66 delete m_retryProfileMap;
67 delete m_persistentPredictionProfileMap;
68}
69
70void AddressProfiler::setHotLines(bool hot_lines){
71 m_hot_lines = hot_lines;
72}
73void AddressProfiler::setAllInstructions(bool all_instructions){
74 m_all_instructions = all_instructions;
75}
76
70void AddressProfiler::printStats(ostream& out) const
71{
77void AddressProfiler::printStats(ostream& out) const
78{
72 if (PROFILE_HOT_LINES) {
79 if (m_hot_lines) {
73 out << endl;
74 out << "AddressProfiler Stats" << endl;
75 out << "---------------------" << endl;
76
77 out << endl;
78 out << "sharing_misses: " << m_sharing_miss_counter << endl;
79 out << "getx_sharing_histogram: " << m_getx_sharing_histogram << endl;
80 out << "gets_sharing_histogram: " << m_gets_sharing_histogram << endl;

--- 11 unchanged lines hidden (view full) ---

92 printSorted(out, m_macroBlockAccessTrace, "macroblock_address");
93
94 out << "Hot Instructions" << endl;
95 out << "----------------" << endl;
96 out << endl;
97 printSorted(out, m_programCounterAccessTrace, "pc_address");
98 }
99
80 out << endl;
81 out << "AddressProfiler Stats" << endl;
82 out << "---------------------" << endl;
83
84 out << endl;
85 out << "sharing_misses: " << m_sharing_miss_counter << endl;
86 out << "getx_sharing_histogram: " << m_getx_sharing_histogram << endl;
87 out << "gets_sharing_histogram: " << m_gets_sharing_histogram << endl;

--- 11 unchanged lines hidden (view full) ---

99 printSorted(out, m_macroBlockAccessTrace, "macroblock_address");
100
101 out << "Hot Instructions" << endl;
102 out << "----------------" << endl;
103 out << endl;
104 printSorted(out, m_programCounterAccessTrace, "pc_address");
105 }
106
100 if (PROFILE_ALL_INSTRUCTIONS){
107 if (m_all_instructions){
101 out << endl;
102 out << "All Instructions Profile:" << endl;
103 out << "-------------------------" << endl;
104 out << endl;
105 printSorted(out, m_programCounterAccessTrace, "pc_address");
106 out << endl;
107 }
108

--- 75 unchanged lines hidden (view full) ---

184 m_gets_sharing_histogram.add(num_indirections);
185 bool indirection_miss = (num_indirections > 0);
186
187 addTraceSample(datablock, PC, CacheRequestType_LD, AccessModeType(0), requestor, indirection_miss);
188}
189
190void AddressProfiler::addTraceSample(Address data_addr, Address pc_addr, CacheRequestType type, AccessModeType access_mode, NodeID id, bool sharing_miss)
191{
108 out << endl;
109 out << "All Instructions Profile:" << endl;
110 out << "-------------------------" << endl;
111 out << endl;
112 printSorted(out, m_programCounterAccessTrace, "pc_address");
113 out << endl;
114 }
115

--- 75 unchanged lines hidden (view full) ---

191 m_gets_sharing_histogram.add(num_indirections);
192 bool indirection_miss = (num_indirections > 0);
193
194 addTraceSample(datablock, PC, CacheRequestType_LD, AccessModeType(0), requestor, indirection_miss);
195}
196
197void AddressProfiler::addTraceSample(Address data_addr, Address pc_addr, CacheRequestType type, AccessModeType access_mode, NodeID id, bool sharing_miss)
198{
192 if (PROFILE_HOT_LINES) {
199 if (m_all_instructions) {
193 if (sharing_miss) {
194 m_sharing_miss_counter++;
195 }
196
197 // record data address trace info
198 data_addr.makeLineAddress();
199 lookupTraceForAddress(data_addr, m_dataAccessTrace).update(type, access_mode, id, sharing_miss);
200
201 // record macro data address trace info
202 Address macro_addr(data_addr.maskLowOrderBits(10)); // 6 for datablock, 4 to make it 16x more coarse
203 lookupTraceForAddress(macro_addr, m_macroBlockAccessTrace).update(type, access_mode, id, sharing_miss);
204
205 // record program counter address trace info
206 lookupTraceForAddress(pc_addr, m_programCounterAccessTrace).update(type, access_mode, id, sharing_miss);
207 }
208
200 if (sharing_miss) {
201 m_sharing_miss_counter++;
202 }
203
204 // record data address trace info
205 data_addr.makeLineAddress();
206 lookupTraceForAddress(data_addr, m_dataAccessTrace).update(type, access_mode, id, sharing_miss);
207
208 // record macro data address trace info
209 Address macro_addr(data_addr.maskLowOrderBits(10)); // 6 for datablock, 4 to make it 16x more coarse
210 lookupTraceForAddress(macro_addr, m_macroBlockAccessTrace).update(type, access_mode, id, sharing_miss);
211
212 // record program counter address trace info
213 lookupTraceForAddress(pc_addr, m_programCounterAccessTrace).update(type, access_mode, id, sharing_miss);
214 }
215
209 if (PROFILE_ALL_INSTRUCTIONS) {
216 if (m_all_instructions) {
210 // This code is used if the address profiler is an all-instructions profiler
211 // record program counter address trace info
212 lookupTraceForAddress(pc_addr, m_programCounterAccessTrace).update(type, access_mode, id, sharing_miss);
213 }
214}
215
216void AddressProfiler::profileRetry(const Address& data_addr, AccessType type, int count)
217{

--- 25 unchanged lines hidden (view full) ---

243 Vector<Address> keys = record_map->keys();
244 for(int i=0; i<keys.size(); i++){
245 AccessTraceForAddress* record = &(record_map->lookup(keys[i]));
246 misses += record->getTotal();
247 heap.insert(record);
248 }
249
250 out << "Total_entries_" << description << ": " << keys.size() << endl;
217 // This code is used if the address profiler is an all-instructions profiler
218 // record program counter address trace info
219 lookupTraceForAddress(pc_addr, m_programCounterAccessTrace).update(type, access_mode, id, sharing_miss);
220 }
221}
222
223void AddressProfiler::profileRetry(const Address& data_addr, AccessType type, int count)
224{

--- 25 unchanged lines hidden (view full) ---

250 Vector<Address> keys = record_map->keys();
251 for(int i=0; i<keys.size(); i++){
252 AccessTraceForAddress* record = &(record_map->lookup(keys[i]));
253 misses += record->getTotal();
254 heap.insert(record);
255 }
256
257 out << "Total_entries_" << description << ": " << keys.size() << endl;
251 if (PROFILE_ALL_INSTRUCTIONS)
258 if (g_system_ptr->getProfiler()->getAllInstructions())
252 out << "Total_Instructions_" << description << ": " << misses << endl;
253 else
254 out << "Total_data_misses_" << description << ": " << misses << endl;
255
256 out << "total | load store atomic | user supervisor | sharing | touched-by" << endl;
257
258 Histogram remaining_records(1, 100);
259 Histogram all_records(1, 100);
260 Histogram remaining_records_log(-1);
261 Histogram all_records_log(-1);
262
263 // Allows us to track how many lines where touched by n processors
264 Vector<int64> m_touched_vec;
265 Vector<int64> m_touched_weighted_vec;
259 out << "Total_Instructions_" << description << ": " << misses << endl;
260 else
261 out << "Total_data_misses_" << description << ": " << misses << endl;
262
263 out << "total | load store atomic | user supervisor | sharing | touched-by" << endl;
264
265 Histogram remaining_records(1, 100);
266 Histogram all_records(1, 100);
267 Histogram remaining_records_log(-1);
268 Histogram all_records_log(-1);
269
270 // Allows us to track how many lines where touched by n processors
271 Vector<int64> m_touched_vec;
272 Vector<int64> m_touched_weighted_vec;
266 m_touched_vec.setSize(RubyConfig::numberOfProcessors()+1);
267 m_touched_weighted_vec.setSize(RubyConfig::numberOfProcessors()+1);
273 m_touched_vec.setSize(RubySystem::getNumberOfSequencers()+1);
274 m_touched_weighted_vec.setSize(RubySystem::getNumberOfSequencers()+1);
268 for (int i=0; i<m_touched_vec.size(); i++) {
269 m_touched_vec[i] = 0;
270 m_touched_weighted_vec[i] = 0;
271 }
272
273 int counter = 0;
274 while((heap.size() > 0) && (counter < records_printed)) {
275 AccessTraceForAddress* record = heap.extractMin();

--- 35 unchanged lines hidden ---
275 for (int i=0; i<m_touched_vec.size(); i++) {
276 m_touched_vec[i] = 0;
277 m_touched_weighted_vec[i] = 0;
278 }
279
280 int counter = 0;
281 while((heap.size() > 0) && (counter < records_printed)) {
282 AccessTraceForAddress* record = heap.extractMin();

--- 35 unchanged lines hidden ---