AddressProfiler.cc (7055:4e24742201d7) | AddressProfiler.cc (7454:3a3e8e8cce1b) |
---|---|
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; --- 12 unchanged lines hidden (view full) --- 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 | 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; --- 12 unchanged lines hidden (view full) --- 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 |
29#include <vector> 30 31#include "base/stl_helpers.hh" |
|
29#include "mem/gems_common/Map.hh" 30#include "mem/gems_common/PrioHeap.hh" 31#include "mem/protocol/CacheMsg.hh" 32#include "mem/ruby/profiler/AccessTraceForAddress.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 | 32#include "mem/gems_common/Map.hh" 33#include "mem/gems_common/PrioHeap.hh" 34#include "mem/protocol/CacheMsg.hh" 35#include "mem/ruby/profiler/AccessTraceForAddress.hh" 36#include "mem/ruby/profiler/AddressProfiler.hh" 37#include "mem/ruby/profiler/Profiler.hh" 38#include "mem/ruby/system/System.hh" 39 40using namespace std; 41typedef AddressProfiler::AddressMap AddressMap; 42 |
43using m5::stl_helpers::operator<<; 44 |
|
40// Helper functions 41AccessTraceForAddress& 42lookupTraceForAddress(const Address& addr, AddressMap* record_map) 43{ 44 if (!record_map->exist(addr)) { 45 record_map->add(addr, AccessTraceForAddress(addr)); 46 } 47 return record_map->lookup(addr); 48} 49 50void 51printSorted(ostream& out, int num_of_sequencers, const AddressMap* record_map, 52 string description) 53{ 54 const int records_printed = 100; 55 56 uint64 misses = 0; 57 PrioHeap<AccessTraceForAddress*> heap; | 45// Helper functions 46AccessTraceForAddress& 47lookupTraceForAddress(const Address& addr, AddressMap* record_map) 48{ 49 if (!record_map->exist(addr)) { 50 record_map->add(addr, AccessTraceForAddress(addr)); 51 } 52 return record_map->lookup(addr); 53} 54 55void 56printSorted(ostream& out, int num_of_sequencers, const AddressMap* record_map, 57 string description) 58{ 59 const int records_printed = 100; 60 61 uint64 misses = 0; 62 PrioHeap<AccessTraceForAddress*> heap; |
58 Vector<Address> keys = record_map->keys(); | 63 std::vector<Address> keys = record_map->keys(); |
59 for (int i = 0; i < keys.size(); i++) { 60 AccessTraceForAddress* record = &(record_map->lookup(keys[i])); 61 misses += record->getTotal(); 62 heap.insert(record); 63 } 64 65 out << "Total_entries_" << description << ": " << keys.size() << endl; 66 if (g_system_ptr->getProfiler()->getAllInstructions()) --- 5 unchanged lines hidden (view full) --- 72 << endl; 73 74 Histogram remaining_records(1, 100); 75 Histogram all_records(1, 100); 76 Histogram remaining_records_log(-1); 77 Histogram all_records_log(-1); 78 79 // Allows us to track how many lines where touched by n processors | 64 for (int i = 0; i < keys.size(); i++) { 65 AccessTraceForAddress* record = &(record_map->lookup(keys[i])); 66 misses += record->getTotal(); 67 heap.insert(record); 68 } 69 70 out << "Total_entries_" << description << ": " << keys.size() << endl; 71 if (g_system_ptr->getProfiler()->getAllInstructions()) --- 5 unchanged lines hidden (view full) --- 77 << endl; 78 79 Histogram remaining_records(1, 100); 80 Histogram all_records(1, 100); 81 Histogram remaining_records_log(-1); 82 Histogram all_records_log(-1); 83 84 // Allows us to track how many lines where touched by n processors |
80 Vector<int64> m_touched_vec; 81 Vector<int64> m_touched_weighted_vec; 82 m_touched_vec.setSize(num_of_sequencers+1); 83 m_touched_weighted_vec.setSize(num_of_sequencers+1); | 85 std::vector<int64> m_touched_vec; 86 std::vector<int64> m_touched_weighted_vec; 87 m_touched_vec.resize(num_of_sequencers+1); 88 m_touched_weighted_vec.resize(num_of_sequencers+1); |
84 for (int i = 0; i < m_touched_vec.size(); i++) { 85 m_touched_vec[i] = 0; 86 m_touched_weighted_vec[i] = 0; 87 } 88 89 int counter = 0; 90 while (heap.size() > 0 && counter < records_printed) { 91 AccessTraceForAddress* record = heap.extractMin(); --- 228 unchanged lines hidden --- | 89 for (int i = 0; i < m_touched_vec.size(); i++) { 90 m_touched_vec[i] = 0; 91 m_touched_weighted_vec[i] = 0; 92 } 93 94 int counter = 0; 95 while (heap.size() > 0 && counter < records_printed) { 96 AccessTraceForAddress* record = heap.extractMin(); --- 228 unchanged lines hidden --- |