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" |
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 |
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; |
63 std::vector<Address> keys = record_map->keys(); |
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 |
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); |
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 --- |