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,
49 Map<Address,
50 AccessTraceForAddress>* record_map);
51
52static void printSorted(ostream& out,
53 int num_of_sequencers,
54 const Map<Address, AccessTraceForAddress>* record_map,
55 string description);
56
57AddressProfiler::AddressProfiler(int num_of_sequencers)
58{
59 m_dataAccessTrace = new Map<Address, AccessTraceForAddress>;
60 m_macroBlockAccessTrace = new Map<Address, AccessTraceForAddress>;
61 m_programCounterAccessTrace = new Map<Address, AccessTraceForAddress>;
62 m_retryProfileMap = new Map<Address, AccessTraceForAddress>;
63 m_num_of_sequencers = num_of_sequencers;
64 clearStats();
65}
66
67AddressProfiler::~AddressProfiler()
68{
69 delete m_dataAccessTrace;
70 delete m_macroBlockAccessTrace;
71 delete m_programCounterAccessTrace;

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

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

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

214 }
215 if (count > 1) {
216 lookupTraceForAddress(data_addr, m_retryProfileMap).addSample(count);
217 }
218}
219
220// ***** Normal Functions ******
221
222static void printSorted(ostream& out,
223 int num_of_sequencers,
224 const Map<Address, AccessTraceForAddress>* record_map,
225 string description)
226{
227 const int records_printed = 100;
228
229 uint64 misses = 0;
230 PrioHeap<AccessTraceForAddress*> heap;
231 Vector<Address> keys = record_map->keys();
232 for(int i=0; i<keys.size(); i++){
233 AccessTraceForAddress* record = &(record_map->lookup(keys[i]));

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

246 Histogram remaining_records(1, 100);
247 Histogram all_records(1, 100);
248 Histogram remaining_records_log(-1);
249 Histogram all_records_log(-1);
250
251 // Allows us to track how many lines where touched by n processors
252 Vector<int64> m_touched_vec;
253 Vector<int64> m_touched_weighted_vec;
254 m_touched_vec.setSize(num_of_sequencers+1);
255 m_touched_weighted_vec.setSize(num_of_sequencers+1);
256 for (int i=0; i<m_touched_vec.size(); i++) {
257 m_touched_vec[i] = 0;
258 m_touched_weighted_vec[i] = 0;
259 }
260
261 int counter = 0;
262 while((heap.size() > 0) && (counter < records_printed)) {
263 AccessTraceForAddress* record = heap.extractMin();

--- 35 unchanged lines hidden ---