Go to the documentation of this file.
43 #include "debug/CommMonitor.hh"
53 memSidePort(
name() +
"-mem_side_port", *this),
54 cpuSidePort(
name() +
"-cpu_side_port", *this),
56 samplePeriodTicks(params.sample_period),
61 "Created monitor %s with sample period %d ticks (%f ms)\n",
62 name(), samplePeriodTicks, samplePeriod * 1E3);
70 fatal(
"Communication monitor is not connected on both sides.\n");
83 if (if_name ==
"mem_side_port") {
85 }
else if (if_name ==
"cpu_side_port") {
105 const CommMonitorParams ¶ms)
106 : statistics::
Group(parent),
108 disableBurstLengthHists(params.disable_burst_length_hists),
109 ADD_STAT(readBurstLengthHist, statistics::units::Byte::get(),
110 "Histogram of burst lengths of transmitted packets"),
111 ADD_STAT(writeBurstLengthHist, statistics::units::Byte::get(),
112 "Histogram of burst lengths of transmitted packets"),
114 disableBandwidthHists(params.disable_bandwidth_hists),
116 ADD_STAT(readBandwidthHist, statistics::units::Rate<
117 statistics::units::Byte, statistics::units::Second>::get(),
118 "Histogram of read bandwidth per sample period"),
119 ADD_STAT(totalReadBytes, statistics::units::Byte::get(),
120 "Number of bytes read"),
121 ADD_STAT(averageReadBandwidth, statistics::units::Rate<
122 statistics::units::Byte, statistics::units::Second>::get(),
123 "Average read bandwidth",
127 ADD_STAT(writeBandwidthHist, statistics::units::Rate<
128 statistics::units::Byte, statistics::units::Second>::get(),
129 "Histogram of write bandwidth"),
130 ADD_STAT(totalWrittenBytes, statistics::units::Rate<
131 statistics::units::Byte, statistics::units::Second>::get(),
132 "Number of bytes written"),
133 ADD_STAT(averageWriteBandwidth, statistics::units::Rate<
134 statistics::units::Byte, statistics::units::Second>::get(),
135 "Average write bandwidth",
138 disableLatencyHists(params.disable_latency_hists),
139 ADD_STAT(readLatencyHist, statistics::units::
Tick::get(),
140 "Read request-response latency"),
141 ADD_STAT(writeLatencyHist, statistics::units::
Tick::get(),
142 "Write request-response latency"),
144 disableITTDists(params.disable_itt_dists),
146 "Read-to-read inter transaction time"),
148 "Write-to-write inter transaction time"),
150 "Request-to-request inter transaction time"),
151 timeOfLastRead(0), timeOfLastWrite(0), timeOfLastReq(0),
153 disableOutstandingHists(params.disable_outstanding_hists),
154 ADD_STAT(outstandingReadsHist, statistics::units::
Count::get(),
155 "Outstanding read transactions"),
156 outstandingReadReqs(0),
157 ADD_STAT(outstandingWritesHist, statistics::units::
Count::get(),
158 "Outstanding write transactions"),
159 outstandingWriteReqs(0),
161 disableTransactionHists(params.disable_transaction_hists),
163 "Histogram of read transactions per sample period"),
166 "Histogram of write transactions per sample period"),
169 disableAddrDists(params.disable_addr_dists),
170 readAddrMask(params.read_addr_mask),
171 writeAddrMask(params.write_addr_mask),
173 "Read address distribution"),
175 "Write address distribution")
177 using namespace statistics;
261 bool expects_response)
367 stats.updateReqStats(req_pkt_info,
true, expects_response);
368 if (expects_response)
369 stats.updateRespStats(req_pkt_info, delay,
true);
372 assert(pkt->
isResponse() || !expects_response);
401 if (expects_response && !
stats.disableLatencyHists) {
409 if (!successful && expects_response && !
stats.disableLatencyHists) {
419 pkt->
isWrite() ?
"write" :
"non read/write");
420 stats.updateReqStats(pkt_info,
false, expects_response);
439 if (!
stats.disableLatencyHists) {
441 if (received_state == NULL)
442 panic(
"Monitor got a response without monitor sender state\n");
451 if (!
stats.disableLatencyHists) {
457 delete received_state;
468 pkt->
isWrite() ?
"write" :
"non read/write");
469 stats.updateRespStats(pkt_info, latency,
false);
542 if (!
stats.disableTransactionHists) {
544 stats.writeTransHist.sample(
stats.writeTrans);
547 if (!
stats.disableBandwidthHists) {
552 if (!
stats.disableOutstandingHists) {
553 stats.outstandingReadsHist.sample(
stats.outstandingReadReqs);
554 stats.outstandingWritesHist.sample(
stats.outstandingWriteReqs);
560 stats.writeTrans = 0;
563 stats.writtenBytes = 0;
The communication monitor is a SimObject which can monitor statistics of the communication happening ...
statistics::Histogram outstandingReadsHist
Histogram of outstanding read requests.
Tick curTick()
The universal simulation clock.
#define fatal(...)
This implements a cprintf based fatal() function.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
bool tryTiming(PacketPtr pkt) const
Check if the responder can handle a timing request.
statistics::Histogram readTransHist
Histogram of number of read transactions per time bin.
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
bool sendTimingReq(PacketPtr pkt)
Attempt to send a timing request to the responder port by calling its corresponding receive function.
bool recvTimingResp(PacketPtr pkt)
Tick recvAtomic(PacketPtr pkt)
CommMonitor(const Params ¶ms)
Constructor based on the Python params.
unsigned int outstandingReadReqs
void sendFunctionalSnoop(PacketPtr pkt) const
Send a functional snoop request packet, where the data is instantly updated everywhere in the memory ...
void sendRetryReq()
Send a retry to the request port that previously attempted a sendTimingReq to this response port and ...
statistics::Histogram writeBurstLengthHist
Histogram of write burst lengths.
void recvTimingSnoopReq(PacketPtr pkt)
statistics::Histogram writeTransHist
Histogram of number of timing write transactions per time bin.
void sendRetrySnoopResp()
Send a retry to the request port that previously attempted a sendTimingSnoopResp to this response por...
void pushSenderState(SenderState *sender_state)
Push a new sender state to the packet and make the current sender state the predecessor of the new on...
statistics::Histogram readBandwidthHist
bool disableLatencyHists
Disable flag for latency histograms.
Tick recvAtomicSnoop(PacketPtr pkt)
Tick sendAtomic(PacketPtr pkt)
Send an atomic request packet, where the data is moved and the state is updated in zero time,...
const FlagsType nozero
Don't print if this is zero.
bool cacheResponding() const
const Addr readAddrMask
Address mask for sources of read accesses to be captured.
statistics::SparseHistogram readAddrDist
Histogram of number of read accesses to addresses over time.
const Addr writeAddrMask
Address mask for sources of write accesses to be captured.
statistics::SparseHistogram writeAddrDist
Histogram of number of write accesses to addresses over time.
void schedule(Event &event, Tick when)
AddrRangeList getAddrRanges() const
statistics::Scalar totalWrittenBytes
unsigned int readBytes
Histogram for read bandwidth per sample window.
void samplePeriodic()
This function is called periodically at the end of each time bin.
statistics::Histogram readLatencyHist
Histogram of read request-to-response latencies.
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
SenderState * predecessor
void regProbePoints() override
Register probe points for this object.
Sender state class for the monitor so that we can annotate packets with a transmit time and receive t...
EventFunctionWrapper samplePeriodicEvent
Periodic event called at the end of each simulation time bin.
const FlagsType pdf
Print the percent of the total that this entry represents.
unsigned int writtenBytes
Histogram for write bandwidth per sample window.
statistics::Scalar totalReadBytes
void sendFunctional(PacketPtr pkt) const
Send a functional request packet, where the data is instantly updated everywhere in the memory system...
SparseHistogram & init(size_type size)
Set the parameters of this histogram.
Distribution & init(Counter min, Counter max, Counter bkt)
Set the parameters of this distribution.
probing::PacketUPtr ppPktReq
Successfully forwarded request packet.
bool recvTimingSnoopResp(PacketPtr pkt)
bool recvTimingReq(PacketPtr pkt)
const Params & params() const
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
statistics::Histogram readBurstLengthHist
Histogram of read burst lengths.
probing::PacketUPtr ppPktResp
Successfully forwarded response packet.
bool disableBandwidthHists
Disable flag for the bandwidth histograms.
uint64_t Tick
Tick count type.
bool isSnooping() const
Find out if the peer request port is snooping or not.
virtual void sendRetryResp()
Send a retry to the response port that previously attempted a sendTimingResp to this request port and...
statistics::Distribution ittReqReq
void startup() override
startup() is the final initialization call before simulation.
statistics::Histogram outstandingWritesHist
Histogram of outstanding write requests.
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
bool sendTimingResp(PacketPtr pkt)
Attempt to send a timing response to the request port by calling its corresponding receive function.
statistics::Distribution ittWriteWrite
void sendTimingSnoopReq(PacketPtr pkt)
Attempt to send a timing snoop request packet to the request port by calling its corresponding receiv...
bool isConnected() const
Is this port currently connected to a peer?
AddrRangeList getAddrRanges() const
Get the address ranges of the connected responder port.
Abstract superclass for simulation objects.
void recvFunctional(PacketPtr pkt)
statistics::Distribution ittReadRead
Inter transaction time (ITT) distributions.
bool needsResponse() const
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
Histogram & init(size_type size)
Set the parameters of this histogram.
SenderState * senderState
This packet's sender state.
const std::string & name()
bool disableTransactionHists
Disable flag for transaction histograms.
void sendRangeChange() const
Called by the owner to send a range change.
SenderState * popSenderState()
Pop the top of the state stack and return a pointer to it.
ProbePointArg generates a point for the class of Arg.
bool disableBurstLengthHists
Disable flag for burst length histograms.
ProbeManager * getProbeManager()
Get the probe manager for this object.
bool tryTiming(PacketPtr pkt)
CommMonitorParams Params
Parameters of communication monitor.
Ports are used to interface objects to each other.
void updateRespStats(const probing::PacketInfo &pkt, Tick latency, bool is_atomic)
statistics::Formula & simSeconds
bool disableOutstandingHists
Disable flag for outstanding histograms.
std::vector< Info * > stats
bool disableITTDists
Disable flag for ITT distributions.
Tick transmitTime
Tick when request is transmitted.
MonitorResponsePort cpuSidePort
Instance of response port, i.e.
statistics::Formula averageWriteBandwidth
Tick sendAtomicSnoop(PacketPtr pkt)
Send an atomic snoop request packet, where the data is moved and the state is updated in zero time,...
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
const double samplePeriod
Sample period in seconds.
A struct to hold on to the essential fields from a packet, so that the packet and underlying request ...
void recvFunctionalSnoop(PacketPtr pkt)
statistics::Formula averageReadBandwidth
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
bool disableAddrDists
Disable flag for address distributions.
MonitorStats(statistics::Group *parent, const CommMonitorParams ¶ms)
Create the monitor stats and initialise all the members that are not statistics themselves,...
bool sendTimingSnoopResp(PacketPtr pkt)
Attempt to send a timing snoop response packet to the response port by calling its corresponding rece...
void recvRetrySnoopResp()
statistics::Histogram writeBandwidthHist
statistics::Value & simTicks
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.
unsigned int outstandingWriteReqs
statistics::Histogram writeLatencyHist
Histogram of write request-to-response latencies.
#define panic(...)
This implements a cprintf based panic() function.
double s
These variables equal the number of ticks in the unit of time they're named after in a double.
void updateReqStats(const probing::PacketInfo &pkt, bool is_atomic, bool expects_response)
MonitorRequestPort memSidePort
Instance of request port, facing the memory side.
Generated on Sun Jul 30 2023 01:56:58 for gem5 by doxygen 1.8.17