Go to the documentation of this file.
43 #include "debug/CommMonitor.hh"
48 memSidePort(
name() +
"-mem_side_port", *this),
49 cpuSidePort(
name() +
"-cpu_side_port", *this),
51 samplePeriodTicks(params.sample_period),
56 "Created monitor %s with sample period %d ticks (%f ms)\n",
57 name(), samplePeriodTicks, samplePeriod * 1E3);
65 fatal(
"Communication monitor is not connected on both sides.\n");
78 if (if_name ==
"mem_side_port") {
80 }
else if (if_name ==
"cpu_side_port") {
100 const CommMonitorParams ¶ms)
101 :
Stats::Group(parent),
103 disableBurstLengthHists(params.disable_burst_length_hists),
105 "Histogram of burst lengths of transmitted packets"),
107 "Histogram of burst lengths of transmitted packets"),
109 disableBandwidthHists(params.disable_bandwidth_hists),
113 "Histogram of read bandwidth per sample period"),
117 "Average read bandwidth",
123 "Histogram of write bandwidth"),
126 "Number of bytes written"),
129 "Average write bandwidth",
132 disableLatencyHists(params.disable_latency_hists),
136 disableITTDists(params.disable_itt_dists),
139 "Write-to-write inter transaction time"),
141 "Request-to-request inter transaction time"),
142 timeOfLastRead(0), timeOfLastWrite(0), timeOfLastReq(0),
144 disableOutstandingHists(params.disable_outstanding_hists),
146 "Outstanding read transactions"),
147 outstandingReadReqs(0),
149 "Outstanding write transactions"),
150 outstandingWriteReqs(0),
152 disableTransactionHists(params.disable_transaction_hists),
154 "Histogram of read transactions per sample period"),
157 "Histogram of write transactions per sample period"),
160 disableAddrDists(params.disable_addr_dists),
161 readAddrMask(params.read_addr_mask),
162 writeAddrMask(params.write_addr_mask),
166 using namespace Stats;
250 bool expects_response)
356 stats.updateReqStats(req_pkt_info,
true, expects_response);
357 if (expects_response)
358 stats.updateRespStats(req_pkt_info, delay,
true);
361 assert(pkt->
isResponse() || !expects_response);
390 if (expects_response && !
stats.disableLatencyHists) {
398 if (!successful && expects_response && !
stats.disableLatencyHists) {
408 pkt->
isWrite() ?
"write" :
"non read/write");
409 stats.updateReqStats(pkt_info,
false, expects_response);
428 if (!
stats.disableLatencyHists) {
430 if (received_state == NULL)
431 panic(
"Monitor got a response without monitor sender state\n");
440 if (!
stats.disableLatencyHists) {
446 delete received_state;
457 pkt->
isWrite() ?
"write" :
"non read/write");
458 stats.updateRespStats(pkt_info, latency,
false);
531 if (!
stats.disableTransactionHists) {
533 stats.writeTransHist.sample(
stats.writeTrans);
536 if (!
stats.disableBandwidthHists) {
541 if (!
stats.disableOutstandingHists) {
542 stats.outstandingReadsHist.sample(
stats.outstandingReadReqs);
543 stats.outstandingWritesHist.sample(
stats.outstandingWriteReqs);
549 stats.writeTrans = 0;
552 stats.writtenBytes = 0;
Stats::SparseHistogram writeAddrDist
Histogram of number of write accesses to addresses over time.
#define fatal(...)
This implements a cprintf based fatal() function.
MonitorStats(Stats::Group *parent, const CommMonitorParams ¶ms)
Create the monitor stats and initialise all the members that are not statistics themselves,...
void samplePeriodic()
This function is called periodically at the end of each time bin.
void updateReqStats(const ProbePoints::PacketInfo &pkt, bool is_atomic, bool expects_response)
double s
These variables equal the number of ticks in the unit of time they're named after in a double.
CommMonitorParams Params
Parameters of communication monitor.
bool disableBurstLengthHists
Disable flag for burst length histograms.
void startup() override
startup() is the final initialization call before simulation.
bool cacheResponding() const
The communication monitor is a SimObject which can monitor statistics of the communication happening ...
Tick recvAtomic(PacketPtr pkt)
Stats::Histogram writeBurstLengthHist
Histogram of write burst lengths.
bool sendTimingResp(PacketPtr pkt)
Attempt to send a timing response to the request port by calling its corresponding receive function.
bool recvTimingSnoopResp(PacketPtr pkt)
MonitorRequestPort memSidePort
Instance of request port, facing the memory side.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Tick transmitTime
Tick when request is transmitted.
bool recvTimingReq(PacketPtr pkt)
unsigned int readBytes
Histogram for read bandwidth per sample window.
void recvFunctionalSnoop(PacketPtr pkt)
unsigned int outstandingWriteReqs
bool disableTransactionHists
Disable flag for transaction histograms.
ProbePointArg generates a point for the class of Arg.
unsigned int writtenBytes
Histogram for write bandwidth per sample window.
uint64_t Tick
Tick count type.
EventFunctionWrapper samplePeriodicEvent
Periodic event called at the end of each simulation time bin.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Stats::Histogram writeBandwidthHist
Tick sendAtomicSnoop(PacketPtr pkt)
Send an atomic snoop request packet, where the data is moved and the state is updated in zero time,...
AddrRangeList getAddrRanges() const
Get the address ranges of the connected responder port.
void recvRetrySnoopResp()
Stats::Histogram outstandingWritesHist
Histogram of outstanding write requests.
Stats::Distribution ittWriteWrite
void sendFunctional(PacketPtr pkt) const
Send a functional request packet, where the data is instantly updated everywhere in the memory system...
Stats::Histogram writeLatencyHist
Histogram of write request-to-response latencies.
MonitorResponsePort cpuSidePort
Instance of response port, i.e.
bool disableBandwidthHists
Disable flag for the bandwidth histograms.
void recvFunctional(PacketPtr pkt)
bool disableLatencyHists
Disable flag for latency histograms.
bool sendTimingSnoopResp(PacketPtr pkt)
Attempt to send a timing snoop response packet to the response port by calling its corresponding rece...
Stats::Histogram readTransHist
Histogram of number of read transactions per time bin.
Stats::Histogram readBandwidthHist
bool disableITTDists
Disable flag for ITT distributions.
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
void regProbePoints() override
Register probe points for this object.
bool disableAddrDists
Disable flag for address distributions.
Stats::Formula averageWriteBandwidth
void sendTimingSnoopReq(PacketPtr pkt)
Attempt to send a timing snoop request packet to the request port by calling its corresponding receiv...
bool recvTimingResp(PacketPtr pkt)
void schedule(Event &event, Tick when)
bool sendTimingReq(PacketPtr pkt)
Attempt to send a timing request to the responder port by calling its corresponding receive function.
const Addr readAddrMask
Address mask for sources of read accesses to be captured.
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
Stats::Histogram outstandingReadsHist
Histogram of outstanding read requests.
bool disableOutstandingHists
Disable flag for outstanding histograms.
Stats::Histogram writeTransHist
Histogram of number of timing write transactions per time bin.
Ports are used to interface objects to each other.
bool needsResponse() const
CommMonitor(const Params ¶ms)
Constructor based on the Python params.
std::vector< Info * > stats
virtual void sendRetryResp()
Send a retry to the response port that previously attempted a sendTimingResp to this request port and...
Stats::Histogram readBurstLengthHist
Histogram of read burst lengths.
bool isSnooping() const
Find out if the peer request port is snooping or not.
ProbePoints::PacketUPtr ppPktReq
Successfully forwarded request packet.
Stats::Scalar totalReadBytes
Stats::SparseHistogram readAddrDist
Histogram of number of read accesses to addresses over time.
bool tryTiming(PacketPtr pkt)
Sender state class for the monitor so that we can annotate packets with a transmit time and receive t...
Stats::Formula & simSeconds
const std::string & name()
const FlagsType nozero
Don't print if this is zero.
ProbeManager * getProbeManager()
Get the probe manager for this object.
ProbePoints::PacketUPtr ppPktResp
Successfully forwarded response packet.
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
#define UNIT_RATE(T1, T2)
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...
const double samplePeriod
Sample period in seconds.
Distribution & init(Counter min, Counter max, Counter bkt)
Set the parameters of this distribution.
const FlagsType pdf
Print the percent of the total that this entry represents.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
SenderState * popSenderState()
Pop the top of the state stack and return a pointer to it.
void sendFunctionalSnoop(PacketPtr pkt) const
Send a functional snoop request packet, where the data is instantly updated everywhere in the memory ...
bool isConnected() const
Is this port currently connected to a peer?
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
void sendRetrySnoopResp()
Send a retry to the request port that previously attempted a sendTimingSnoopResp to this response por...
Stats::Distribution ittReqReq
Stats::Scalar totalWrittenBytes
const Addr writeAddrMask
Address mask for sources of write accesses to be captured.
Tick recvAtomicSnoop(PacketPtr pkt)
Tick curTick()
The universal simulation clock.
SparseHistogram & init(size_type size)
Set the parameters of this histogram.
Stats::Histogram readLatencyHist
Histogram of read request-to-response latencies.
void sendRetryReq()
Send a retry to the request port that previously attempted a sendTimingReq to this response port and ...
Histogram & init(size_type size)
Set the parameters of this histogram.
const Params & params() const
SenderState * senderState
This packet's sender state.
Tick sendAtomic(PacketPtr pkt)
Send an atomic request packet, where the data is moved and the state is updated in zero time,...
void recvTimingSnoopReq(PacketPtr pkt)
void updateRespStats(const ProbePoints::PacketInfo &pkt, Tick latency, bool is_atomic)
Stats::Distribution ittReadRead
Inter transaction time (ITT) distributions.
SenderState * predecessor
void sendRangeChange() const
Called by the owner to send a range change.
AddrRangeList getAddrRanges() const
A struct to hold on to the essential fields from a packet, so that the packet and underlying request ...
const Tick samplePeriodTicks
Length of simulation time bin.
Stats::Formula averageReadBandwidth
unsigned int outstandingReadReqs
bool tryTiming(PacketPtr pkt) const
Check if the responder can handle a timing request.
#define panic(...)
This implements a cprintf based panic() function.
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Abstract superclass for simulation objects.
Generated on Tue Jun 22 2021 15:28:29 for gem5 by doxygen 1.8.17