AddressProfiler.hh (6896:649e40aad897) AddressProfiler.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 * AddressProfiler.hh
32 *
33 * Description:
34 *
35 * $Id$
36 *
37 */
29#ifndef __MEM_RUBY_PROFILER_ADDRESSPROFILER_HH__
30#define __MEM_RUBY_PROFILER_ADDRESSPROFILER_HH__
38
31
39#ifndef ADDRESSPROFILER_H
40#define ADDRESSPROFILER_H
41
32#include "mem/protocol/AccessType.hh"
33#include "mem/protocol/CacheMsg.hh"
34#include "mem/ruby/common/Address.hh"
42#include "mem/ruby/common/Global.hh"
35#include "mem/ruby/common/Global.hh"
43#include "mem/ruby/system/NodeID.hh"
44#include "mem/ruby/common/Histogram.hh"
36#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"
37#include "mem/ruby/system/NodeID.hh"
48
49class AccessTraceForAddress;
50class Set;
51template <class KEY_TYPE, class VALUE_TYPE> class Map;
52
38
39class AccessTraceForAddress;
40class Set;
41template <class KEY_TYPE, class VALUE_TYPE> class Map;
42
53class AddressProfiler {
54public:
55 // Constructors
56 AddressProfiler(int num_of_sequencers);
43class AddressProfiler
44{
45 public:
46 typedef Map<Address, AccessTraceForAddress> AddressMap;
57
47
58 // Destructor
59 ~AddressProfiler();
48 public:
49 AddressProfiler(int num_of_sequencers);
50 ~AddressProfiler();
60
51
61 // Public Methods
62 void printStats(ostream& out) const;
63 void clearStats();
52 void printStats(ostream& out) const;
53 void clearStats();
64
54
65 void addTraceSample(Address data_addr, Address pc_addr, CacheRequestType type, AccessModeType access_mode, NodeID id, bool sharing_miss);
66 void profileRetry(const Address& data_addr, AccessType type, int count);
67 void profileGetX(const Address& datablock, const Address& PC, const Set& owner, const Set& sharers, NodeID requestor);
68 void profileGetS(const Address& datablock, const Address& PC, const Set& owner, const Set& sharers, NodeID requestor);
55 void addTraceSample(Address data_addr, Address pc_addr,
56 CacheRequestType type, AccessModeType access_mode,
57 NodeID id, bool sharing_miss);
58 void profileRetry(const Address& data_addr, AccessType type, int count);
59 void profileGetX(const Address& datablock, const Address& PC,
60 const Set& owner, const Set& sharers, NodeID requestor);
61 void profileGetS(const Address& datablock, const Address& PC,
62 const Set& owner, const Set& sharers, NodeID requestor);
69
63
70 void print(ostream& out) const;
64 void print(ostream& out) const;
71
65
72 //added by SS
73 void setHotLines(bool hot_lines);
74 void setAllInstructions(bool all_instructions);
75private:
76 // Private Methods
66 //added by SS
67 void setHotLines(bool hot_lines);
68 void setAllInstructions(bool all_instructions);
77
69
78 // Private copy constructor and assignment operator
79 AddressProfiler(const AddressProfiler& obj);
80 AddressProfiler& operator=(const AddressProfiler& obj);
70 private:
71 // Private copy constructor and assignment operator
72 AddressProfiler(const AddressProfiler& obj);
73 AddressProfiler& operator=(const AddressProfiler& obj);
81
74
82 // Data Members (m_ prefix)
83 int64 m_sharing_miss_counter;
75 int64 m_sharing_miss_counter;
84
76
85 Map<Address, AccessTraceForAddress>* m_dataAccessTrace;
86 Map<Address, AccessTraceForAddress>* m_macroBlockAccessTrace;
87 Map<Address, AccessTraceForAddress>* m_programCounterAccessTrace;
88 Map<Address, AccessTraceForAddress>* m_retryProfileMap;
89 Histogram m_retryProfileHisto;
90 Histogram m_retryProfileHistoWrite;
91 Histogram m_retryProfileHistoRead;
92 Histogram m_getx_sharing_histogram;
93 Histogram m_gets_sharing_histogram;
94//added by SS
95 bool m_hot_lines;
96 bool m_all_instructions;
77 AddressMap* m_dataAccessTrace;
78 AddressMap* m_macroBlockAccessTrace;
79 AddressMap* m_programCounterAccessTrace;
80 AddressMap* m_retryProfileMap;
81 Histogram m_retryProfileHisto;
82 Histogram m_retryProfileHistoWrite;
83 Histogram m_retryProfileHistoRead;
84 Histogram m_getx_sharing_histogram;
85 Histogram m_gets_sharing_histogram;
97
86
98 int m_num_of_sequencers;
87 //added by SS
88 bool m_hot_lines;
89 bool m_all_instructions;
90
91 int m_num_of_sequencers;
99};
100
92};
93
101// Output operator declaration
102ostream& operator<<(ostream& out, const AddressProfiler& obj);
103
104// ******************* Definitions *******************
105
106// Output operator definition
107extern inline
108ostream& operator<<(ostream& out, const AddressProfiler& obj)
94inline ostream&
95operator<<(ostream& out, const AddressProfiler& obj)
109{
96{
110 obj.print(out);
111 out << flush;
112 return out;
97 obj.print(out);
98 out << flush;
99 return out;
113}
114
100}
101
115#endif //ADDRESSPROFILER_H
102#endif // __MEM_RUBY_PROFILER_ADDRESSPROFILER_HH__