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 |
77void AddressProfiler::printStats(ostream& out) const 78{ |
79 if (m_hot_lines) { |
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 |
107 if (m_all_instructions){ |
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{ |
199 if (m_all_instructions) { |
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 |
216 if (m_all_instructions) { |
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; |
258 if (g_system_ptr->getProfiler()->getAllInstructions()) |
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; |
273 m_touched_vec.setSize(RubySystem::getNumberOfSequencers()+1); 274 m_touched_weighted_vec.setSize(RubySystem::getNumberOfSequencers()+1); |
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 --- |