Profiler.hh (7010:c769c45253c9) Profiler.hh (7048:2ab58c54de63)
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;

--- 28 unchanged lines hidden (view full) ---

37
38 ----------------------------------------------------------------------
39
40 File modification date: 2008-02-23
41
42 ----------------------------------------------------------------------
43*/
44
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;

--- 28 unchanged lines hidden (view full) ---

37
38 ----------------------------------------------------------------------
39
40 File modification date: 2008-02-23
41
42 ----------------------------------------------------------------------
43*/
44
45/*
46 * Profiler.hh
47 *
48 * Description:
49 *
50 * $Id$
51 *
52 */
45#ifndef __MEM_RUBY_PROFILER_PROFILER_HH__
46#define __MEM_RUBY_PROFILER_PROFILER_HH__
53
47
54#ifndef PROFILER_H
55#define PROFILER_H
56
57#include "mem/ruby/libruby.hh"
58
59#include "mem/ruby/common/Global.hh"
60#include "mem/protocol/GenericMachineType.hh"
61#include "mem/ruby/common/Histogram.hh"
62#include "mem/ruby/common/Consumer.hh"
63#include "mem/protocol/AccessModeType.hh"
64#include "mem/protocol/AccessType.hh"
48#include "mem/protocol/AccessModeType.hh"
49#include "mem/protocol/AccessType.hh"
65#include "mem/ruby/system/NodeID.hh"
66#include "mem/ruby/system/MachineID.hh"
50#include "mem/protocol/CacheRequestType.hh"
51#include "mem/protocol/GenericMachineType.hh"
52#include "mem/protocol/GenericRequestType.hh"
67#include "mem/protocol/PrefetchBit.hh"
68#include "mem/ruby/common/Address.hh"
53#include "mem/protocol/PrefetchBit.hh"
54#include "mem/ruby/common/Address.hh"
55#include "mem/ruby/common/Consumer.hh"
56#include "mem/ruby/common/Global.hh"
57#include "mem/ruby/common/Histogram.hh"
69#include "mem/ruby/common/Set.hh"
58#include "mem/ruby/common/Set.hh"
70#include "mem/protocol/CacheRequestType.hh"
71#include "mem/protocol/GenericRequestType.hh"
59#include "mem/ruby/libruby.hh"
60#include "mem/ruby/system/MachineID.hh"
72#include "mem/ruby/system/MemoryControl.hh"
61#include "mem/ruby/system/MemoryControl.hh"
73
62#include "mem/ruby/system/NodeID.hh"
74#include "params/RubyProfiler.hh"
75#include "sim/sim_object.hh"
76
77class CacheMsg;
78class AddressProfiler;
79
80template <class KEY_TYPE, class VALUE_TYPE> class Map;
81
63#include "params/RubyProfiler.hh"
64#include "sim/sim_object.hh"
65
66class CacheMsg;
67class AddressProfiler;
68
69template <class KEY_TYPE, class VALUE_TYPE> class Map;
70
82class Profiler : public SimObject, public Consumer {
83public:
84 // Constructors
71class Profiler : public SimObject, public Consumer
72{
73 public:
85 typedef RubyProfilerParams Params;
74 typedef RubyProfilerParams Params;
86 Profiler(const Params *);
75 Profiler(const Params *);
76 ~Profiler();
87
77
88 // Destructor
89 ~Profiler();
78 void wakeup();
90
79
91 // Public Methods
92 void wakeup();
80 void setPeriodicStatsFile(const string& filename);
81 void setPeriodicStatsInterval(integer_t period);
93
82
94 void setPeriodicStatsFile(const string& filename);
95 void setPeriodicStatsInterval(integer_t period);
83 void printStats(ostream& out, bool short_stats=false);
84 void printShortStats(ostream& out) { printStats(out, true); }
85 void printTraceStats(ostream& out) const;
86 void clearStats();
87 void printConfig(ostream& out) const;
88 void printResourceUsage(ostream& out) const;
96
89
97 void printStats(ostream& out, bool short_stats=false);
98 void printShortStats(ostream& out) { printStats(out, true); }
99 void printTraceStats(ostream& out) const;
100 void clearStats();
101 void printConfig(ostream& out) const;
102 void printResourceUsage(ostream& out) const;
90 AddressProfiler* getAddressProfiler() { return m_address_profiler_ptr; }
91 AddressProfiler* getInstructionProfiler() { return m_inst_profiler_ptr; }
103
92
104 AddressProfiler* getAddressProfiler() { return m_address_profiler_ptr; }
105 AddressProfiler* getInstructionProfiler() { return m_inst_profiler_ptr; }
93 void addAddressTraceSample(const CacheMsg& msg, NodeID id);
106
94
107 void addAddressTraceSample(const CacheMsg& msg, NodeID id);
95 void profileRequest(const string& requestStr);
96 void profileSharing(const Address& addr, AccessType type,
97 NodeID requestor, const Set& sharers,
98 const Set& owner);
108
99
109 void profileRequest(const string& requestStr);
110 void profileSharing(const Address& addr, AccessType type, NodeID requestor, const Set& sharers, const Set& owner);
100 void profileMulticastRetry(const Address& addr, int count);
111
101
112 void profileMulticastRetry(const Address& addr, int count);
102 void profileFilterAction(int action);
113
103
114 void profileFilterAction(int action);
104 void profileConflictingRequests(const Address& addr);
115
105
116 void profileConflictingRequests(const Address& addr);
117 void profileOutstandingRequest(int outstanding) { m_outstanding_requests.add(outstanding); }
118 void profileOutstandingPersistentRequest(int outstanding) { m_outstanding_persistent_requests.add(outstanding); }
119 void profileAverageLatencyEstimate(int latency) { m_average_latency_estimate.add(latency); }
106 void
107 profileOutstandingRequest(int outstanding)
108 {
109 m_outstanding_requests.add(outstanding);
110 }
120
111
121 void recordPrediction(bool wasGood, bool wasPredicted);
112 void
113 profileOutstandingPersistentRequest(int outstanding)
114 {
115 m_outstanding_persistent_requests.add(outstanding);
116 }
122
117
123 void startTransaction(int cpu);
124 void endTransaction(int cpu);
125 void profilePFWait(Time waitTime);
118 void
119 profileAverageLatencyEstimate(int latency)
120 {
121 m_average_latency_estimate.add(latency);
122 }
126
123
127 void controllerBusy(MachineID machID);
128 void bankBusy();
129 void missLatency(Time t, RubyRequestType type);
130 void swPrefetchLatency(Time t, CacheRequestType type, GenericMachineType respondingMach);
131 void sequencerRequests(int num) { m_sequencer_requests.add(num); }
124 void recordPrediction(bool wasGood, bool wasPredicted);
132
125
133 void profileTransition(const string& component, NodeID version, Address addr,
134 const string& state, const string& event,
135 const string& next_state, const string& note);
136 void profileMsgDelay(int virtualNetwork, int delayCycles);
126 void startTransaction(int cpu);
127 void endTransaction(int cpu);
128 void profilePFWait(Time waitTime);
137
129
138 void print(ostream& out) const;
130 void controllerBusy(MachineID machID);
131 void bankBusy();
132 void missLatency(Time t, RubyRequestType type);
133 void swPrefetchLatency(Time t, CacheRequestType type,
134 GenericMachineType respondingMach);
135 void sequencerRequests(int num) { m_sequencer_requests.add(num); }
139
136
140 void rubyWatch(int proc);
141 bool watchAddress(Address addr);
137 void profileTransition(const string& component, NodeID version,
138 Address addr, const string& state,
139 const string& event, const string& next_state,
140 const string& note);
141 void profileMsgDelay(int virtualNetwork, int delayCycles);
142
142
143 // return Ruby's start time
144 Time getRubyStartTime(){
145 return m_ruby_start;
146 }
143 void print(ostream& out) const;
147
144
148 //added by SS
149 bool getHotLines() { return m_hot_lines; }
150 bool getAllInstructions() { return m_all_instructions; }
145 void rubyWatch(int proc);
146 bool watchAddress(Address addr);
151
147
152private:
148 // return Ruby's start time
149 Time
150 getRubyStartTime()
151 {
152 return m_ruby_start;
153 }
153
154
154 // Private copy constructor and assignment operator
155 Profiler(const Profiler& obj);
156 Profiler& operator=(const Profiler& obj);
155 // added by SS
156 bool getHotLines() { return m_hot_lines; }
157 bool getAllInstructions() { return m_all_instructions; }
157
158
158 // Data Members (m_ prefix)
159 AddressProfiler* m_address_profiler_ptr;
160 AddressProfiler* m_inst_profiler_ptr;
159 private:
160 // Private copy constructor and assignment operator
161 Profiler(const Profiler& obj);
162 Profiler& operator=(const Profiler& obj);
161
163
162 Vector<int64> m_instructions_executed_at_start;
163 Vector<int64> m_cycles_executed_at_start;
164 AddressProfiler* m_address_profiler_ptr;
165 AddressProfiler* m_inst_profiler_ptr;
164
166
165 ostream* m_periodic_output_file_ptr;
166 integer_t m_stats_period;
167 Vector<int64> m_instructions_executed_at_start;
168 Vector<int64> m_cycles_executed_at_start;
167
169
168 Time m_ruby_start;
169 time_t m_real_time_start_time;
170 ostream* m_periodic_output_file_ptr;
171 integer_t m_stats_period;
170
172
171 Vector < Vector < integer_t > > m_busyControllerCount;
172 integer_t m_busyBankCount;
173 Histogram m_multicast_retry_histogram;
173 Time m_ruby_start;
174 time_t m_real_time_start_time;
174
175
175 Histogram m_filter_action_histogram;
176 Histogram m_tbeProfile;
176 Vector <Vector<integer_t> > m_busyControllerCount;
177 integer_t m_busyBankCount;
178 Histogram m_multicast_retry_histogram;
177
179
178 Histogram m_sequencer_requests;
179 Histogram m_read_sharing_histogram;
180 Histogram m_write_sharing_histogram;
181 Histogram m_all_sharing_histogram;
182 int64 m_cache_to_cache;
183 int64 m_memory_to_cache;
180 Histogram m_filter_action_histogram;
181 Histogram m_tbeProfile;
184
182
185 Histogram m_prefetchWaitHistogram;
183 Histogram m_sequencer_requests;
184 Histogram m_read_sharing_histogram;
185 Histogram m_write_sharing_histogram;
186 Histogram m_all_sharing_histogram;
187 int64 m_cache_to_cache;
188 int64 m_memory_to_cache;
186
189
187 Vector<Histogram> m_missLatencyHistograms;
188 Vector<Histogram> m_machLatencyHistograms;
189 Histogram m_allMissLatencyHistogram;
190 Histogram m_prefetchWaitHistogram;
190
191
191 Histogram m_allSWPrefetchLatencyHistogram;
192 Histogram m_SWPrefetchL2MissLatencyHistogram;
193 Vector<Histogram> m_SWPrefetchLatencyHistograms;
194 Vector<Histogram> m_SWPrefetchMachLatencyHistograms;
192 Vector<Histogram> m_missLatencyHistograms;
193 Vector<Histogram> m_machLatencyHistograms;
194 Histogram m_allMissLatencyHistogram;
195
195
196 Histogram m_delayedCyclesHistogram;
197 Histogram m_delayedCyclesNonPFHistogram;
198 Vector<Histogram> m_delayedCyclesVCHistograms;
196 Histogram m_allSWPrefetchLatencyHistogram;
197 Histogram m_SWPrefetchL2MissLatencyHistogram;
198 Vector<Histogram> m_SWPrefetchLatencyHistograms;
199 Vector<Histogram> m_SWPrefetchMachLatencyHistograms;
199
200
200 Histogram m_outstanding_requests;
201 Histogram m_outstanding_persistent_requests;
201 Histogram m_delayedCyclesHistogram;
202 Histogram m_delayedCyclesNonPFHistogram;
203 Vector<Histogram> m_delayedCyclesVCHistograms;
202
204
203 Histogram m_average_latency_estimate;
205 Histogram m_outstanding_requests;
206 Histogram m_outstanding_persistent_requests;
204
207
205 Map<Address, int>* m_watch_address_list_ptr;
206 // counts all initiated cache request including PUTs
207 int m_requests;
208 Map <string, int>* m_requestProfileMap_ptr;
208 Histogram m_average_latency_estimate;
209
209
210 //added by SS
211 bool m_hot_lines;
212 bool m_all_instructions;
210 Map<Address, int>* m_watch_address_list_ptr;
211 // counts all initiated cache request including PUTs
212 int m_requests;
213 Map <string, int>* m_requestProfileMap_ptr;
213
214
214 int m_num_of_sequencers;
215 //added by SS
216 bool m_hot_lines;
217 bool m_all_instructions;
218
219 int m_num_of_sequencers;
215};
216
220};
221
217// Output operator declaration
218ostream& operator<<(ostream& out, const Profiler& obj);
219
220// ******************* Definitions *******************
221
222// Output operator definition
223extern inline
224ostream& operator<<(ostream& out, const Profiler& obj)
222inline ostream&
223operator<<(ostream& out, const Profiler& obj)
225{
224{
226 obj.print(out);
227 out << flush;
228 return out;
225 obj.print(out);
226 out << flush;
227 return out;
229}
230
228}
229
231#endif //PROFILER_H
230#endif // __MEM_RUBY_PROFILER_PROFILER_HH__
232
233
231
232