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);
61 CommMonitorParams::create()
71 fatal(
"Communication monitor is not connected on both sides.\n");
84 if (if_name ==
"mem_side_port") {
86 }
else if (if_name ==
"cpu_side_port") {
106 const CommMonitorParams *params)
107 :
Stats::Group(parent),
109 disableBurstLengthHists(params->disable_burst_length_hists),
111 "Histogram of burst lengths of transmitted packets"),
113 "Histogram of burst lengths of transmitted packets"),
115 disableBandwidthHists(params->disable_bandwidth_hists),
118 "Histogram of read bandwidth per sample period (bytes/s)"),
119 ADD_STAT(totalReadBytes,
"Number of bytes read"),
120 ADD_STAT(averageReadBandwidth,
"Average read bandwidth (bytes/s)",
124 ADD_STAT(writeBandwidthHist,
"Histogram of write bandwidth (bytes/s)"),
125 ADD_STAT(totalWrittenBytes,
"Number of bytes written"),
126 ADD_STAT(averageWriteBandwidth,
"Average write bandwidth (bytes/s)",
129 disableLatencyHists(params->disable_latency_hists),
130 ADD_STAT(readLatencyHist,
"Read request-response latency"),
131 ADD_STAT(writeLatencyHist,
"Write request-response latency"),
133 disableITTDists(params->disable_itt_dists),
134 ADD_STAT(ittReadRead,
"Read-to-read inter transaction time"),
135 ADD_STAT(ittWriteWrite ,
"Write-to-write inter transaction time"),
136 ADD_STAT(ittReqReq,
"Request-to-request inter transaction time"),
137 timeOfLastRead(0), timeOfLastWrite(0), timeOfLastReq(0),
139 disableOutstandingHists(params->disable_outstanding_hists),
140 ADD_STAT(outstandingReadsHist,
"Outstanding read transactions"),
141 outstandingReadReqs(0),
142 ADD_STAT(outstandingWritesHist,
"Outstanding write transactions"),
143 outstandingWriteReqs(0),
145 disableTransactionHists(params->disable_transaction_hists),
147 "Histogram of read transactions per sample period"),
150 "Histogram of write transactions per sample period"),
153 disableAddrDists(params->disable_addr_dists),
154 readAddrMask(params->read_addr_mask),
155 writeAddrMask(params->write_addr_mask),
156 ADD_STAT(readAddrDist,
"Read address distribution"),
157 ADD_STAT(writeAddrDist,
"Write address distribution")
159 using namespace Stats;
243 bool expects_response)
349 stats.updateReqStats(req_pkt_info,
true, expects_response);
350 if (expects_response)
351 stats.updateRespStats(req_pkt_info, delay,
true);
354 assert(pkt->
isResponse() || !expects_response);
383 if (expects_response && !
stats.disableLatencyHists) {
391 if (!successful && expects_response && !
stats.disableLatencyHists) {
401 pkt->
isWrite() ?
"write" :
"non read/write");
402 stats.updateReqStats(pkt_info,
false, expects_response);
421 if (!
stats.disableLatencyHists) {
423 if (received_state == NULL)
424 panic(
"Monitor got a response without monitor sender state\n");
433 if (!
stats.disableLatencyHists) {
439 delete received_state;
450 pkt->
isWrite() ?
"write" :
"non read/write");
451 stats.updateRespStats(pkt_info, latency,
false);
524 if (!
stats.disableTransactionHists) {
526 stats.writeTransHist.sample(
stats.writeTrans);
529 if (!
stats.disableBandwidthHists) {
534 if (!
stats.disableOutstandingHists) {
535 stats.outstandingReadsHist.sample(
stats.outstandingReadReqs);
536 stats.outstandingWritesHist.sample(
stats.outstandingWriteReqs);
542 stats.writeTrans = 0;
545 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.
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.
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.
const Params * params() const
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.
CommMonitor(Params *params)
Constructor based on the Python params.
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...
CommMonitorParams Params
Parameters of communication monitor.
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::Formula simSeconds
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
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.
MonitorStats(Stats::Group *parent, const CommMonitorParams *params)
Create the monitor stats and initialise all the members that are not statistics themselves,...
bool tryTiming(PacketPtr pkt)
Sender state class for the monitor so that we can annotate packets with a transmit time and receive t...
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.
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)
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.
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.
Tick curTick()
The current simulated tick.
Abstract superclass for simulation objects.
Generated on Wed Sep 30 2020 14:02:13 for gem5 by doxygen 1.8.17