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
9 * notice, this list of conditions and the following disclaimer;
10 * redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution;
13 * neither the name of the copyright holders nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/*
31 * AddressProfiler.cc
32 *
33 * Description: See AddressProfiler.hh
34 *
35 * $Id$
36 *
37 */
38
39#include "mem/ruby/profiler/AddressProfiler.hh"
40#include "mem/protocol/CacheMsg.hh"
41#include "mem/ruby/profiler/AccessTraceForAddress.hh"
42#include "mem/gems_common/PrioHeap.hh"
43#include "mem/gems_common/Map.hh"
44#include "mem/ruby/system/System.hh"
45#include "mem/ruby/profiler/Profiler.hh"
46
47// Helper functions
48static AccessTraceForAddress& lookupTraceForAddress(const Address& addr, Map<Address, AccessTraceForAddress>* record_map);
49static void printSorted(ostream& out, const Map<Address, AccessTraceForAddress>* record_map, string description);
50
51AddressProfiler::AddressProfiler()
52{
53 m_dataAccessTrace = new Map<Address, AccessTraceForAddress>;
54 m_macroBlockAccessTrace = new Map<Address, AccessTraceForAddress>;
55 m_programCounterAccessTrace = new Map<Address, AccessTraceForAddress>;
56 m_retryProfileMap = new Map<Address, AccessTraceForAddress>;
57 m_persistentPredictionProfileMap = new Map<Address, AccessTraceForAddress>;
58 clearStats();
59}
60
61AddressProfiler::~AddressProfiler()
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
9 * notice, this list of conditions and the following disclaimer;
10 * redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution;
13 * neither the name of the copyright holders nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/*
31 * AddressProfiler.cc
32 *
33 * Description: See AddressProfiler.hh
34 *
35 * $Id$
36 *
37 */
38
39#include "mem/ruby/profiler/AddressProfiler.hh"
40#include "mem/protocol/CacheMsg.hh"
41#include "mem/ruby/profiler/AccessTraceForAddress.hh"
42#include "mem/gems_common/PrioHeap.hh"
43#include "mem/gems_common/Map.hh"
44#include "mem/ruby/system/System.hh"
45#include "mem/ruby/profiler/Profiler.hh"
46
47// Helper functions
48static AccessTraceForAddress& lookupTraceForAddress(const Address& addr, Map<Address, AccessTraceForAddress>* record_map);
49static void printSorted(ostream& out, const Map<Address, AccessTraceForAddress>* record_map, string description);
50
51AddressProfiler::AddressProfiler()
52{
53 m_dataAccessTrace = new Map<Address, AccessTraceForAddress>;
54 m_macroBlockAccessTrace = new Map<Address, AccessTraceForAddress>;
55 m_programCounterAccessTrace = new Map<Address, AccessTraceForAddress>;
56 m_retryProfileMap = new Map<Address, AccessTraceForAddress>;
57 m_persistentPredictionProfileMap = new Map<Address, AccessTraceForAddress>;
58 clearStats();
59}
60
61AddressProfiler::~AddressProfiler()
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;
81
82 out << endl;
83 out << "Hot Data Blocks" << endl;
84 out << "---------------" << endl;
85 out << endl;
86 printSorted(out, m_dataAccessTrace, "block_address");
87
88 out << endl;
89 out << "Hot MacroData Blocks" << endl;
90 out << "--------------------" << endl;
91 out << endl;
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;
88
89 out << endl;
90 out << "Hot Data Blocks" << endl;
91 out << "---------------" << endl;
92 out << endl;
93 printSorted(out, m_dataAccessTrace, "block_address");
94
95 out << endl;
96 out << "Hot MacroData Blocks" << endl;
97 out << "--------------------" << endl;
98 out << endl;
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
109 if (m_retryProfileHisto.size() > 0) {
110 out << "Retry Profile" << endl;
111 out << "-------------" << endl;
112 out << endl;
113 out << "retry_histogram_absolute: " << m_retryProfileHisto << endl;
114 out << "retry_histogram_write: " << m_retryProfileHistoWrite << endl;
115 out << "retry_histogram_read: " << m_retryProfileHistoRead << endl;
116
117 out << "retry_histogram_percent: ";
118 m_retryProfileHisto.printPercent(out);
119 out << endl;
120
121 out << "retry_histogram_per_instruction: ";
122 m_retryProfileHisto.printWithMultiplier(out, 1.0 / double(g_system_ptr->getProfiler()->getTotalInstructionsExecuted()));
123 out << endl;
124
125 printSorted(out, m_retryProfileMap, "block_address");
126 out << endl;
127 }
128
129 if (m_persistentPredictionProfileHisto.size() > 0) {
130 out << "Persistent Prediction Profile" << endl;
131 out << "-------------" << endl;
132 out << endl;
133 out << "persistent prediction_histogram: " << m_persistentPredictionProfileHisto << endl;
134
135 out << "persistent prediction_histogram_percent: ";
136 m_persistentPredictionProfileHisto.printPercent(out);
137 out << endl;
138
139 out << "persistentPrediction_histogram_per_instruction: ";
140 m_persistentPredictionProfileHisto.printWithMultiplier(out, 1.0 / double(g_system_ptr->getProfiler()->getTotalInstructionsExecuted()));
141 out << endl;
142
143 printSorted(out, m_persistentPredictionProfileMap, "block_address");
144 out << endl;
145 }
146}
147
148void AddressProfiler::clearStats()
149{
150 // Clear the maps
151 m_sharing_miss_counter = 0;
152 m_dataAccessTrace->clear();
153 m_macroBlockAccessTrace->clear();
154 m_programCounterAccessTrace->clear();
155 m_retryProfileMap->clear();
156 m_retryProfileHisto.clear();
157 m_retryProfileHistoRead.clear();
158 m_retryProfileHistoWrite.clear();
159 m_getx_sharing_histogram.clear();
160 m_gets_sharing_histogram.clear();
161}
162
163void AddressProfiler::profileGetX(const Address& datablock, const Address& PC, const Set& owner, const Set& sharers, NodeID requestor)
164{
165 Set indirection_set;
166 indirection_set.addSet(sharers);
167 indirection_set.addSet(owner);
168 indirection_set.remove(requestor);
169 int num_indirections = indirection_set.count();
170
171 m_getx_sharing_histogram.add(num_indirections);
172 bool indirection_miss = (num_indirections > 0);
173
174 addTraceSample(datablock, PC, CacheRequestType_ST, AccessModeType(0), requestor, indirection_miss);
175}
176
177void AddressProfiler::profileGetS(const Address& datablock, const Address& PC, const Set& owner, const Set& sharers, NodeID requestor)
178{
179 Set indirection_set;
180 indirection_set.addSet(owner);
181 indirection_set.remove(requestor);
182 int num_indirections = indirection_set.count();
183
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
116 if (m_retryProfileHisto.size() > 0) {
117 out << "Retry Profile" << endl;
118 out << "-------------" << endl;
119 out << endl;
120 out << "retry_histogram_absolute: " << m_retryProfileHisto << endl;
121 out << "retry_histogram_write: " << m_retryProfileHistoWrite << endl;
122 out << "retry_histogram_read: " << m_retryProfileHistoRead << endl;
123
124 out << "retry_histogram_percent: ";
125 m_retryProfileHisto.printPercent(out);
126 out << endl;
127
128 out << "retry_histogram_per_instruction: ";
129 m_retryProfileHisto.printWithMultiplier(out, 1.0 / double(g_system_ptr->getProfiler()->getTotalInstructionsExecuted()));
130 out << endl;
131
132 printSorted(out, m_retryProfileMap, "block_address");
133 out << endl;
134 }
135
136 if (m_persistentPredictionProfileHisto.size() > 0) {
137 out << "Persistent Prediction Profile" << endl;
138 out << "-------------" << endl;
139 out << endl;
140 out << "persistent prediction_histogram: " << m_persistentPredictionProfileHisto << endl;
141
142 out << "persistent prediction_histogram_percent: ";
143 m_persistentPredictionProfileHisto.printPercent(out);
144 out << endl;
145
146 out << "persistentPrediction_histogram_per_instruction: ";
147 m_persistentPredictionProfileHisto.printWithMultiplier(out, 1.0 / double(g_system_ptr->getProfiler()->getTotalInstructionsExecuted()));
148 out << endl;
149
150 printSorted(out, m_persistentPredictionProfileMap, "block_address");
151 out << endl;
152 }
153}
154
155void AddressProfiler::clearStats()
156{
157 // Clear the maps
158 m_sharing_miss_counter = 0;
159 m_dataAccessTrace->clear();
160 m_macroBlockAccessTrace->clear();
161 m_programCounterAccessTrace->clear();
162 m_retryProfileMap->clear();
163 m_retryProfileHisto.clear();
164 m_retryProfileHistoRead.clear();
165 m_retryProfileHistoWrite.clear();
166 m_getx_sharing_histogram.clear();
167 m_gets_sharing_histogram.clear();
168}
169
170void AddressProfiler::profileGetX(const Address& datablock, const Address& PC, const Set& owner, const Set& sharers, NodeID requestor)
171{
172 Set indirection_set;
173 indirection_set.addSet(sharers);
174 indirection_set.addSet(owner);
175 indirection_set.remove(requestor);
176 int num_indirections = indirection_set.count();
177
178 m_getx_sharing_histogram.add(num_indirections);
179 bool indirection_miss = (num_indirections > 0);
180
181 addTraceSample(datablock, PC, CacheRequestType_ST, AccessModeType(0), requestor, indirection_miss);
182}
183
184void AddressProfiler::profileGetS(const Address& datablock, const Address& PC, const Set& owner, const Set& sharers, NodeID requestor)
185{
186 Set indirection_set;
187 indirection_set.addSet(owner);
188 indirection_set.remove(requestor);
189 int num_indirections = indirection_set.count();
190
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{
218 m_retryProfileHisto.add(count);
219 if (type == AccessType_Read) {
220 m_retryProfileHistoRead.add(count);
221 } else {
222 m_retryProfileHistoWrite.add(count);
223 }
224 if (count > 1) {
225 lookupTraceForAddress(data_addr, m_retryProfileMap).addSample(count);
226 }
227}
228
229void AddressProfiler::profilePersistentPrediction(const Address& data_addr, AccessType type)
230{
231 m_persistentPredictionProfileHisto.add(1);
232 lookupTraceForAddress(data_addr, m_persistentPredictionProfileMap).addSample(1);
233}
234
235// ***** Normal Functions ******
236
237static void printSorted(ostream& out, const Map<Address, AccessTraceForAddress>* record_map, string description)
238{
239 const int records_printed = 100;
240
241 uint64 misses = 0;
242 PrioHeap<AccessTraceForAddress*> heap;
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{
225 m_retryProfileHisto.add(count);
226 if (type == AccessType_Read) {
227 m_retryProfileHistoRead.add(count);
228 } else {
229 m_retryProfileHistoWrite.add(count);
230 }
231 if (count > 1) {
232 lookupTraceForAddress(data_addr, m_retryProfileMap).addSample(count);
233 }
234}
235
236void AddressProfiler::profilePersistentPrediction(const Address& data_addr, AccessType type)
237{
238 m_persistentPredictionProfileHisto.add(1);
239 lookupTraceForAddress(data_addr, m_persistentPredictionProfileMap).addSample(1);
240}
241
242// ***** Normal Functions ******
243
244static void printSorted(ostream& out, const Map<Address, AccessTraceForAddress>* record_map, string description)
245{
246 const int records_printed = 100;
247
248 uint64 misses = 0;
249 PrioHeap<AccessTraceForAddress*> heap;
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();
276 double percent = 100.0*(record->getTotal()/double(misses));
277 out << description << " | " << percent << " % " << *record << endl;
278 all_records.add(record->getTotal());
279 all_records_log.add(record->getTotal());
280 counter++;
281 m_touched_vec[record->getTouchedBy()]++;
282 m_touched_weighted_vec[record->getTouchedBy()] += record->getTotal();
283 }
284
285 while(heap.size() > 0) {
286 AccessTraceForAddress* record = heap.extractMin();
287 all_records.add(record->getTotal());
288 remaining_records.add(record->getTotal());
289 all_records_log.add(record->getTotal());
290 remaining_records_log.add(record->getTotal());
291 m_touched_vec[record->getTouchedBy()]++;
292 m_touched_weighted_vec[record->getTouchedBy()] += record->getTotal();
293 }
294 out << endl;
295 out << "all_records_" << description << ": " << all_records << endl;
296 out << "all_records_log_" << description << ": " << all_records_log << endl;
297 out << "remaining_records_" << description << ": " << remaining_records << endl;
298 out << "remaining_records_log_" << description << ": " << remaining_records_log << endl;
299 out << "touched_by_" << description << ": " << m_touched_vec << endl;
300 out << "touched_by_weighted_" << description << ": " << m_touched_weighted_vec << endl;
301 out << endl;
302}
303
304static AccessTraceForAddress& lookupTraceForAddress(const Address& addr, Map<Address, AccessTraceForAddress>* record_map)
305{
306 if(record_map->exist(addr) == false){
307 record_map->add(addr, AccessTraceForAddress(addr));
308 }
309 return record_map->lookup(addr);
310}
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();
283 double percent = 100.0*(record->getTotal()/double(misses));
284 out << description << " | " << percent << " % " << *record << endl;
285 all_records.add(record->getTotal());
286 all_records_log.add(record->getTotal());
287 counter++;
288 m_touched_vec[record->getTouchedBy()]++;
289 m_touched_weighted_vec[record->getTouchedBy()] += record->getTotal();
290 }
291
292 while(heap.size() > 0) {
293 AccessTraceForAddress* record = heap.extractMin();
294 all_records.add(record->getTotal());
295 remaining_records.add(record->getTotal());
296 all_records_log.add(record->getTotal());
297 remaining_records_log.add(record->getTotal());
298 m_touched_vec[record->getTouchedBy()]++;
299 m_touched_weighted_vec[record->getTouchedBy()] += record->getTotal();
300 }
301 out << endl;
302 out << "all_records_" << description << ": " << all_records << endl;
303 out << "all_records_log_" << description << ": " << all_records_log << endl;
304 out << "remaining_records_" << description << ": " << remaining_records << endl;
305 out << "remaining_records_log_" << description << ": " << remaining_records_log << endl;
306 out << "touched_by_" << description << ": " << m_touched_vec << endl;
307 out << "touched_by_weighted_" << description << ": " << m_touched_weighted_vec << endl;
308 out << endl;
309}
310
311static AccessTraceForAddress& lookupTraceForAddress(const Address& addr, Map<Address, AccessTraceForAddress>* record_map)
312{
313 if(record_map->exist(addr) == false){
314 record_map->add(addr, AccessTraceForAddress(addr));
315 }
316 return record_map->lookup(addr);
317}