gem5  v20.1.0.0
comm_monitor.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2013, 2015, 2018-2019 ARM Limited
3  * Copyright (c) 2016 Google Inc.
4  * Copyright (c) 2017, Centre National de la Recherche Scientifique
5  * All rights reserved.
6  *
7  * The license below extends only to copyright in the software and shall
8  * not be construed as granting a license to any other intellectual
9  * property including but not limited to intellectual property relating
10  * to a hardware implementation of the functionality of the software
11  * licensed hereunder. You may use the software subject to the license
12  * terms below provided that you ensure that this notice is replicated
13  * unmodified and in its entirety in all distributions of the software,
14  * modified or unmodified, in source code or in binary form.
15  *
16  * Redistribution and use in source and binary forms, with or without
17  * modification, are permitted provided that the following conditions are
18  * met: redistributions of source code must retain the above copyright
19  * notice, this list of conditions and the following disclaimer;
20  * redistributions in binary form must reproduce the above copyright
21  * notice, this list of conditions and the following disclaimer in the
22  * documentation and/or other materials provided with the distribution;
23  * neither the name of the copyright holders nor the names of its
24  * contributors may be used to endorse or promote products derived from
25  * this software without specific prior written permission.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38  */
39 
40 #ifndef __MEM_COMM_MONITOR_HH__
41 #define __MEM_COMM_MONITOR_HH__
42 
43 #include "base/statistics.hh"
44 #include "mem/port.hh"
45 #include "params/CommMonitor.hh"
46 #include "sim/probe/mem.hh"
47 #include "sim/sim_object.hh"
48 
60 class CommMonitor : public SimObject
61 {
62 
63  public: // Construction & SimObject interfaces
64 
66  typedef CommMonitorParams Params;
67  const Params* params() const
68  { return reinterpret_cast<const Params*>(_params); }
69 
76 
77  void init() override;
78  void startup() override;
79  void regProbePoints() override;
80 
81  public: // SimObject interfaces
82  Port &getPort(const std::string &if_name,
83  PortID idx=InvalidPortID) override;
84 
85  private:
86 
92  {
93 
94  public:
95 
103  : transmitTime(_transmitTime)
104  { }
105 
108 
111 
112  };
113 
121  {
122 
123  public:
124 
125  MonitorRequestPort(const std::string& _name, CommMonitor& _mon)
126  : RequestPort(_name, &_mon), mon(_mon)
127  { }
128 
129  protected:
130 
132  {
134  }
135 
137  {
138  return mon.recvAtomicSnoop(pkt);
139  }
140 
142  {
143  return mon.recvTimingResp(pkt);
144  }
145 
147  {
148  mon.recvTimingSnoopReq(pkt);
149  }
150 
152  {
154  }
155 
156  bool isSnooping() const
157  {
158  return mon.isSnooping();
159  }
160 
162  {
163  mon.recvReqRetry();
164  }
165 
167  {
169  }
170 
171  private:
172 
174 
175  };
176 
179 
187  {
188 
189  public:
190 
191  MonitorResponsePort(const std::string& _name, CommMonitor& _mon)
192  : ResponsePort(_name, &_mon), mon(_mon)
193  { }
194 
195  protected:
196 
198  {
199  mon.recvFunctional(pkt);
200  }
201 
203  {
204  return mon.recvAtomic(pkt);
205  }
206 
208  {
209  return mon.recvTimingReq(pkt);
210  }
211 
213  {
214  return mon.recvTimingSnoopResp(pkt);
215  }
216 
218  {
219  return mon.getAddrRanges();
220  }
221 
223  {
224  mon.recvRespRetry();
225  }
226 
228  {
229  return mon.tryTiming(pkt);
230  }
231 
232  private:
233 
235 
236  };
237 
240 
241  void recvFunctional(PacketPtr pkt);
242 
243  void recvFunctionalSnoop(PacketPtr pkt);
244 
246 
248 
249  bool recvTimingReq(PacketPtr pkt);
250 
251  bool recvTimingResp(PacketPtr pkt);
252 
253  void recvTimingSnoopReq(PacketPtr pkt);
254 
255  bool recvTimingSnoopResp(PacketPtr pkt);
256 
257  void recvRetrySnoopResp();
258 
260 
261  bool isSnooping() const;
262 
263  void recvReqRetry();
264 
265  void recvRespRetry();
266 
267  void recvRangeChange();
268 
269  bool tryTiming(PacketPtr pkt);
270 
272  struct MonitorStats : public Stats::Group
273  {
276 
279 
282 
285 
290  unsigned int readBytes;
294 
299  unsigned int writtenBytes;
303 
306 
309 
312 
315 
328 
331 
338  unsigned int outstandingReadReqs;
339 
346  unsigned int outstandingWriteReqs;
347 
350 
353  unsigned int readTrans;
354 
357  unsigned int writeTrans;
358 
361 
364 
367 
373 
379 
385  MonitorStats(Stats::Group *parent, const CommMonitorParams* params);
386 
387  void updateReqStats(const ProbePoints::PacketInfo& pkt, bool is_atomic,
388  bool expects_response);
389  void updateRespStats(const ProbePoints::PacketInfo& pkt, Tick latency,
390  bool is_atomic);
391  };
392 
394  void samplePeriodic();
395 
398 
407  const double samplePeriod;
408 
413 
414  protected: // Probe points
422 
425 
427 };
428 
429 #endif //__MEM_COMM_MONITOR_HH__
CommMonitor::MonitorStats::writeAddrDist
Stats::SparseHistogram writeAddrDist
Histogram of number of write accesses to addresses over time.
Definition: comm_monitor.hh:378
CommMonitor::samplePeriodic
void samplePeriodic()
This function is called periodically at the end of each time bin.
Definition: comm_monitor.cc:513
CommMonitor::MonitorRequestPort::recvTimingResp
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Definition: comm_monitor.hh:141
CommMonitor::CommMonitorSenderState::~CommMonitorSenderState
~CommMonitorSenderState()
Destructor.
Definition: comm_monitor.hh:107
ResponsePort
A ResponsePort is a specialization of a port.
Definition: port.hh:265
CommMonitor::MonitorStats::updateReqStats
void updateReqStats(const ProbePoints::PacketInfo &pkt, bool is_atomic, bool expects_response)
Definition: comm_monitor.cc:241
CommMonitor::MonitorStats::disableBurstLengthHists
bool disableBurstLengthHists
Disable flag for burst length histograms.
Definition: comm_monitor.hh:275
CommMonitor::startup
void startup() override
startup() is the final initialization call before simulation.
Definition: comm_monitor.cc:551
CommMonitor
The communication monitor is a SimObject which can monitor statistics of the communication happening ...
Definition: comm_monitor.hh:60
CommMonitor::recvAtomic
Tick recvAtomic(PacketPtr pkt)
Definition: comm_monitor.cc:340
CommMonitor::MonitorStats
Stats declarations, all in a struct for convenience.
Definition: comm_monitor.hh:272
CommMonitor::MonitorStats::writeBurstLengthHist
Stats::Histogram writeBurstLengthHist
Histogram of write burst lengths.
Definition: comm_monitor.hh:281
CommMonitor::recvRespRetry
void recvRespRetry()
Definition: comm_monitor.cc:495
CommMonitor::recvTimingSnoopResp
bool recvTimingSnoopResp(PacketPtr pkt)
Definition: comm_monitor.cc:463
CommMonitor::isSnooping
bool isSnooping() const
Definition: comm_monitor.cc:475
InvalidPortID
const PortID InvalidPortID
Definition: types.hh:238
CommMonitor::MonitorResponsePort
This is the CPU-side port of the communication monitor.
Definition: comm_monitor.hh:186
CommMonitor::memSidePort
MonitorRequestPort memSidePort
Instance of request port, facing the memory side.
Definition: comm_monitor.hh:178
CommMonitor::init
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: comm_monitor.cc:67
CommMonitor::MonitorRequestPort::recvReqRetry
void recvReqRetry()
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
Definition: comm_monitor.hh:161
CommMonitor::CommMonitorSenderState::transmitTime
Tick transmitTime
Tick when request is transmitted.
Definition: comm_monitor.hh:110
CommMonitor::recvTimingReq
bool recvTimingReq(PacketPtr pkt)
Definition: comm_monitor.cc:367
CommMonitor::MonitorStats::readBytes
unsigned int readBytes
Histogram for read bandwidth per sample window.
Definition: comm_monitor.hh:290
CommMonitor::recvFunctionalSnoop
void recvFunctionalSnoop(PacketPtr pkt)
Definition: comm_monitor.cc:100
CommMonitor::MonitorStats::disableTransactionHists
bool disableTransactionHists
Disable flag for transaction histograms.
Definition: comm_monitor.hh:349
CommMonitor::MonitorStats::outstandingWriteReqs
unsigned int outstandingWriteReqs
Definition: comm_monitor.hh:346
CommMonitor::MonitorStats::timeOfLastWrite
Tick timeOfLastWrite
Definition: comm_monitor.hh:326
CommMonitor::MonitorStats::readTrans
unsigned int readTrans
Definition: comm_monitor.hh:353
CommMonitor::MonitorStats::writtenBytes
unsigned int writtenBytes
Histogram for write bandwidth per sample window.
Definition: comm_monitor.hh:299
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
CommMonitor::params
const Params * params() const
Definition: comm_monitor.hh:67
CommMonitor::samplePeriodicEvent
EventFunctionWrapper samplePeriodicEvent
Periodic event called at the end of each simulation time bin.
Definition: comm_monitor.hh:397
PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:237
CommMonitor::MonitorStats::writeBandwidthHist
Stats::Histogram writeBandwidthHist
Definition: comm_monitor.hh:300
CommMonitor::recvRetrySnoopResp
void recvRetrySnoopResp()
Definition: comm_monitor.cc:469
CommMonitor::MonitorStats::outstandingWritesHist
Stats::Histogram outstandingWritesHist
Histogram of outstanding write requests.
Definition: comm_monitor.hh:345
CommMonitor::MonitorStats::ittWriteWrite
Stats::Distribution ittWriteWrite
Definition: comm_monitor.hh:323
CommMonitor::MonitorStats::writeLatencyHist
Stats::Histogram writeLatencyHist
Histogram of write request-to-response latencies.
Definition: comm_monitor.hh:311
CommMonitor::MonitorResponsePort::tryTiming
bool tryTiming(PacketPtr pkt)
Availability request from the peer.
Definition: comm_monitor.hh:227
CommMonitor::cpuSidePort
MonitorResponsePort cpuSidePort
Instance of response port, i.e.
Definition: comm_monitor.hh:239
CommMonitor::MonitorStats::timeOfLastReq
Tick timeOfLastReq
Definition: comm_monitor.hh:327
CommMonitor::MonitorStats::disableBandwidthHists
bool disableBandwidthHists
Disable flag for the bandwidth histograms.
Definition: comm_monitor.hh:284
CommMonitor::recvFunctional
void recvFunctional(PacketPtr pkt)
Definition: comm_monitor.cc:94
CommMonitor::MonitorStats::disableLatencyHists
bool disableLatencyHists
Disable flag for latency histograms.
Definition: comm_monitor.hh:305
CommMonitor::MonitorStats::readTransHist
Stats::Histogram readTransHist
Histogram of number of read transactions per time bin.
Definition: comm_monitor.hh:352
CommMonitor::MonitorStats::readBandwidthHist
Stats::Histogram readBandwidthHist
Definition: comm_monitor.hh:291
CommMonitor::MonitorStats::disableITTDists
bool disableITTDists
Disable flag for ITT distributions.
Definition: comm_monitor.hh:314
CommMonitor::MonitorRequestPort::recvRangeChange
void recvRangeChange()
Called to receive an address range change from the peer response port.
Definition: comm_monitor.hh:151
CommMonitor::CommMonitor
CommMonitor(Params *params)
Constructor based on the Python params.
Definition: comm_monitor.cc:46
EventFunctionWrapper
Definition: eventq.hh:1101
CommMonitor::regProbePoints
void regProbePoints() override
Register probe points for this object.
Definition: comm_monitor.cc:75
Stats::Histogram
A simple histogram stat.
Definition: statistics.hh:2654
CommMonitor::MonitorStats::disableAddrDists
bool disableAddrDists
Disable flag for address distributions.
Definition: comm_monitor.hh:360
CommMonitor::CommMonitorSenderState::CommMonitorSenderState
CommMonitorSenderState(Tick _transmitTime)
Construct a new sender state and store the time so we can calculate round-trip latency.
Definition: comm_monitor.hh:102
CommMonitor::MonitorStats::averageWriteBandwidth
Stats::Formula averageWriteBandwidth
Definition: comm_monitor.hh:302
Stats::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:2533
CommMonitor::recvReqRetry
void recvReqRetry()
Definition: comm_monitor.cc:489
CommMonitor::Params
CommMonitorParams Params
Parameters of communication monitor.
Definition: comm_monitor.hh:66
CommMonitor::recvTimingResp
bool recvTimingResp(PacketPtr pkt)
Definition: comm_monitor.cc:408
Packet::SenderState
A virtual base opaque structure used to hold state associated with the packet (e.g....
Definition: packet.hh:431
CommMonitor::MonitorStats::readAddrMask
const Addr readAddrMask
Address mask for sources of read accesses to be captured.
Definition: comm_monitor.hh:363
sim_object.hh
CommMonitor::MonitorResponsePort::recvFunctional
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the peer.
Definition: comm_monitor.hh:197
CommMonitor::MonitorStats::outstandingReadsHist
Stats::Histogram outstandingReadsHist
Histogram of outstanding read requests.
Definition: comm_monitor.hh:337
CommMonitor::MonitorStats::disableOutstandingHists
bool disableOutstandingHists
Disable flag for outstanding histograms.
Definition: comm_monitor.hh:330
statistics.hh
CommMonitor::MonitorStats::writeTransHist
Stats::Histogram writeTransHist
Histogram of number of timing write transactions per time bin.
Definition: comm_monitor.hh:356
Port
Ports are used to interface objects to each other.
Definition: port.hh:56
CommMonitor::MonitorRequestPort::recvFunctionalSnoop
void recvFunctionalSnoop(PacketPtr pkt)
Receive a functional snoop request packet from the peer.
Definition: comm_monitor.hh:131
CommMonitor::MonitorRequestPort::isSnooping
bool isSnooping() const
Determine if this request port is snooping or not.
Definition: comm_monitor.hh:156
CommMonitor::MonitorResponsePort::recvRespRetry
void recvRespRetry()
Called by the peer if sendTimingResp was called on this protocol (causing recvTimingResp to be called...
Definition: comm_monitor.hh:222
CommMonitor::MonitorResponsePort::getAddrRanges
AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
Definition: comm_monitor.hh:217
port.hh
CommMonitor::MonitorStats::readBurstLengthHist
Stats::Histogram readBurstLengthHist
Histogram of read burst lengths.
Definition: comm_monitor.hh:278
CommMonitor::ppPktReq
ProbePoints::PacketUPtr ppPktReq
Successfully forwarded request packet.
Definition: comm_monitor.hh:421
CommMonitor::MonitorRequestPort::mon
CommMonitor & mon
Definition: comm_monitor.hh:173
CommMonitor::MonitorRequestPort::recvRetrySnoopResp
void recvRetrySnoopResp()
Called by the peer if sendTimingSnoopResp was called on this protocol (causing recvTimingSnoopResp to...
Definition: comm_monitor.hh:166
CommMonitor::MonitorRequestPort
This is the request port of the communication monitor.
Definition: comm_monitor.hh:120
CommMonitor::MonitorRequestPort::recvAtomicSnoop
Tick recvAtomicSnoop(PacketPtr pkt)
Receive an atomic snoop request packet from our peer.
Definition: comm_monitor.hh:136
CommMonitor::recvRangeChange
void recvRangeChange()
Definition: comm_monitor.cc:507
CommMonitor::MonitorStats::totalReadBytes
Stats::Scalar totalReadBytes
Definition: comm_monitor.hh:292
CommMonitor::MonitorRequestPort::MonitorRequestPort
MonitorRequestPort(const std::string &_name, CommMonitor &_mon)
Definition: comm_monitor.hh:125
CommMonitor::MonitorStats::readAddrDist
Stats::SparseHistogram readAddrDist
Histogram of number of read accesses to addresses over time.
Definition: comm_monitor.hh:372
CommMonitor::MonitorResponsePort::recvTimingSnoopResp
bool recvTimingSnoopResp(PacketPtr pkt)
Receive a timing snoop response from the peer.
Definition: comm_monitor.hh:212
RequestPort
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition: port.hh:74
CommMonitor::MonitorStats::MonitorStats
MonitorStats(Stats::Group *parent, const CommMonitorParams *params)
Create the monitor stats and initialise all the members that are not statistics themselves,...
Definition: comm_monitor.cc:105
CommMonitor::tryTiming
bool tryTiming(PacketPtr pkt)
Definition: comm_monitor.cc:501
CommMonitor::CommMonitorSenderState
Sender state class for the monitor so that we can annotate packets with a transmit time and receive t...
Definition: comm_monitor.hh:91
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
Stats::Distribution
A simple distribution stat.
Definition: statistics.hh:2617
CommMonitor::MonitorResponsePort::recvTimingReq
bool recvTimingReq(PacketPtr pkt)
Receive a timing request from the peer.
Definition: comm_monitor.hh:207
CommMonitor::MonitorResponsePort::mon
CommMonitor & mon
Definition: comm_monitor.hh:234
CommMonitor::ppPktResp
ProbePoints::PacketUPtr ppPktResp
Successfully forwarded response packet.
Definition: comm_monitor.hh:424
CommMonitor::samplePeriod
const double samplePeriod
Sample period in seconds.
Definition: comm_monitor.hh:407
CommMonitor::MonitorStats::writeTrans
unsigned int writeTrans
Definition: comm_monitor.hh:357
SimObject::_params
const SimObjectParams * _params
Cached copy of the object parameters.
Definition: sim_object.hh:110
Stats::Formula
A formula for statistics that is calculated when printed.
Definition: statistics.hh:3037
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
Stats::Group
Statistics container.
Definition: group.hh:83
CommMonitor::MonitorResponsePort::recvAtomic
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the peer.
Definition: comm_monitor.hh:202
CommMonitor::MonitorStats::ittReqReq
Stats::Distribution ittReqReq
Definition: comm_monitor.hh:324
CommMonitor::MonitorStats::totalWrittenBytes
Stats::Scalar totalWrittenBytes
Definition: comm_monitor.hh:301
Stats::SparseHistogram
Definition: statistics.hh:3007
CommMonitor::MonitorStats::writeAddrMask
const Addr writeAddrMask
Address mask for sources of write accesses to be captured.
Definition: comm_monitor.hh:366
CommMonitor::MonitorStats::timeOfLastRead
Tick timeOfLastRead
Definition: comm_monitor.hh:325
CommMonitor::recvAtomicSnoop
Tick recvAtomicSnoop(PacketPtr pkt)
Definition: comm_monitor.cc:361
mem.hh
CommMonitor::MonitorStats::readLatencyHist
Stats::Histogram readLatencyHist
Histogram of read request-to-response latencies.
Definition: comm_monitor.hh:308
CommMonitor::recvTimingSnoopReq
void recvTimingSnoopReq(PacketPtr pkt)
Definition: comm_monitor.cc:457
CommMonitor::MonitorStats::updateRespStats
void updateRespStats(const ProbePoints::PacketInfo &pkt, Tick latency, bool is_atomic)
Definition: comm_monitor.cc:308
std::list< AddrRange >
CommMonitor::MonitorStats::ittReadRead
Stats::Distribution ittReadRead
Inter transaction time (ITT) distributions.
Definition: comm_monitor.hh:322
ProbePoints::PacketUPtr
std::unique_ptr< Packet > PacketUPtr
Definition: mem.hh:104
CommMonitor::getAddrRanges
AddrRangeList getAddrRanges() const
Definition: comm_monitor.cc:482
CommMonitor::stats
MonitorStats stats
Instantiate stats.
Definition: comm_monitor.hh:412
ProbePoints::PacketInfo
A struct to hold on to the essential fields from a packet, so that the packet and underlying request ...
Definition: mem.hh:53
CommMonitor::MonitorResponsePort::MonitorResponsePort
MonitorResponsePort(const std::string &_name, CommMonitor &_mon)
Definition: comm_monitor.hh:191
CommMonitor::samplePeriodTicks
const Tick samplePeriodTicks
Length of simulation time bin.
Definition: comm_monitor.hh:405
CommMonitor::MonitorStats::averageReadBandwidth
Stats::Formula averageReadBandwidth
Definition: comm_monitor.hh:293
CommMonitor::MonitorStats::outstandingReadReqs
unsigned int outstandingReadReqs
Definition: comm_monitor.hh:338
CommMonitor::MonitorRequestPort::recvTimingSnoopReq
void recvTimingSnoopReq(PacketPtr pkt)
Receive a timing snoop request from the peer.
Definition: comm_monitor.hh:146
CommMonitor::getPort
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: comm_monitor.cc:82
SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:92

Generated on Wed Sep 30 2020 14:02:13 for gem5 by doxygen 1.8.17