Deleted Added
sdiff udiff text old ( 6433:0f0f0fbef977 ) new ( 6896:649e40aad897 )
full compact
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

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

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 clearStats();
58}
59
60AddressProfiler::~AddressProfiler()
61{
62 delete m_dataAccessTrace;
63 delete m_macroBlockAccessTrace;
64 delete m_programCounterAccessTrace;

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

83 out << "sharing_misses: " << m_sharing_miss_counter << endl;
84 out << "getx_sharing_histogram: " << m_getx_sharing_histogram << endl;
85 out << "gets_sharing_histogram: " << m_gets_sharing_histogram << endl;
86
87 out << endl;
88 out << "Hot Data Blocks" << endl;
89 out << "---------------" << endl;
90 out << endl;
91 printSorted(out, m_dataAccessTrace, "block_address");
92
93 out << endl;
94 out << "Hot MacroData Blocks" << endl;
95 out << "--------------------" << endl;
96 out << endl;
97 printSorted(out, m_macroBlockAccessTrace, "macroblock_address");
98
99 out << "Hot Instructions" << endl;
100 out << "----------------" << endl;
101 out << endl;
102 printSorted(out, m_programCounterAccessTrace, "pc_address");
103 }
104
105 if (m_all_instructions){
106 out << endl;
107 out << "All Instructions Profile:" << endl;
108 out << "-------------------------" << endl;
109 out << endl;
110 printSorted(out, m_programCounterAccessTrace, "pc_address");
111 out << endl;
112 }
113
114 if (m_retryProfileHisto.size() > 0) {
115 out << "Retry Profile" << endl;
116 out << "-------------" << endl;
117 out << endl;
118 out << "retry_histogram_absolute: " << m_retryProfileHisto << endl;
119 out << "retry_histogram_write: " << m_retryProfileHistoWrite << endl;
120 out << "retry_histogram_read: " << m_retryProfileHistoRead << endl;
121
122 out << "retry_histogram_percent: ";
123 m_retryProfileHisto.printPercent(out);
124 out << endl;
125
126 printSorted(out, m_retryProfileMap, "block_address");
127 out << endl;
128 }
129
130}
131
132void AddressProfiler::clearStats()
133{
134 // Clear the maps

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

207 }
208 if (count > 1) {
209 lookupTraceForAddress(data_addr, m_retryProfileMap).addSample(count);
210 }
211}
212
213// ***** Normal Functions ******
214
215static void printSorted(ostream& out, const Map<Address, AccessTraceForAddress>* record_map, string description)
216{
217 const int records_printed = 100;
218
219 uint64 misses = 0;
220 PrioHeap<AccessTraceForAddress*> heap;
221 Vector<Address> keys = record_map->keys();
222 for(int i=0; i<keys.size(); i++){
223 AccessTraceForAddress* record = &(record_map->lookup(keys[i]));

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

236 Histogram remaining_records(1, 100);
237 Histogram all_records(1, 100);
238 Histogram remaining_records_log(-1);
239 Histogram all_records_log(-1);
240
241 // Allows us to track how many lines where touched by n processors
242 Vector<int64> m_touched_vec;
243 Vector<int64> m_touched_weighted_vec;
244 m_touched_vec.setSize(RubySystem::getNumberOfSequencers()+1);
245 m_touched_weighted_vec.setSize(RubySystem::getNumberOfSequencers()+1);
246 for (int i=0; i<m_touched_vec.size(); i++) {
247 m_touched_vec[i] = 0;
248 m_touched_weighted_vec[i] = 0;
249 }
250
251 int counter = 0;
252 while((heap.size() > 0) && (counter < records_printed)) {
253 AccessTraceForAddress* record = heap.extractMin();

--- 35 unchanged lines hidden ---