48 #include "debug/CommMonitor.hh"
53 masterPort(
name() +
"-master", *this),
54 slavePort(
name() +
"-slave", *this),
55 samplePeriodicEvent(this),
56 samplePeriodTicks(params->sample_period),
57 samplePeriod(params->sample_period / SimClock::Float::
s),
61 "Created monitor %s with sample period %d ticks (%f ms)\n",
66 CommMonitorParams::create()
76 fatal(
"Communication monitor is not connected on both sides.\n");
89 if (if_name ==
"master") {
99 if (if_name ==
"slave") {
121 bool expects_response)
191 if (!is_atomic && !disableOutstandingHists) {
192 assert(outstandingReadReqs != 0);
193 --outstandingReadReqs;
196 if (!disableLatencyHists)
197 readLatencyHist.sample(latency);
200 if (!disableBandwidthHists) {
201 readBytes += pkt_info.
size;
202 totalReadBytes += pkt_info.
size;
207 if (!is_atomic && !disableOutstandingHists) {
208 assert(outstandingWriteReqs != 0);
209 --outstandingWriteReqs;
212 if (!disableLatencyHists)
213 writeLatencyHist.sample(latency);
228 if (expects_response)
278 pkt->
isWrite() ?
"write" :
"non read/write");
300 if (received_state == NULL)
301 panic(
"Monitor got a response without monitor sender state\n");
316 delete received_state;
327 pkt->
isWrite() ?
"write" :
"non read/write");
389 using namespace Stats;
393 .
name(
name() +
".readBurstLengthHist")
394 .
desc(
"Histogram of burst lengths of transmitted packets")
399 .
name(
name() +
".writeBurstLengthHist")
400 .
desc(
"Histogram of burst lengths of transmitted packets")
406 .
name(
name() +
".readBandwidthHist")
407 .
desc(
"Histogram of read bandwidth per sample period (bytes/s)")
411 .
name(
name() +
".averageReadBandwidth")
412 .
desc(
"Average read bandwidth (bytes/s)")
417 .
desc(
"Number of bytes read")
425 .
name(
name() +
".writeBandwidthHist")
426 .
desc(
"Histogram of write bandwidth (bytes/s)")
430 .
name(
name() +
".averageWriteBandwidth")
431 .
desc(
"Average write bandwidth (bytes/s)")
435 .
name(
name() +
".totalWrittenBytes")
436 .
desc(
"Number of bytes written")
444 .
desc(
"Read request-response latency")
450 .
desc(
"Write request-response latency")
457 .
desc(
"Read-to-read inter transaction time")
464 .
desc(
"Write-to-write inter transaction time")
471 .
desc(
"Request-to-request inter transaction time")
476 .
name(
name() +
".outstandingReadsHist")
477 .
desc(
"Outstanding read transactions")
482 .
name(
name() +
".outstandingWritesHist")
483 .
desc(
"Outstanding write transactions")
489 .
desc(
"Histogram of read transactions per sample period")
495 .
desc(
"Histogram of write transactions per sample period")
501 .
desc(
"Read address distribution")
507 .
desc(
"Write address distribution")
Stats::Formula averageReadBW
unsigned int writtenBytes
Histogram for write bandwidth per sample window.
void startup() override
startup() is the final initialization call before simulation.
BaseSlavePort & getSlavePort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a slave port with a given name and index.
const FlagsType pdf
Print the percent of the total that this entry represents.
Tick recvAtomic(PacketPtr pkt)
bool disableBurstLengthHists
Disable flag for burst length histograms.
const std::string & name()
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 readBytes
Histogram for read bandwidth per sample window.
Sender state class for the monitor so that we can annotate packets with a transmit time and receive t...
bool sendTimingSnoopResp(PacketPtr pkt)
Attempt to send a timing snoop response packet to the slave port by calling its corresponding receive...
void updateRespStats(const ProbePoints::PacketInfo &pkt, Tick latency, bool is_atomic)
Tick sendAtomicSnoop(PacketPtr pkt)
Send an atomic snoop request packet, where the data is moved and the state is updated in zero time...
void regStats() override
Register statistics for this object.
void sendFunctionalSnoop(PacketPtr pkt)
Send a functional snoop request packet, where the data is instantly updated everywhere in the memory ...
bool recvTimingReq(PacketPtr pkt)
Histogram & init(size_type size)
Set the parameters of this histogram.
bool sendTimingReq(PacketPtr pkt)
Attempt to send a timing request to the slave port by calling its corresponding receive function...
virtual BaseSlavePort & getSlavePort(const std::string &if_name, PortID idx=InvalidPortID)
Get a slave port with a given name and index.
virtual void sendRetryResp()
Send a retry to the slave port that previously attempted a sendTimingResp to this master port and fai...
CommMonitor(Params *params)
Constructor based on the Python params.
unsigned int outstandingWriteReqs
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 sendRetrySnoopResp()
Send a retry to the master port that previously attempted a sendTimingSnoopResp to this slave port an...
A BaseSlavePort is a protocol-agnostic slave port, responsible only for the structural connection to ...
Stats::Formula simSeconds
void recvFunctionalSnoop(PacketPtr pkt)
AddrRangeList getAddrRanges() const
Stats::Histogram readTransHist
Histogram of number of read transactions per time bin.
bool isSnooping() const
Find out if the peer master port is snooping or not.
Stats::Histogram writeBurstLengthHist
Histogram of write burst lengths.
void recvRetrySnoopResp()
Stats::Scalar totalReadBytes
ProbePoints::PacketUPtr ppPktReq
Successfully forwarded request packet.
Stats::Histogram outstandingWritesHist
Histogram of outstanding write requests.
bool sendTimingResp(PacketPtr pkt)
Attempt to send a timing response to the master port by calling its corresponding receive function...
Stats::Formula averageWriteBW
const Addr writeAddrMask
Address mask for sources of write accesses to be captured.
Tick curTick()
The current simulated tick.
CommMonitorParams Params
Parameters of communication monitor.
SenderState * predecessor
bool recvTimingResp(PacketPtr pkt)
Stats::Histogram writeLatencyHist
Histogram of write request-to-response latencies.
bool disableLatencyHists
Disable flag for latency histograms.
bool disableAddrDists
Disable flag for address distributions.
void recvFunctional(PacketPtr pkt)
uint64_t Tick
Tick count type.
Stats::Histogram writeTransHist
Histogram of number of timing write transactions per time bin.
void regProbePoints() override
Register probe points for this object.
bool needsResponse() const
Tick transmitTime
Tick when request is transmitted.
Distribution & init(Counter min, Counter max, Counter bkt)
Set the parameters of this distribution.
MonitorSlavePort slavePort
Instance of slave port, i.e.
The communication monitor is a MemObject which can monitor statistics of the communication happening ...
Stats::Distribution ittWriteWrite
bool cacheResponding() const
bool disableTransactionHists
Disable flag for transaction histograms.
bool disableOutstandingHists
Disable flag for outstanding histograms.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Stats::Distribution ittReadRead
Inter transaction time (ITT) distributions.
void sendRangeChange() const
Called by the owner to send a range change.
const Addr readAddrMask
Address mask for sources of read accesses to be captured.
MonitorMasterPort masterPort
Instance of master port, facing the memory side.
BaseMasterPort & getMasterPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a master port with a given name and index.
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
ProbePointArg generates a point for the class of Arg.
virtual const std::string name() const
AddrRangeList getAddrRanges() const
Get the address ranges of the connected slave port.
Stats::Scalar totalWrittenBytes
void sendRetryReq()
Send a retry to the master port that previously attempted a sendTimingReq to this slave port and fail...
SenderState * senderState
This packet's sender state.
Stats::Histogram readBandwidthHist
The MemObject class extends the ClockedObject with accessor functions to get its master and slave por...
A BaseMasterPort is a protocol-agnostic master port, responsible only for the structural connection t...
ProbeManager * getProbeManager()
Get the probe manager for this object.
bool disableBandwidthHists
Disable flag for the bandwidth histograms.
void sendTimingSnoopReq(PacketPtr pkt)
Attempt to send a timing snoop request packet to the master port by calling its corresponding receive...
Stats::Histogram readBurstLengthHist
Histogram of read burst lengths.
SparseHistogram & init(size_type size)
Set the parameters of this histogram.
void schedule(Event &event, Tick when)
void recvTimingSnoopReq(PacketPtr pkt)
ProbePoints::PacketUPtr ppPktResp
Successfully forwarded response packet.
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...
SenderState * popSenderState()
Pop the top of the state stack and return a pointer to it.
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
void samplePeriodic()
This function is called periodically at the end of each time bin.
const double samplePeriod
Sample period in seconds.
EventWrapper< CommMonitor,&CommMonitor::samplePeriodic > samplePeriodicEvent
Periodic event called at the end of each simulation time bin.
unsigned int outstandingReadReqs
Tick recvAtomicSnoop(PacketPtr pkt)
Stats::Histogram outstandingReadsHist
Histogram of outstanding read requests.
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.
const Params * params() const
Stats::SparseHistogram readAddrDist
Histogram of number of read accesses to addresses over time.
void regStats() override
Register statistics for this object.
virtual BaseMasterPort & getMasterPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a master port with a given name and index.
Stats::Histogram writeBandwidthHist
Stats::Distribution ittReqReq
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
Stats::SparseHistogram writeAddrDist
Histogram of number of write accesses to addresses over time.
bool recvTimingSnoopResp(PacketPtr pkt)
void sendFunctional(PacketPtr pkt)
Send a functional request packet, where the data is instantly updated everywhere in the memory system...
MonitorStats stats
Instantiate stats.
A struct to hold on to the essential fields from a packet, so that the packet and underlying request ...
Stats::Histogram readLatencyHist
Histogram of read request-to-response latencies.
void updateReqStats(const ProbePoints::PacketInfo &pkt, bool is_atomic, bool expects_response)