43#include "debug/CommMonitor.hh"
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 &
params)
110 "Histogram of burst lengths of transmitted packets"),
112 "Histogram of burst lengths of transmitted packets"),
118 "Histogram of read bandwidth per sample period"),
120 "Number of bytes read"),
123 "Average read bandwidth",
129 "Histogram of write bandwidth"),
132 "Number of bytes written"),
135 "Average write bandwidth",
140 "Read request-response latency"),
142 "Write request-response latency"),
146 "Read-to-read inter transaction time"),
148 "Write-to-write inter transaction time"),
150 "Request-to-request inter transaction time"),
155 "Outstanding read transactions"),
158 "Outstanding write transactions"),
163 "Histogram of read transactions per sample period"),
166 "Histogram of write transactions per sample period"),
173 "Read address distribution"),
175 "Write address distribution")
180 .init(
params.burst_length_bins)
184 .init(
params.burst_length_bins)
189 .init(
params.bandwidth_bins)
200 .init(
params.bandwidth_bins)
211 .init(
params.latency_bins)
215 .init(
params.latency_bins)
234 .init(
params.outstanding_bins)
238 .init(
params.outstanding_bins)
242 .init(
params.transaction_bins)
246 .init(
params.transaction_bins)
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;
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.
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.
void recvRetrySnoopResp()
bool tryTiming(PacketPtr pkt)
bool recvTimingReq(PacketPtr pkt)
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 ¶ms)
Constructor based on the Python params.
bool recvTimingResp(PacketPtr pkt)
MonitorRequestPort memSidePort
Instance of request port, facing the memory side.
virtual std::string name() const
bool needsResponse() const
SenderState * senderState
This packet's sender state.
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.
bool cacheResponding() const
Ports are used to interface objects to each other.
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
std::list< AddrRange > AddrRangeList
Convenience typedef for a collection of address ranges.
void schedule(Event &event, Tick when)
#define panic(...)
This implements a cprintf based panic() function.
#define fatal(...)
This implements a cprintf based fatal() function.
const Params & params() const
SimObject(const Params &p)
ProbeManager * getProbeManager()
Get the probe manager for this object.
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
ProbePointArg< PacketInfo > Packet
Packet probe point.
double s
These variables equal the number of ticks in the unit of time they're named after in a double.
const FlagsType pdf
Print the percent of the total that this entry represents.
const FlagsType nozero
Don't print if this is zero.
Copyright (c) 2024 Arm Limited All rights reserved.
Tick curTick()
The universal simulation clock.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
uint64_t Tick
Tick count type.
statistics::Value & simTicks
statistics::Formula & simSeconds
statistics::SparseHistogram writeAddrDist
Histogram of number of write accesses to addresses over time.
unsigned int outstandingWriteReqs
unsigned int outstandingReadReqs
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 ¶ms)
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.
SenderState * predecessor
A struct to hold on to the essential fields from a packet, so that the packet and underlying request ...
const std::string & name()