comm_monitor.hh (11173:3a4d1b5cd05c) comm_monitor.hh (11804:220375a47eeb)
1/*
2 * Copyright (c) 2012-2013, 2015 ARM Limited
1/*
2 * Copyright (c) 2012-2013, 2015 ARM Limited
3 * All rights reserved
3 * Copyright (c) 2016 Google Inc.
4 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are
16 * met: redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer;
18 * redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution;
21 * neither the name of the copyright holders nor the names of its
22 * contributors may be used to endorse or promote products derived from
23 * this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 *
37 * Authors: Thomas Grass
38 * Andreas Hansson
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating
9 * to a hardware implementation of the functionality of the software
10 * licensed hereunder. You may use the software subject to the license
11 * terms below provided that you ensure that this notice is replicated
12 * unmodified and in its entirety in all distributions of the software,
13 * modified or unmodified, in source code or in binary form.
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions are
17 * met: redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer;
19 * redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution;
22 * neither the name of the copyright holders nor the names of its
23 * contributors may be used to endorse or promote products derived from
24 * this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 *
38 * Authors: Thomas Grass
39 * Andreas Hansson
40 * Rahul Thakur
39 */
40
41#ifndef __MEM_COMM_MONITOR_HH__
42#define __MEM_COMM_MONITOR_HH__
43
44#include "base/statistics.hh"
45#include "mem/mem_object.hh"
46#include "params/CommMonitor.hh"
47#include "sim/probe/mem.hh"
48
49/**
50 * The communication monitor is a MemObject which can monitor statistics of
51 * the communication happening between two ports in the memory system.
52 *
53 * Currently the following stats are implemented: Histograms of read/write
54 * transactions, read/write burst lengths, read/write bandwidth,
55 * outstanding read/write requests, read latency and inter transaction time
56 * (read-read, write-write, read/write-read/write). Furthermore it allows
57 * to capture the number of accesses to an address over time ("heat map").
58 * All stats can be disabled from Python.
59 */
60class CommMonitor : public MemObject
61{
62
63 public: // Construction & SimObject interfaces
64
65 /** Parameters of communication monitor */
66 typedef CommMonitorParams Params;
67 const Params* params() const
68 { return reinterpret_cast<const Params*>(_params); }
69
70 /**
71 * Constructor based on the Python params
72 *
73 * @param params Python parameters
74 */
75 CommMonitor(Params* params);
76
77 void init() override;
78 void regStats() override;
79 void startup() override;
80 void regProbePoints() override;
81
82 public: // MemObject interfaces
83 BaseMasterPort& getMasterPort(const std::string& if_name,
84 PortID idx = InvalidPortID) override;
85
86 BaseSlavePort& getSlavePort(const std::string& if_name,
87 PortID idx = InvalidPortID) override;
88
89 private:
90
91 /**
92 * Sender state class for the monitor so that we can annotate
93 * packets with a transmit time and receive time.
94 */
95 class CommMonitorSenderState : public Packet::SenderState
96 {
97
98 public:
99
100 /**
101 * Construct a new sender state and store the time so we can
102 * calculate round-trip latency.
103 *
104 * @param _transmitTime Time of packet transmission
105 */
106 CommMonitorSenderState(Tick _transmitTime)
107 : transmitTime(_transmitTime)
108 { }
109
110 /** Destructor */
111 ~CommMonitorSenderState() { }
112
113 /** Tick when request is transmitted */
114 Tick transmitTime;
115
116 };
117
118 /**
119 * This is the master port of the communication monitor. All recv
120 * functions call a function in CommMonitor, where the
121 * send function of the slave port is called. Besides this, these
122 * functions can also perform actions for capturing statistics.
123 */
124 class MonitorMasterPort : public MasterPort
125 {
126
127 public:
128
129 MonitorMasterPort(const std::string& _name, CommMonitor& _mon)
130 : MasterPort(_name, &_mon), mon(_mon)
131 { }
132
133 protected:
134
135 void recvFunctionalSnoop(PacketPtr pkt)
136 {
137 mon.recvFunctionalSnoop(pkt);
138 }
139
140 Tick recvAtomicSnoop(PacketPtr pkt)
141 {
142 return mon.recvAtomicSnoop(pkt);
143 }
144
145 bool recvTimingResp(PacketPtr pkt)
146 {
147 return mon.recvTimingResp(pkt);
148 }
149
150 void recvTimingSnoopReq(PacketPtr pkt)
151 {
152 mon.recvTimingSnoopReq(pkt);
153 }
154
155 void recvRangeChange()
156 {
157 mon.recvRangeChange();
158 }
159
160 bool isSnooping() const
161 {
162 return mon.isSnooping();
163 }
164
165 void recvReqRetry()
166 {
167 mon.recvReqRetry();
168 }
169
170 void recvRetrySnoopResp()
171 {
172 mon.recvRetrySnoopResp();
173 }
174
175 private:
176
177 CommMonitor& mon;
178
179 };
180
181 /** Instance of master port, facing the memory side */
182 MonitorMasterPort masterPort;
183
184 /**
185 * This is the slave port of the communication monitor. All recv
186 * functions call a function in CommMonitor, where the
187 * send function of the master port is called. Besides this, these
188 * functions can also perform actions for capturing statistics.
189 */
190 class MonitorSlavePort : public SlavePort
191 {
192
193 public:
194
195 MonitorSlavePort(const std::string& _name, CommMonitor& _mon)
196 : SlavePort(_name, &_mon), mon(_mon)
197 { }
198
199 protected:
200
201 void recvFunctional(PacketPtr pkt)
202 {
203 mon.recvFunctional(pkt);
204 }
205
206 Tick recvAtomic(PacketPtr pkt)
207 {
208 return mon.recvAtomic(pkt);
209 }
210
211 bool recvTimingReq(PacketPtr pkt)
212 {
213 return mon.recvTimingReq(pkt);
214 }
215
216 bool recvTimingSnoopResp(PacketPtr pkt)
217 {
218 return mon.recvTimingSnoopResp(pkt);
219 }
220
221 AddrRangeList getAddrRanges() const
222 {
223 return mon.getAddrRanges();
224 }
225
226 void recvRespRetry()
227 {
228 mon.recvRespRetry();
229 }
230
231 private:
232
233 CommMonitor& mon;
234
235 };
236
237 /** Instance of slave port, i.e. on the CPU side */
238 MonitorSlavePort slavePort;
239
240 void recvFunctional(PacketPtr pkt);
241
242 void recvFunctionalSnoop(PacketPtr pkt);
243
244 Tick recvAtomic(PacketPtr pkt);
245
246 Tick recvAtomicSnoop(PacketPtr pkt);
247
248 bool recvTimingReq(PacketPtr pkt);
249
250 bool recvTimingResp(PacketPtr pkt);
251
252 void recvTimingSnoopReq(PacketPtr pkt);
253
254 bool recvTimingSnoopResp(PacketPtr pkt);
255
256 void recvRetrySnoopResp();
257
258 AddrRangeList getAddrRanges() const;
259
260 bool isSnooping() const;
261
262 void recvReqRetry();
263
264 void recvRespRetry();
265
266 void recvRangeChange();
267
268 /** Stats declarations, all in a struct for convenience. */
269 struct MonitorStats
270 {
271
272 /** Disable flag for burst length historgrams **/
273 bool disableBurstLengthHists;
274
275 /** Histogram of read burst lengths */
276 Stats::Histogram readBurstLengthHist;
277
278 /** Histogram of write burst lengths */
279 Stats::Histogram writeBurstLengthHist;
280
281 /** Disable flag for the bandwidth histograms */
282 bool disableBandwidthHists;
283
284 /**
285 * Histogram for read bandwidth per sample window. The
286 * internal counter is an unsigned int rather than a stat.
287 */
288 unsigned int readBytes;
289 Stats::Histogram readBandwidthHist;
290 Stats::Formula averageReadBW;
291 Stats::Scalar totalReadBytes;
292
293 /**
294 * Histogram for write bandwidth per sample window. The
295 * internal counter is an unsigned int rather than a stat.
296 */
297 unsigned int writtenBytes;
298 Stats::Histogram writeBandwidthHist;
299 Stats::Formula averageWriteBW;
300 Stats::Scalar totalWrittenBytes;
301
302 /** Disable flag for latency histograms. */
303 bool disableLatencyHists;
304
305 /** Histogram of read request-to-response latencies */
306 Stats::Histogram readLatencyHist;
307
308 /** Histogram of write request-to-response latencies */
309 Stats::Histogram writeLatencyHist;
310
311 /** Disable flag for ITT distributions. */
312 bool disableITTDists;
313
314 /**
315 * Inter transaction time (ITT) distributions. There are
316 * histograms of the time between two read, write or arbitrary
317 * accesses. The time of a request is the tick at which the
318 * request is forwarded by the monitor.
319 */
320 Stats::Distribution ittReadRead;
321 Stats::Distribution ittWriteWrite;
322 Stats::Distribution ittReqReq;
323 Tick timeOfLastRead;
324 Tick timeOfLastWrite;
325 Tick timeOfLastReq;
326
327 /** Disable flag for outstanding histograms. */
328 bool disableOutstandingHists;
329
330 /**
331 * Histogram of outstanding read requests. Counter for
332 * outstanding read requests is an unsigned integer because
333 * it should not be reset when stats are reset.
334 */
335 Stats::Histogram outstandingReadsHist;
336 unsigned int outstandingReadReqs;
337
338 /**
339 * Histogram of outstanding write requests. Counter for
340 * outstanding write requests is an unsigned integer because
341 * it should not be reset when stats are reset.
342 */
343 Stats::Histogram outstandingWritesHist;
344 unsigned int outstandingWriteReqs;
345
346 /** Disable flag for transaction histograms. */
347 bool disableTransactionHists;
348
349 /** Histogram of number of read transactions per time bin */
350 Stats::Histogram readTransHist;
351 unsigned int readTrans;
352
353 /** Histogram of number of timing write transactions per time bin */
354 Stats::Histogram writeTransHist;
355 unsigned int writeTrans;
356
357 /** Disable flag for address distributions. */
358 bool disableAddrDists;
359
41 */
42
43#ifndef __MEM_COMM_MONITOR_HH__
44#define __MEM_COMM_MONITOR_HH__
45
46#include "base/statistics.hh"
47#include "mem/mem_object.hh"
48#include "params/CommMonitor.hh"
49#include "sim/probe/mem.hh"
50
51/**
52 * The communication monitor is a MemObject which can monitor statistics of
53 * the communication happening between two ports in the memory system.
54 *
55 * Currently the following stats are implemented: Histograms of read/write
56 * transactions, read/write burst lengths, read/write bandwidth,
57 * outstanding read/write requests, read latency and inter transaction time
58 * (read-read, write-write, read/write-read/write). Furthermore it allows
59 * to capture the number of accesses to an address over time ("heat map").
60 * All stats can be disabled from Python.
61 */
62class CommMonitor : public MemObject
63{
64
65 public: // Construction & SimObject interfaces
66
67 /** Parameters of communication monitor */
68 typedef CommMonitorParams Params;
69 const Params* params() const
70 { return reinterpret_cast<const Params*>(_params); }
71
72 /**
73 * Constructor based on the Python params
74 *
75 * @param params Python parameters
76 */
77 CommMonitor(Params* params);
78
79 void init() override;
80 void regStats() override;
81 void startup() override;
82 void regProbePoints() override;
83
84 public: // MemObject interfaces
85 BaseMasterPort& getMasterPort(const std::string& if_name,
86 PortID idx = InvalidPortID) override;
87
88 BaseSlavePort& getSlavePort(const std::string& if_name,
89 PortID idx = InvalidPortID) override;
90
91 private:
92
93 /**
94 * Sender state class for the monitor so that we can annotate
95 * packets with a transmit time and receive time.
96 */
97 class CommMonitorSenderState : public Packet::SenderState
98 {
99
100 public:
101
102 /**
103 * Construct a new sender state and store the time so we can
104 * calculate round-trip latency.
105 *
106 * @param _transmitTime Time of packet transmission
107 */
108 CommMonitorSenderState(Tick _transmitTime)
109 : transmitTime(_transmitTime)
110 { }
111
112 /** Destructor */
113 ~CommMonitorSenderState() { }
114
115 /** Tick when request is transmitted */
116 Tick transmitTime;
117
118 };
119
120 /**
121 * This is the master port of the communication monitor. All recv
122 * functions call a function in CommMonitor, where the
123 * send function of the slave port is called. Besides this, these
124 * functions can also perform actions for capturing statistics.
125 */
126 class MonitorMasterPort : public MasterPort
127 {
128
129 public:
130
131 MonitorMasterPort(const std::string& _name, CommMonitor& _mon)
132 : MasterPort(_name, &_mon), mon(_mon)
133 { }
134
135 protected:
136
137 void recvFunctionalSnoop(PacketPtr pkt)
138 {
139 mon.recvFunctionalSnoop(pkt);
140 }
141
142 Tick recvAtomicSnoop(PacketPtr pkt)
143 {
144 return mon.recvAtomicSnoop(pkt);
145 }
146
147 bool recvTimingResp(PacketPtr pkt)
148 {
149 return mon.recvTimingResp(pkt);
150 }
151
152 void recvTimingSnoopReq(PacketPtr pkt)
153 {
154 mon.recvTimingSnoopReq(pkt);
155 }
156
157 void recvRangeChange()
158 {
159 mon.recvRangeChange();
160 }
161
162 bool isSnooping() const
163 {
164 return mon.isSnooping();
165 }
166
167 void recvReqRetry()
168 {
169 mon.recvReqRetry();
170 }
171
172 void recvRetrySnoopResp()
173 {
174 mon.recvRetrySnoopResp();
175 }
176
177 private:
178
179 CommMonitor& mon;
180
181 };
182
183 /** Instance of master port, facing the memory side */
184 MonitorMasterPort masterPort;
185
186 /**
187 * This is the slave port of the communication monitor. All recv
188 * functions call a function in CommMonitor, where the
189 * send function of the master port is called. Besides this, these
190 * functions can also perform actions for capturing statistics.
191 */
192 class MonitorSlavePort : public SlavePort
193 {
194
195 public:
196
197 MonitorSlavePort(const std::string& _name, CommMonitor& _mon)
198 : SlavePort(_name, &_mon), mon(_mon)
199 { }
200
201 protected:
202
203 void recvFunctional(PacketPtr pkt)
204 {
205 mon.recvFunctional(pkt);
206 }
207
208 Tick recvAtomic(PacketPtr pkt)
209 {
210 return mon.recvAtomic(pkt);
211 }
212
213 bool recvTimingReq(PacketPtr pkt)
214 {
215 return mon.recvTimingReq(pkt);
216 }
217
218 bool recvTimingSnoopResp(PacketPtr pkt)
219 {
220 return mon.recvTimingSnoopResp(pkt);
221 }
222
223 AddrRangeList getAddrRanges() const
224 {
225 return mon.getAddrRanges();
226 }
227
228 void recvRespRetry()
229 {
230 mon.recvRespRetry();
231 }
232
233 private:
234
235 CommMonitor& mon;
236
237 };
238
239 /** Instance of slave port, i.e. on the CPU side */
240 MonitorSlavePort slavePort;
241
242 void recvFunctional(PacketPtr pkt);
243
244 void recvFunctionalSnoop(PacketPtr pkt);
245
246 Tick recvAtomic(PacketPtr pkt);
247
248 Tick recvAtomicSnoop(PacketPtr pkt);
249
250 bool recvTimingReq(PacketPtr pkt);
251
252 bool recvTimingResp(PacketPtr pkt);
253
254 void recvTimingSnoopReq(PacketPtr pkt);
255
256 bool recvTimingSnoopResp(PacketPtr pkt);
257
258 void recvRetrySnoopResp();
259
260 AddrRangeList getAddrRanges() const;
261
262 bool isSnooping() const;
263
264 void recvReqRetry();
265
266 void recvRespRetry();
267
268 void recvRangeChange();
269
270 /** Stats declarations, all in a struct for convenience. */
271 struct MonitorStats
272 {
273
274 /** Disable flag for burst length historgrams **/
275 bool disableBurstLengthHists;
276
277 /** Histogram of read burst lengths */
278 Stats::Histogram readBurstLengthHist;
279
280 /** Histogram of write burst lengths */
281 Stats::Histogram writeBurstLengthHist;
282
283 /** Disable flag for the bandwidth histograms */
284 bool disableBandwidthHists;
285
286 /**
287 * Histogram for read bandwidth per sample window. The
288 * internal counter is an unsigned int rather than a stat.
289 */
290 unsigned int readBytes;
291 Stats::Histogram readBandwidthHist;
292 Stats::Formula averageReadBW;
293 Stats::Scalar totalReadBytes;
294
295 /**
296 * Histogram for write bandwidth per sample window. The
297 * internal counter is an unsigned int rather than a stat.
298 */
299 unsigned int writtenBytes;
300 Stats::Histogram writeBandwidthHist;
301 Stats::Formula averageWriteBW;
302 Stats::Scalar totalWrittenBytes;
303
304 /** Disable flag for latency histograms. */
305 bool disableLatencyHists;
306
307 /** Histogram of read request-to-response latencies */
308 Stats::Histogram readLatencyHist;
309
310 /** Histogram of write request-to-response latencies */
311 Stats::Histogram writeLatencyHist;
312
313 /** Disable flag for ITT distributions. */
314 bool disableITTDists;
315
316 /**
317 * Inter transaction time (ITT) distributions. There are
318 * histograms of the time between two read, write or arbitrary
319 * accesses. The time of a request is the tick at which the
320 * request is forwarded by the monitor.
321 */
322 Stats::Distribution ittReadRead;
323 Stats::Distribution ittWriteWrite;
324 Stats::Distribution ittReqReq;
325 Tick timeOfLastRead;
326 Tick timeOfLastWrite;
327 Tick timeOfLastReq;
328
329 /** Disable flag for outstanding histograms. */
330 bool disableOutstandingHists;
331
332 /**
333 * Histogram of outstanding read requests. Counter for
334 * outstanding read requests is an unsigned integer because
335 * it should not be reset when stats are reset.
336 */
337 Stats::Histogram outstandingReadsHist;
338 unsigned int outstandingReadReqs;
339
340 /**
341 * Histogram of outstanding write requests. Counter for
342 * outstanding write requests is an unsigned integer because
343 * it should not be reset when stats are reset.
344 */
345 Stats::Histogram outstandingWritesHist;
346 unsigned int outstandingWriteReqs;
347
348 /** Disable flag for transaction histograms. */
349 bool disableTransactionHists;
350
351 /** Histogram of number of read transactions per time bin */
352 Stats::Histogram readTransHist;
353 unsigned int readTrans;
354
355 /** Histogram of number of timing write transactions per time bin */
356 Stats::Histogram writeTransHist;
357 unsigned int writeTrans;
358
359 /** Disable flag for address distributions. */
360 bool disableAddrDists;
361
362 /** Address mask for sources of read accesses to be captured */
363 const Addr readAddrMask;
364
365 /** Address mask for sources of write accesses to be captured */
366 const Addr writeAddrMask;
367
360 /**
361 * Histogram of number of read accesses to addresses over
362 * time.
363 */
364 Stats::SparseHistogram readAddrDist;
365
366 /**
367 * Histogram of number of write accesses to addresses over
368 * time.
369 */
370 Stats::SparseHistogram writeAddrDist;
371
372 /**
373 * Create the monitor stats and initialise all the members
374 * that are not statistics themselves, but used to control the
375 * stats or track values during a sample period.
376 */
377 MonitorStats(const CommMonitorParams* params) :
378 disableBurstLengthHists(params->disable_burst_length_hists),
379 disableBandwidthHists(params->disable_bandwidth_hists),
380 readBytes(0), writtenBytes(0),
381 disableLatencyHists(params->disable_latency_hists),
382 disableITTDists(params->disable_itt_dists),
383 timeOfLastRead(0), timeOfLastWrite(0), timeOfLastReq(0),
384 disableOutstandingHists(params->disable_outstanding_hists),
385 outstandingReadReqs(0), outstandingWriteReqs(0),
386 disableTransactionHists(params->disable_transaction_hists),
387 readTrans(0), writeTrans(0),
368 /**
369 * Histogram of number of read accesses to addresses over
370 * time.
371 */
372 Stats::SparseHistogram readAddrDist;
373
374 /**
375 * Histogram of number of write accesses to addresses over
376 * time.
377 */
378 Stats::SparseHistogram writeAddrDist;
379
380 /**
381 * Create the monitor stats and initialise all the members
382 * that are not statistics themselves, but used to control the
383 * stats or track values during a sample period.
384 */
385 MonitorStats(const CommMonitorParams* params) :
386 disableBurstLengthHists(params->disable_burst_length_hists),
387 disableBandwidthHists(params->disable_bandwidth_hists),
388 readBytes(0), writtenBytes(0),
389 disableLatencyHists(params->disable_latency_hists),
390 disableITTDists(params->disable_itt_dists),
391 timeOfLastRead(0), timeOfLastWrite(0), timeOfLastReq(0),
392 disableOutstandingHists(params->disable_outstanding_hists),
393 outstandingReadReqs(0), outstandingWriteReqs(0),
394 disableTransactionHists(params->disable_transaction_hists),
395 readTrans(0), writeTrans(0),
388 disableAddrDists(params->disable_addr_dists)
396 disableAddrDists(params->disable_addr_dists),
397 readAddrMask(params->read_addr_mask),
398 writeAddrMask(params->write_addr_mask)
389 { }
390
399 { }
400
401 void updateReqStats(const ProbePoints::PacketInfo& pkt, bool is_atomic,
402 bool expects_response);
403 void updateRespStats(const ProbePoints::PacketInfo& pkt, Tick latency,
404 bool is_atomic);
391 };
392
393 /** This function is called periodically at the end of each time bin */
394 void samplePeriodic();
395
396 /** Periodic event called at the end of each simulation time bin */
397 EventWrapper<CommMonitor, &CommMonitor::samplePeriodic> samplePeriodicEvent;
398
399 /**
400 *@{
401 * @name Configuration
402 */
403
404 /** Length of simulation time bin*/
405 const Tick samplePeriodTicks;
406 /** Sample period in seconds */
407 const double samplePeriod;
408
405 };
406
407 /** This function is called periodically at the end of each time bin */
408 void samplePeriodic();
409
410 /** Periodic event called at the end of each simulation time bin */
411 EventWrapper<CommMonitor, &CommMonitor::samplePeriodic> samplePeriodicEvent;
412
413 /**
414 *@{
415 * @name Configuration
416 */
417
418 /** Length of simulation time bin*/
419 const Tick samplePeriodTicks;
420 /** Sample period in seconds */
421 const double samplePeriod;
422
409 /** Address mask for sources of read accesses to be captured */
410 const Addr readAddrMask;
411
412 /** Address mask for sources of write accesses to be captured */
413 const Addr writeAddrMask;
414
415 /** @} */
416
417 /** Instantiate stats */
418 MonitorStats stats;
419
420 protected: // Probe points
421 /**
422 * @{
423 * @name Memory system probe points
424 */
425
426 /** Successfully forwarded request packet */
427 ProbePoints::PacketUPtr ppPktReq;
428
429 /** Successfully forwarded response packet */
430 ProbePoints::PacketUPtr ppPktResp;
431
432 /** @} */
433};
434
435#endif //__MEM_COMM_MONITOR_HH__
423 /** @} */
424
425 /** Instantiate stats */
426 MonitorStats stats;
427
428 protected: // Probe points
429 /**
430 * @{
431 * @name Memory system probe points
432 */
433
434 /** Successfully forwarded request packet */
435 ProbePoints::PacketUPtr ppPktReq;
436
437 /** Successfully forwarded response packet */
438 ProbePoints::PacketUPtr ppPktResp;
439
440 /** @} */
441};
442
443#endif //__MEM_COMM_MONITOR_HH__