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 9 * notice, this list of conditions and the following disclaimer; 10 * redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution; 13 * neither the name of the copyright holders nor the names of its 14 * contributors may be used to endorse or promote products derived from 15 * this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30/*
| 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 9 * notice, this list of conditions and the following disclaimer; 10 * redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution; 13 * neither the name of the copyright holders nor the names of its 14 * contributors may be used to endorse or promote products derived from 15 * this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30/*
|
32 * 33 * Description: 34 * 35 * $Id$ 36 * 37 */ 38 39#ifndef ADDRESSPROFILER_H 40#define ADDRESSPROFILER_H 41 42#include "mem/ruby/common/Global.hh" 43#include "mem/ruby/system/NodeID.hh" 44#include "mem/ruby/common/Histogram.hh" 45#include "mem/ruby/common/Address.hh" 46#include "mem/protocol/CacheMsg.hh" 47#include "mem/protocol/AccessType.hh" 48 49class AccessTraceForAddress; 50class Set; 51template <class KEY_TYPE, class VALUE_TYPE> class Map; 52 53class AddressProfiler { 54public: 55 // Constructors 56 AddressProfiler(); 57 58 // Destructor 59 ~AddressProfiler(); 60 61 // Public Methods 62 void printStats(ostream& out) const; 63 void clearStats(); 64 65 void addTraceSample(Address data_addr, Address pc_addr, CacheRequestType type, AccessModeType access_mode, NodeID id, bool sharing_miss); 66 void profilePersistentPrediction(const Address& data_addr, AccessType type); 67 void profileRetry(const Address& data_addr, AccessType type, int count); 68 void profileGetX(const Address& datablock, const Address& PC, const Set& owner, const Set& sharers, NodeID requestor); 69 void profileGetS(const Address& datablock, const Address& PC, const Set& owner, const Set& sharers, NodeID requestor); 70 71 void print(ostream& out) const; 72private: 73 // Private Methods 74 75 // Private copy constructor and assignment operator 76 AddressProfiler(const AddressProfiler& obj); 77 AddressProfiler& operator=(const AddressProfiler& obj); 78 79 // Data Members (m_ prefix) 80 int64 m_sharing_miss_counter; 81 82 Map<Address, AccessTraceForAddress>* m_dataAccessTrace; 83 Map<Address, AccessTraceForAddress>* m_macroBlockAccessTrace; 84 Map<Address, AccessTraceForAddress>* m_programCounterAccessTrace; 85 Map<Address, AccessTraceForAddress>* m_retryProfileMap; 86 Map<Address, AccessTraceForAddress>* m_persistentPredictionProfileMap; 87 Histogram m_persistentPredictionProfileHisto; 88 Histogram m_retryProfileHisto; 89 Histogram m_retryProfileHistoWrite; 90 Histogram m_retryProfileHistoRead; 91 Histogram m_getx_sharing_histogram; 92 Histogram m_gets_sharing_histogram; 93}; 94 95// Output operator declaration 96ostream& operator<<(ostream& out, const AddressProfiler& obj); 97 98// ******************* Definitions ******************* 99 100// Output operator definition 101extern inline 102ostream& operator<<(ostream& out, const AddressProfiler& obj) 103{ 104 obj.print(out); 105 out << flush; 106 return out; 107} 108 109#endif //ADDRESSPROFILER_H
| 32 * 33 * Description: 34 * 35 * $Id$ 36 * 37 */ 38 39#ifndef ADDRESSPROFILER_H 40#define ADDRESSPROFILER_H 41 42#include "mem/ruby/common/Global.hh" 43#include "mem/ruby/system/NodeID.hh" 44#include "mem/ruby/common/Histogram.hh" 45#include "mem/ruby/common/Address.hh" 46#include "mem/protocol/CacheMsg.hh" 47#include "mem/protocol/AccessType.hh" 48 49class AccessTraceForAddress; 50class Set; 51template <class KEY_TYPE, class VALUE_TYPE> class Map; 52 53class AddressProfiler { 54public: 55 // Constructors 56 AddressProfiler(); 57 58 // Destructor 59 ~AddressProfiler(); 60 61 // Public Methods 62 void printStats(ostream& out) const; 63 void clearStats(); 64 65 void addTraceSample(Address data_addr, Address pc_addr, CacheRequestType type, AccessModeType access_mode, NodeID id, bool sharing_miss); 66 void profilePersistentPrediction(const Address& data_addr, AccessType type); 67 void profileRetry(const Address& data_addr, AccessType type, int count); 68 void profileGetX(const Address& datablock, const Address& PC, const Set& owner, const Set& sharers, NodeID requestor); 69 void profileGetS(const Address& datablock, const Address& PC, const Set& owner, const Set& sharers, NodeID requestor); 70 71 void print(ostream& out) const; 72private: 73 // Private Methods 74 75 // Private copy constructor and assignment operator 76 AddressProfiler(const AddressProfiler& obj); 77 AddressProfiler& operator=(const AddressProfiler& obj); 78 79 // Data Members (m_ prefix) 80 int64 m_sharing_miss_counter; 81 82 Map<Address, AccessTraceForAddress>* m_dataAccessTrace; 83 Map<Address, AccessTraceForAddress>* m_macroBlockAccessTrace; 84 Map<Address, AccessTraceForAddress>* m_programCounterAccessTrace; 85 Map<Address, AccessTraceForAddress>* m_retryProfileMap; 86 Map<Address, AccessTraceForAddress>* m_persistentPredictionProfileMap; 87 Histogram m_persistentPredictionProfileHisto; 88 Histogram m_retryProfileHisto; 89 Histogram m_retryProfileHistoWrite; 90 Histogram m_retryProfileHistoRead; 91 Histogram m_getx_sharing_histogram; 92 Histogram m_gets_sharing_histogram; 93}; 94 95// Output operator declaration 96ostream& operator<<(ostream& out, const AddressProfiler& obj); 97 98// ******************* Definitions ******************* 99 100// Output operator definition 101extern inline 102ostream& operator<<(ostream& out, const AddressProfiler& obj) 103{ 104 obj.print(out); 105 out << flush; 106 return out; 107} 108 109#endif //ADDRESSPROFILER_H
|