gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 
49 namespace gem5
50 {
51 
63 class CommMonitor : public SimObject
64 {
65 
66  public: // Construction & SimObject interfaces
67 
69  using Params = CommMonitorParams;
70 
76  CommMonitor(const Params &params);
77 
78  void init() override;
79  void startup() override;
80  void regProbePoints() override;
81 
82  public: // SimObject interfaces
83  Port &getPort(const std::string &if_name,
84  PortID idx=InvalidPortID) override;
85 
86  private:
87 
93  {
94 
95  public:
96 
104  : transmitTime(_transmitTime)
105  { }
106 
109 
112 
113  };
114 
122  {
123 
124  public:
125 
126  MonitorRequestPort(const std::string& _name, CommMonitor& _mon)
127  : RequestPort(_name), mon(_mon)
128  { }
129 
130  protected:
131 
133  {
135  }
136 
138  {
139  return mon.recvAtomicSnoop(pkt);
140  }
141 
143  {
144  return mon.recvTimingResp(pkt);
145  }
146 
148  {
149  mon.recvTimingSnoopReq(pkt);
150  }
151 
153  {
155  }
156 
157  bool isSnooping() const
158  {
159  return mon.isSnooping();
160  }
161 
163  {
164  mon.recvReqRetry();
165  }
166 
168  {
170  }
171 
172  private:
173 
175 
176  };
177 
180 
188  {
189 
190  public:
191 
192  MonitorResponsePort(const std::string& _name, CommMonitor& _mon)
193  : ResponsePort(_name), mon(_mon)
194  { }
195 
196  protected:
197 
199  {
200  mon.recvFunctional(pkt);
201  }
202 
204  {
205  return mon.recvAtomic(pkt);
206  }
207 
209  {
210  return mon.recvTimingReq(pkt);
211  }
212 
214  {
215  return mon.recvTimingSnoopResp(pkt);
216  }
217 
219  {
220  return mon.getAddrRanges();
221  }
222 
224  {
225  mon.recvRespRetry();
226  }
227 
229  {
230  return mon.tryTiming(pkt);
231  }
232 
233  private:
234 
236 
237  };
238 
241 
242  void recvFunctional(PacketPtr pkt);
243 
244  void recvFunctionalSnoop(PacketPtr pkt);
245 
247 
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 
261 
262  bool isSnooping() const;
263 
264  void recvReqRetry();
265 
266  void recvRespRetry();
267 
268  void recvRangeChange();
269 
270  bool tryTiming(PacketPtr pkt);
271 
274  {
277 
280 
283 
286 
291  unsigned int readBytes;
295 
300  unsigned int writtenBytes;
304 
307 
310 
313 
316 
329 
332 
339  unsigned int outstandingReadReqs;
340 
347  unsigned int outstandingWriteReqs;
348 
351 
354  unsigned int readTrans;
355 
358  unsigned int writeTrans;
359 
362 
365 
368 
374 
380 
387  const CommMonitorParams &params);
388 
389  void updateReqStats(const probing::PacketInfo& pkt, bool is_atomic,
390  bool expects_response);
391  void updateRespStats(const probing::PacketInfo& pkt, Tick latency,
392  bool is_atomic);
393  };
394 
396  void samplePeriodic();
397 
400 
409  const double samplePeriod;
410 
415 
416  protected: // Probe points
424 
427 
429 };
430 
431 } // namespace gem5
432 
433 #endif //__MEM_COMM_MONITOR_HH__
gem5::statistics::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1929
gem5::CommMonitor
The communication monitor is a SimObject which can monitor statistics of the communication happening ...
Definition: comm_monitor.hh:63
gem5::CommMonitor::MonitorStats::outstandingReadsHist
statistics::Histogram outstandingReadsHist
Histogram of outstanding read requests.
Definition: comm_monitor.hh:338
gem5::PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:245
gem5::CommMonitor::MonitorStats::readTransHist
statistics::Histogram readTransHist
Histogram of number of read transactions per time bin.
Definition: comm_monitor.hh:353
gem5::CommMonitor::recvRespRetry
void recvRespRetry()
Definition: comm_monitor.cc:513
gem5::CommMonitor::recvTimingResp
bool recvTimingResp(PacketPtr pkt)
Definition: comm_monitor.cc:426
gem5::CommMonitor::recvAtomic
Tick recvAtomic(PacketPtr pkt)
Definition: comm_monitor.cc:358
gem5::statistics::Distribution
A simple distribution stat.
Definition: statistics.hh:2083
gem5::CommMonitor::CommMonitor
CommMonitor(const Params &params)
Constructor based on the Python params.
Definition: comm_monitor.cc:51
gem5::CommMonitor::MonitorStats::outstandingReadReqs
unsigned int outstandingReadReqs
Definition: comm_monitor.hh:339
gem5::CommMonitor::MonitorRequestPort::recvFunctionalSnoop
void recvFunctionalSnoop(PacketPtr pkt)
Receive a functional snoop request packet from the peer.
Definition: comm_monitor.hh:132
gem5::CommMonitor::MonitorStats::writeBurstLengthHist
statistics::Histogram writeBurstLengthHist
Histogram of write burst lengths.
Definition: comm_monitor.hh:282
gem5::CommMonitor::recvTimingSnoopReq
void recvTimingSnoopReq(PacketPtr pkt)
Definition: comm_monitor.cc:475
gem5::CommMonitor::MonitorResponsePort::tryTiming
bool tryTiming(PacketPtr pkt)
Availability request from the peer.
Definition: comm_monitor.hh:228
gem5::CommMonitor::MonitorStats::writeTransHist
statistics::Histogram writeTransHist
Histogram of number of timing write transactions per time bin.
Definition: comm_monitor.hh:357
gem5::CommMonitor::CommMonitorSenderState::~CommMonitorSenderState
~CommMonitorSenderState()
Destructor.
Definition: comm_monitor.hh:108
gem5::CommMonitor::MonitorStats::readBandwidthHist
statistics::Histogram readBandwidthHist
Definition: comm_monitor.hh:292
gem5::CommMonitor::MonitorResponsePort::recvTimingReq
bool recvTimingReq(PacketPtr pkt)
Receive a timing request from the peer.
Definition: comm_monitor.hh:208
gem5::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:162
gem5::CommMonitor::MonitorStats::disableLatencyHists
bool disableLatencyHists
Disable flag for latency histograms.
Definition: comm_monitor.hh:306
gem5::CommMonitor::recvAtomicSnoop
Tick recvAtomicSnoop(PacketPtr pkt)
Definition: comm_monitor.cc:379
gem5::CommMonitor::stats
MonitorStats stats
Instantiate stats.
Definition: comm_monitor.hh:414
gem5::CommMonitor::MonitorResponsePort::getAddrRanges
AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
Definition: comm_monitor.hh:218
gem5::CommMonitor::MonitorStats::readAddrMask
const Addr readAddrMask
Address mask for sources of read accesses to be captured.
Definition: comm_monitor.hh:364
gem5::CommMonitor::MonitorRequestPort::isSnooping
bool isSnooping() const
Determine if this request port is snooping or not.
Definition: comm_monitor.hh:157
gem5::CommMonitor::MonitorStats::readAddrDist
statistics::SparseHistogram readAddrDist
Histogram of number of read accesses to addresses over time.
Definition: comm_monitor.hh:373
gem5::CommMonitor::MonitorResponsePort::recvAtomic
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the peer.
Definition: comm_monitor.hh:203
gem5::CommMonitor::MonitorResponsePort::mon
CommMonitor & mon
Definition: comm_monitor.hh:235
gem5::CommMonitor::MonitorStats::writeAddrMask
const Addr writeAddrMask
Address mask for sources of write accesses to be captured.
Definition: comm_monitor.hh:367
gem5::CommMonitor::MonitorStats::writeAddrDist
statistics::SparseHistogram writeAddrDist
Histogram of number of write accesses to addresses over time.
Definition: comm_monitor.hh:379
gem5::statistics::Formula
A formula for statistics that is calculated when printed.
Definition: statistics.hh:2538
gem5::CommMonitor::MonitorResponsePort::recvTimingSnoopResp
bool recvTimingSnoopResp(PacketPtr pkt)
Receive a timing snoop response from the peer.
Definition: comm_monitor.hh:213
gem5::CommMonitor::getAddrRanges
AddrRangeList getAddrRanges() const
Definition: comm_monitor.cc:500
gem5::CommMonitor::MonitorStats::totalWrittenBytes
statistics::Scalar totalWrittenBytes
Definition: comm_monitor.hh:302
gem5::CommMonitor::MonitorStats::readBytes
unsigned int readBytes
Histogram for read bandwidth per sample window.
Definition: comm_monitor.hh:291
gem5::CommMonitor::samplePeriodic
void samplePeriodic()
This function is called periodically at the end of each time bin.
Definition: comm_monitor.cc:531
gem5::InvalidPortID
const PortID InvalidPortID
Definition: types.hh:246
gem5::CommMonitor::MonitorStats::readLatencyHist
statistics::Histogram readLatencyHist
Histogram of read request-to-response latencies.
Definition: comm_monitor.hh:309
gem5::CommMonitor::MonitorRequestPort::recvRangeChange
void recvRangeChange()
Called to receive an address range change from the peer response port.
Definition: comm_monitor.hh:152
gem5::CommMonitor::regProbePoints
void regProbePoints() override
Register probe points for this object.
Definition: comm_monitor.cc:74
gem5::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:92
gem5::RequestPort
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition: port.hh:118
gem5::CommMonitor::samplePeriodicEvent
EventFunctionWrapper samplePeriodicEvent
Periodic event called at the end of each simulation time bin.
Definition: comm_monitor.hh:399
gem5::CommMonitor::MonitorStats::writtenBytes
unsigned int writtenBytes
Histogram for write bandwidth per sample window.
Definition: comm_monitor.hh:300
gem5::statistics::Histogram
A simple histogram stat.
Definition: statistics.hh:2125
gem5::CommMonitor::MonitorStats::totalReadBytes
statistics::Scalar totalReadBytes
Definition: comm_monitor.hh:293
gem5::CommMonitor::MonitorStats::timeOfLastReq
Tick timeOfLastReq
Definition: comm_monitor.hh:328
gem5::CommMonitor::isSnooping
bool isSnooping() const
Definition: comm_monitor.cc:493
gem5::CommMonitor::ppPktReq
probing::PacketUPtr ppPktReq
Successfully forwarded request packet.
Definition: comm_monitor.hh:423
gem5::CommMonitor::recvTimingSnoopResp
bool recvTimingSnoopResp(PacketPtr pkt)
Definition: comm_monitor.cc:481
gem5::CommMonitor::recvTimingReq
bool recvTimingReq(PacketPtr pkt)
Definition: comm_monitor.cc:385
gem5::SimObject::params
const Params & params() const
Definition: sim_object.hh:176
sim_object.hh
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
gem5::CommMonitor::MonitorStats::readBurstLengthHist
statistics::Histogram readBurstLengthHist
Histogram of read burst lengths.
Definition: comm_monitor.hh:279
gem5::CommMonitor::ppPktResp
probing::PacketUPtr ppPktResp
Successfully forwarded response packet.
Definition: comm_monitor.hh:426
gem5::CommMonitor::recvRangeChange
void recvRangeChange()
Definition: comm_monitor.cc:525
statistics.hh
gem5::CommMonitor::MonitorStats::disableBandwidthHists
bool disableBandwidthHists
Disable flag for the bandwidth histograms.
Definition: comm_monitor.hh:285
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::CommMonitor::MonitorResponsePort
This is the CPU-side port of the communication monitor.
Definition: comm_monitor.hh:187
gem5::CommMonitor::MonitorStats::ittReqReq
statistics::Distribution ittReqReq
Definition: comm_monitor.hh:325
gem5::CommMonitor::startup
void startup() override
startup() is the final initialization call before simulation.
Definition: comm_monitor.cc:569
gem5::CommMonitor::MonitorStats::outstandingWritesHist
statistics::Histogram outstandingWritesHist
Histogram of outstanding write requests.
Definition: comm_monitor.hh:346
port.hh
gem5::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:81
gem5::CommMonitor::MonitorStats::ittWriteWrite
statistics::Distribution ittWriteWrite
Definition: comm_monitor.hh:324
gem5::SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:146
gem5::CommMonitor::recvFunctional
void recvFunctional(PacketPtr pkt)
Definition: comm_monitor.cc:93
gem5::Packet::SenderState
A virtual base opaque structure used to hold state associated with the packet (e.g....
Definition: packet.hh:468
gem5::probing::PacketUPtr
std::unique_ptr< Packet > PacketUPtr
Definition: mem.hh:109
gem5::CommMonitor::MonitorStats::ittReadRead
statistics::Distribution ittReadRead
Inter transaction time (ITT) distributions.
Definition: comm_monitor.hh:323
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::CommMonitor::MonitorRequestPort::recvTimingSnoopReq
void recvTimingSnoopReq(PacketPtr pkt)
Receive a timing snoop request from the peer.
Definition: comm_monitor.hh:147
gem5::CommMonitor::MonitorResponsePort::recvFunctional
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the peer.
Definition: comm_monitor.hh:198
gem5::CommMonitor::MonitorStats::disableTransactionHists
bool disableTransactionHists
Disable flag for transaction histograms.
Definition: comm_monitor.hh:350
gem5::CommMonitor::MonitorRequestPort::mon
CommMonitor & mon
Definition: comm_monitor.hh:174
gem5::EventFunctionWrapper
Definition: eventq.hh:1136
gem5::CommMonitor::MonitorStats::disableBurstLengthHists
bool disableBurstLengthHists
Disable flag for burst length histograms.
Definition: comm_monitor.hh:276
gem5::CommMonitor::tryTiming
bool tryTiming(PacketPtr pkt)
Definition: comm_monitor.cc:519
gem5::ResponsePort
A ResponsePort is a specialization of a port.
Definition: port.hh:331
gem5::CommMonitor::MonitorRequestPort::recvTimingResp
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Definition: comm_monitor.hh:142
gem5::CommMonitor::Params
CommMonitorParams Params
Parameters of communication monitor.
Definition: comm_monitor.hh:69
gem5::CommMonitor::MonitorStats::timeOfLastRead
Tick timeOfLastRead
Definition: comm_monitor.hh:326
gem5::Port
Ports are used to interface objects to each other.
Definition: port.hh:61
gem5::CommMonitor::MonitorRequestPort::MonitorRequestPort
MonitorRequestPort(const std::string &_name, CommMonitor &_mon)
Definition: comm_monitor.hh:126
gem5::CommMonitor::MonitorStats::updateRespStats
void updateRespStats(const probing::PacketInfo &pkt, Tick latency, bool is_atomic)
Definition: comm_monitor.cc:326
gem5::CommMonitor::MonitorRequestPort
This is the request port of the communication monitor.
Definition: comm_monitor.hh:121
gem5::CommMonitor::MonitorStats::timeOfLastWrite
Tick timeOfLastWrite
Definition: comm_monitor.hh:327
gem5::CommMonitor::MonitorStats::readTrans
unsigned int readTrans
Definition: comm_monitor.hh:354
gem5::CommMonitor::MonitorRequestPort::recvAtomicSnoop
Tick recvAtomicSnoop(PacketPtr pkt)
Receive an atomic snoop request packet from our peer.
Definition: comm_monitor.hh:137
gem5::statistics::SparseHistogram
Definition: statistics.hh:2494
gem5::statistics::Group
Statistics container.
Definition: group.hh:92
gem5::CommMonitor::recvReqRetry
void recvReqRetry()
Definition: comm_monitor.cc:507
gem5::CommMonitor::MonitorStats::disableOutstandingHists
bool disableOutstandingHists
Disable flag for outstanding histograms.
Definition: comm_monitor.hh:331
gem5::CommMonitor::MonitorStats::disableITTDists
bool disableITTDists
Disable flag for ITT distributions.
Definition: comm_monitor.hh:315
gem5::CommMonitor::CommMonitorSenderState::transmitTime
Tick transmitTime
Tick when request is transmitted.
Definition: comm_monitor.hh:111
gem5::CommMonitor::MonitorStats
Stats declarations, all in a struct for convenience.
Definition: comm_monitor.hh:273
gem5::CommMonitor::cpuSidePort
MonitorResponsePort cpuSidePort
Instance of response port, i.e.
Definition: comm_monitor.hh:240
gem5::CommMonitor::MonitorStats::averageWriteBandwidth
statistics::Formula averageWriteBandwidth
Definition: comm_monitor.hh:303
gem5::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:103
mem.hh
std::list< AddrRange >
gem5::CommMonitor::samplePeriod
const double samplePeriod
Sample period in seconds.
Definition: comm_monitor.hh:409
gem5::probing::PacketInfo
A struct to hold on to the essential fields from a packet, so that the packet and underlying request ...
Definition: mem.hh:57
gem5::CommMonitor::recvFunctionalSnoop
void recvFunctionalSnoop(PacketPtr pkt)
Definition: comm_monitor.cc:99
gem5::CommMonitor::MonitorStats::averageReadBandwidth
statistics::Formula averageReadBandwidth
Definition: comm_monitor.hh:294
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::CommMonitor::MonitorRequestPort::recvRetrySnoopResp
void recvRetrySnoopResp()
Called by the peer if sendTimingSnoopResp was called on this protocol (causing recvTimingSnoopResp to...
Definition: comm_monitor.hh:167
gem5::CommMonitor::MonitorStats::disableAddrDists
bool disableAddrDists
Disable flag for address distributions.
Definition: comm_monitor.hh:361
gem5::CommMonitor::MonitorStats::MonitorStats
MonitorStats(statistics::Group *parent, const CommMonitorParams &params)
Create the monitor stats and initialise all the members that are not statistics themselves,...
Definition: comm_monitor.cc:104
gem5::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:223
gem5::CommMonitor::recvRetrySnoopResp
void recvRetrySnoopResp()
Definition: comm_monitor.cc:487
gem5::CommMonitor::MonitorStats::writeBandwidthHist
statistics::Histogram writeBandwidthHist
Definition: comm_monitor.hh:301
gem5::Named::_name
const std::string _name
Definition: named.hh:41
gem5::CommMonitor::init
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: comm_monitor.cc:66
gem5::CommMonitor::samplePeriodTicks
const Tick samplePeriodTicks
Length of simulation time bin.
Definition: comm_monitor.hh:407
gem5::CommMonitor::MonitorStats::outstandingWriteReqs
unsigned int outstandingWriteReqs
Definition: comm_monitor.hh:347
gem5::CommMonitor::MonitorStats::writeLatencyHist
statistics::Histogram writeLatencyHist
Histogram of write request-to-response latencies.
Definition: comm_monitor.hh:312
gem5::CommMonitor::MonitorStats::writeTrans
unsigned int writeTrans
Definition: comm_monitor.hh:358
gem5::CommMonitor::MonitorResponsePort::MonitorResponsePort
MonitorResponsePort(const std::string &_name, CommMonitor &_mon)
Definition: comm_monitor.hh:192
gem5::CommMonitor::MonitorStats::updateReqStats
void updateReqStats(const probing::PacketInfo &pkt, bool is_atomic, bool expects_response)
Definition: comm_monitor.cc:259
gem5::CommMonitor::memSidePort
MonitorRequestPort memSidePort
Instance of request port, facing the memory side.
Definition: comm_monitor.hh:179

Generated on Sun Jul 30 2023 01:56:58 for gem5 by doxygen 1.8.17