AccessTraceForAddress.hh (6372:f1a41ea3bbab) | AccessTraceForAddress.hh (7048:2ab58c54de63) |
---|---|
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; --- 12 unchanged lines hidden (view full) --- 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 | 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 |
30/* 31 * $Id$ 32 * 33 * Description: 34 * 35 */ | 29#ifndef __MEM_RUBY_PROFILER_ACCESSTRACEFORADDRESS_HH__ 30#define __MEM_RUBY_PROFILER_ACCESSTRACEFORADDRESS_HH__ |
36 | 31 |
37#ifndef ACCESSTRACEFORADDRESS_H 38#define ACCESSTRACEFORADDRESS_H 39 40#include "mem/ruby/common/Global.hh" 41#include "mem/ruby/common/Address.hh" 42#include "mem/protocol/CacheRequestType.hh" | |
43#include "mem/protocol/AccessModeType.hh" | 32#include "mem/protocol/AccessModeType.hh" |
44#include "mem/ruby/system/NodeID.hh" | 33#include "mem/protocol/CacheRequestType.hh" 34#include "mem/ruby/common/Address.hh" 35#include "mem/ruby/common/Global.hh" |
45#include "mem/ruby/common/Set.hh" | 36#include "mem/ruby/common/Set.hh" |
37#include "mem/ruby/system/NodeID.hh" 38 |
|
46class Histogram; 47 | 39class Histogram; 40 |
48class AccessTraceForAddress { 49public: 50 // Constructors 51 AccessTraceForAddress(); 52 explicit AccessTraceForAddress(const Address& addr); | 41class AccessTraceForAddress 42{ 43 public: 44 AccessTraceForAddress(); 45 explicit AccessTraceForAddress(const Address& addr); 46 ~AccessTraceForAddress(); |
53 | 47 |
54 // Destructor 55 ~AccessTraceForAddress(); | 48 void update(CacheRequestType type, AccessModeType access_mode, NodeID cpu, 49 bool sharing_miss); 50 int getTotal() const; 51 int getSharing() const { return m_sharing; } 52 int getTouchedBy() const { return m_touched_by.count(); } 53 const Address& getAddress() const { return m_addr; } 54 void addSample(int value); |
56 | 55 |
57 // Public Methods | 56 void print(ostream& out) const; |
58 | 57 |
59 void update(CacheRequestType type, AccessModeType access_mode, NodeID cpu, bool sharing_miss); 60 int getTotal() const; 61 int getSharing() const { return m_sharing; } 62 int getTouchedBy() const { return m_touched_by.count(); } 63 const Address& getAddress() const { return m_addr; } 64 void addSample(int value); 65 66 void print(ostream& out) const; 67private: 68 // Private Methods 69 70 // Private copy constructor and assignment operator 71 // AccessTraceForAddress(const AccessTraceForAddress& obj); 72 // AccessTraceForAddress& operator=(const AccessTraceForAddress& obj); 73 74 // Data Members (m_ prefix) 75 76 Address m_addr; 77 uint64 m_loads; 78 uint64 m_stores; 79 uint64 m_atomics; 80 uint64 m_total; 81 uint64 m_user; 82 uint64 m_sharing; 83 Set m_touched_by; 84 Histogram* m_histogram_ptr; | 58 private: 59 Address m_addr; 60 uint64 m_loads; 61 uint64 m_stores; 62 uint64 m_atomics; 63 uint64 m_total; 64 uint64 m_user; 65 uint64 m_sharing; 66 Set m_touched_by; 67 Histogram* m_histogram_ptr; |
85}; 86 | 68}; 69 |
87bool node_less_then_eq(const AccessTraceForAddress* n1, const AccessTraceForAddress* n2); | 70inline bool 71node_less_then_eq(const AccessTraceForAddress* n1, 72 const AccessTraceForAddress* n2) 73{ 74 return n1->getTotal() > n2->getTotal(); 75} |
88 | 76 |
89// Output operator declaration 90ostream& operator<<(ostream& out, const AccessTraceForAddress& obj); 91 92// ******************* Definitions ******************* 93 94// Output operator definition 95extern inline 96ostream& operator<<(ostream& out, const AccessTraceForAddress& obj) | 77inline ostream& 78operator<<(ostream& out, const AccessTraceForAddress& obj) |
97{ | 79{ |
98 obj.print(out); 99 out << flush; 100 return out; | 80 obj.print(out); 81 out << flush; 82 return out; |
101} 102 | 83} 84 |
103#endif //ACCESSTRACEFORADDRESS_H | 85#endif // __MEM_RUBY_PROFILER_ACCESSTRACEFORADDRESS_HH__ |