AddressProfiler.cc (9550:e0e2c8f83d08) | AddressProfiler.cc (10919:80069a602c83) |
---|---|
1/* 2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 18 unchanged lines hidden (view full) --- 27 */ 28 29#include <vector> 30 31#include "base/stl_helpers.hh" 32#include "mem/protocol/RubyRequest.hh" 33#include "mem/ruby/profiler/AddressProfiler.hh" 34#include "mem/ruby/profiler/Profiler.hh" | 1/* 2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 18 unchanged lines hidden (view full) --- 27 */ 28 29#include <vector> 30 31#include "base/stl_helpers.hh" 32#include "mem/protocol/RubyRequest.hh" 33#include "mem/ruby/profiler/AddressProfiler.hh" 34#include "mem/ruby/profiler/Profiler.hh" |
35#include "mem/ruby/system/System.hh" | |
36 37using namespace std; 38typedef AddressProfiler::AddressMap AddressMap; 39 40using m5::stl_helpers::operator<<; 41 42// Helper functions 43AccessTraceForAddress& --- 15 unchanged lines hidden (view full) --- 59 access_trace.setAddress(addr); 60 } 61 62 return access_trace; 63} 64 65void 66printSorted(ostream& out, int num_of_sequencers, const AddressMap &record_map, | 35 36using namespace std; 37typedef AddressProfiler::AddressMap AddressMap; 38 39using m5::stl_helpers::operator<<; 40 41// Helper functions 42AccessTraceForAddress& --- 15 unchanged lines hidden (view full) --- 58 access_trace.setAddress(addr); 59 } 60 61 return access_trace; 62} 63 64void 65printSorted(ostream& out, int num_of_sequencers, const AddressMap &record_map, |
67 string description) | 66 string description, Profiler *profiler) |
68{ 69 const int records_printed = 100; 70 71 uint64 misses = 0; 72 std::vector<const AccessTraceForAddress *> sorted; 73 74 AddressMap::const_iterator i = record_map.begin(); 75 AddressMap::const_iterator end = record_map.end(); 76 for (; i != end; ++i) { 77 const AccessTraceForAddress* record = &i->second; 78 misses += record->getTotal(); 79 sorted.push_back(record); 80 } 81 sort(sorted.begin(), sorted.end(), AccessTraceForAddress::less_equal); 82 83 out << "Total_entries_" << description << ": " << record_map.size() 84 << endl; | 67{ 68 const int records_printed = 100; 69 70 uint64 misses = 0; 71 std::vector<const AccessTraceForAddress *> sorted; 72 73 AddressMap::const_iterator i = record_map.begin(); 74 AddressMap::const_iterator end = record_map.end(); 75 for (; i != end; ++i) { 76 const AccessTraceForAddress* record = &i->second; 77 misses += record->getTotal(); 78 sorted.push_back(record); 79 } 80 sort(sorted.begin(), sorted.end(), AccessTraceForAddress::less_equal); 81 82 out << "Total_entries_" << description << ": " << record_map.size() 83 << endl; |
85 if (g_system_ptr->getProfiler()->getAllInstructions()) | 84 if (profiler->getAllInstructions()) |
86 out << "Total_Instructions_" << description << ": " << misses << endl; 87 else 88 out << "Total_data_misses_" << description << ": " << misses << endl; 89 90 out << "total | load store atomic | user supervisor | sharing | touched-by" 91 << endl; 92 93 Histogram remaining_records(1, 100); --- 44 unchanged lines hidden (view full) --- 138 << remaining_records_log << endl 139 << "touched_by_" << description << ": " 140 << m_touched_vec << endl 141 << "touched_by_weighted_" << description << ": " 142 << m_touched_weighted_vec << endl 143 << endl; 144} 145 | 85 out << "Total_Instructions_" << description << ": " << misses << endl; 86 else 87 out << "Total_data_misses_" << description << ": " << misses << endl; 88 89 out << "total | load store atomic | user supervisor | sharing | touched-by" 90 << endl; 91 92 Histogram remaining_records(1, 100); --- 44 unchanged lines hidden (view full) --- 137 << remaining_records_log << endl 138 << "touched_by_" << description << ": " 139 << m_touched_vec << endl 140 << "touched_by_weighted_" << description << ": " 141 << m_touched_weighted_vec << endl 142 << endl; 143} 144 |
146AddressProfiler::AddressProfiler(int num_of_sequencers) | 145AddressProfiler::AddressProfiler(int num_of_sequencers, Profiler *profiler) 146 : m_profiler(profiler) |
147{ 148 m_num_of_sequencers = num_of_sequencers; 149 clearStats(); 150} 151 152AddressProfiler::~AddressProfiler() 153{ 154} --- 23 unchanged lines hidden (view full) --- 178 out << "getx_sharing_histogram: " << m_getx_sharing_histogram << endl; 179 out << "gets_sharing_histogram: " << m_gets_sharing_histogram << endl; 180 181 out << endl; 182 out << "Hot Data Blocks" << endl; 183 out << "---------------" << endl; 184 out << endl; 185 printSorted(out, m_num_of_sequencers, m_dataAccessTrace, | 147{ 148 m_num_of_sequencers = num_of_sequencers; 149 clearStats(); 150} 151 152AddressProfiler::~AddressProfiler() 153{ 154} --- 23 unchanged lines hidden (view full) --- 178 out << "getx_sharing_histogram: " << m_getx_sharing_histogram << endl; 179 out << "gets_sharing_histogram: " << m_gets_sharing_histogram << endl; 180 181 out << endl; 182 out << "Hot Data Blocks" << endl; 183 out << "---------------" << endl; 184 out << endl; 185 printSorted(out, m_num_of_sequencers, m_dataAccessTrace, |
186 "block_address"); | 186 "block_address", m_profiler); |
187 188 out << endl; 189 out << "Hot MacroData Blocks" << endl; 190 out << "--------------------" << endl; 191 out << endl; 192 printSorted(out, m_num_of_sequencers, m_macroBlockAccessTrace, | 187 188 out << endl; 189 out << "Hot MacroData Blocks" << endl; 190 out << "--------------------" << endl; 191 out << endl; 192 printSorted(out, m_num_of_sequencers, m_macroBlockAccessTrace, |
193 "macroblock_address"); | 193 "macroblock_address", m_profiler); |
194 195 out << "Hot Instructions" << endl; 196 out << "----------------" << endl; 197 out << endl; 198 printSorted(out, m_num_of_sequencers, m_programCounterAccessTrace, | 194 195 out << "Hot Instructions" << endl; 196 out << "----------------" << endl; 197 out << endl; 198 printSorted(out, m_num_of_sequencers, m_programCounterAccessTrace, |
199 "pc_address"); | 199 "pc_address", m_profiler); |
200 } 201 202 if (m_all_instructions) { 203 out << endl; 204 out << "All Instructions Profile:" << endl; 205 out << "-------------------------" << endl; 206 out << endl; 207 printSorted(out, m_num_of_sequencers, m_programCounterAccessTrace, | 200 } 201 202 if (m_all_instructions) { 203 out << endl; 204 out << "All Instructions Profile:" << endl; 205 out << "-------------------------" << endl; 206 out << endl; 207 printSorted(out, m_num_of_sequencers, m_programCounterAccessTrace, |
208 "pc_address"); | 208 "pc_address", m_profiler); |
209 out << endl; 210 } 211 212 if (m_retryProfileHisto.size() > 0) { 213 out << "Retry Profile" << endl; 214 out << "-------------" << endl; 215 out << endl; 216 out << "retry_histogram_absolute: " << m_retryProfileHisto << endl; 217 out << "retry_histogram_write: " << m_retryProfileHistoWrite << endl; 218 out << "retry_histogram_read: " << m_retryProfileHistoRead << endl; 219 220 out << "retry_histogram_percent: "; 221 m_retryProfileHisto.printPercent(out); 222 out << endl; 223 224 printSorted(out, m_num_of_sequencers, m_retryProfileMap, | 209 out << endl; 210 } 211 212 if (m_retryProfileHisto.size() > 0) { 213 out << "Retry Profile" << endl; 214 out << "-------------" << endl; 215 out << endl; 216 out << "retry_histogram_absolute: " << m_retryProfileHisto << endl; 217 out << "retry_histogram_write: " << m_retryProfileHistoWrite << endl; 218 out << "retry_histogram_read: " << m_retryProfileHistoRead << endl; 219 220 out << "retry_histogram_percent: "; 221 m_retryProfileHisto.printPercent(out); 222 out << endl; 223 224 printSorted(out, m_num_of_sequencers, m_retryProfileMap, |
225 "block_address"); | 225 "block_address", m_profiler); |
226 out << endl; 227 } 228} 229 230void 231AddressProfiler::clearStats() 232{ 233 // Clear the maps --- 98 unchanged lines hidden --- | 226 out << endl; 227 } 228} 229 230void 231AddressProfiler::clearStats() 232{ 233 // Clear the maps --- 98 unchanged lines hidden --- |