1
|
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; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution; 12 * neither the name of the copyright holders nor the names of its 13 * contributors may be used to endorse or promote products derived from 14 * this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 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__ |
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"
|
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" |
36#include "mem/ruby/common/Set.hh"
|
37#include "mem/ruby/system/NodeID.hh" 38 |
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(); |
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); |
55
|
57 // Public Methods
|
56 void print(ostream& out) const; |
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; |
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} |
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) |
79{
|
98 obj.print(out);
99 out << flush;
100 return out;
|
80 obj.print(out); 81 out << flush; 82 return out; |
83} 84
|
103#endif //ACCESSTRACEFORADDRESS_H
|
85#endif // __MEM_RUBY_PROFILER_ACCESSTRACEFORADDRESS_HH__ |
|