gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
49namespace gem5
50{
51
63class CommMonitor : public SimObject
64{
65
66 public: // Construction & SimObject interfaces
67
69 using Params = CommMonitorParams;
70
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 {
150 }
151
153 {
155 }
156
157 bool isSnooping() const
158 {
159 return mon.isSnooping();
160 }
161
163 {
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 {
226 }
227
229 {
230 return mon.tryTiming(pkt);
231 }
232
233 private:
234
236
237 };
238
241
242 void recvFunctional(PacketPtr pkt);
243
245
247
249
250 bool recvTimingReq(PacketPtr pkt);
251
252 bool recvTimingResp(PacketPtr pkt);
253
255
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
340
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__
Sender state class for the monitor so that we can annotate packets with a transmit time and receive t...
Tick transmitTime
Tick when request is transmitted.
CommMonitorSenderState(Tick _transmitTime)
Construct a new sender state and store the time so we can calculate round-trip latency.
This is the request port of the communication monitor.
void recvRangeChange()
Called to receive an address range change from the peer response port.
bool isSnooping() const
Determine if this request port is snooping or not.
void recvReqRetry()
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
void recvTimingSnoopReq(PacketPtr pkt)
Receive a timing snoop request from the peer.
MonitorRequestPort(const std::string &_name, CommMonitor &_mon)
void recvRetrySnoopResp()
Called by the peer if sendTimingSnoopResp was called on this protocol (causing recvTimingSnoopResp to...
void recvFunctionalSnoop(PacketPtr pkt)
Receive a functional snoop request packet from the peer.
Tick recvAtomicSnoop(PacketPtr pkt)
Receive an atomic snoop request packet from our peer.
This is the CPU-side port of the communication monitor.
MonitorResponsePort(const std::string &_name, CommMonitor &_mon)
bool recvTimingReq(PacketPtr pkt)
Receive a timing request from the peer.
void recvRespRetry()
Called by the peer if sendTimingResp was called on this protocol (causing recvTimingResp to be called...
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the peer.
bool recvTimingSnoopResp(PacketPtr pkt)
Receive a timing snoop response from the peer.
bool tryTiming(PacketPtr pkt)
Availability request from the peer.
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the peer.
AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
The communication monitor is a SimObject which can monitor statistics of the communication happening ...
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
const Tick samplePeriodTicks
Length of simulation time bin.
probing::PacketUPtr ppPktReq
Successfully forwarded request packet.
void recvTimingSnoopReq(PacketPtr pkt)
EventFunctionWrapper samplePeriodicEvent
Periodic event called at the end of each simulation time bin.
void recvFunctionalSnoop(PacketPtr pkt)
void recvFunctional(PacketPtr pkt)
CommMonitorParams Params
Parameters of communication monitor.
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Tick recvAtomic(PacketPtr pkt)
void startup() override
startup() is the final initialization call before simulation.
bool recvTimingSnoopResp(PacketPtr pkt)
MonitorResponsePort cpuSidePort
Instance of response port, i.e.
Tick recvAtomicSnoop(PacketPtr pkt)
void regProbePoints() override
Register probe points for this object.
MonitorStats stats
Instantiate stats.
const double samplePeriod
Sample period in seconds.
bool tryTiming(PacketPtr pkt)
bool recvTimingReq(PacketPtr pkt)
bool isSnooping() const
AddrRangeList getAddrRanges() const
probing::PacketUPtr ppPktResp
Successfully forwarded response packet.
void samplePeriodic()
This function is called periodically at the end of each time bin.
CommMonitor(const Params &params)
Constructor based on the Python params.
bool recvTimingResp(PacketPtr pkt)
MonitorRequestPort memSidePort
Instance of request port, facing the memory side.
const std::string _name
Definition named.hh:41
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
Ports are used to interface objects to each other.
Definition port.hh:62
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition port.hh:136
A ResponsePort is a specialization of a port.
Definition port.hh:349
Abstract superclass for simulation objects.
A simple distribution stat.
A formula for statistics that is calculated when printed.
Statistics container.
Definition group.hh:93
A simple histogram stat.
This is a simple scalar statistic, like a counter.
const Params & params() const
Port Object Declaration.
std::unique_ptr< Packet > PacketUPtr
Definition mem.hh:109
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
const PortID InvalidPortID
Definition types.hh:246
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition types.hh:245
uint64_t Tick
Tick count type.
Definition types.hh:58
Declaration of Statistics objects.
Stats declarations, all in a struct for convenience.
statistics::SparseHistogram writeAddrDist
Histogram of number of write accesses to addresses over time.
statistics::Distribution ittReqReq
const Addr readAddrMask
Address mask for sources of read accesses to be captured.
statistics::Histogram writeBandwidthHist
void updateRespStats(const probing::PacketInfo &pkt, Tick latency, bool is_atomic)
unsigned int writtenBytes
Histogram for write bandwidth per sample window.
statistics::Scalar totalWrittenBytes
bool disableBurstLengthHists
Disable flag for burst length histograms.
const Addr writeAddrMask
Address mask for sources of write accesses to be captured.
bool disableAddrDists
Disable flag for address distributions.
statistics::Histogram writeLatencyHist
Histogram of write request-to-response latencies.
statistics::Histogram outstandingWritesHist
Histogram of outstanding write requests.
statistics::Histogram writeBurstLengthHist
Histogram of write burst lengths.
bool disableTransactionHists
Disable flag for transaction histograms.
statistics::Histogram readLatencyHist
Histogram of read request-to-response latencies.
statistics::Histogram readTransHist
Histogram of number of read transactions per time bin.
bool disableLatencyHists
Disable flag for latency histograms.
bool disableBandwidthHists
Disable flag for the bandwidth histograms.
statistics::SparseHistogram readAddrDist
Histogram of number of read accesses to addresses over time.
statistics::Formula averageWriteBandwidth
statistics::Scalar totalReadBytes
unsigned int readBytes
Histogram for read bandwidth per sample window.
statistics::Histogram readBurstLengthHist
Histogram of read burst lengths.
bool disableITTDists
Disable flag for ITT distributions.
statistics::Histogram writeTransHist
Histogram of number of timing write transactions per time bin.
MonitorStats(statistics::Group *parent, const CommMonitorParams &params)
Create the monitor stats and initialise all the members that are not statistics themselves,...
statistics::Histogram outstandingReadsHist
Histogram of outstanding read requests.
statistics::Distribution ittWriteWrite
void updateReqStats(const probing::PacketInfo &pkt, bool is_atomic, bool expects_response)
statistics::Histogram readBandwidthHist
statistics::Formula averageReadBandwidth
bool disableOutstandingHists
Disable flag for outstanding histograms.
statistics::Distribution ittReadRead
Inter transaction time (ITT) distributions.
A virtual base opaque structure used to hold state associated with the packet (e.g....
Definition packet.hh:469
A struct to hold on to the essential fields from a packet, so that the packet and underlying request ...
Definition mem.hh:58

Generated on Tue Jun 18 2024 16:24:05 for gem5 by doxygen 1.11.0