summaryrefslogtreecommitdiff
path: root/src/mem/comm_monitor.cc
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2015-08-04 10:29:13 +0100
committerAndreas Sandberg <andreas.sandberg@arm.com>2015-08-04 10:29:13 +0100
commitfeded87fc99741a0603c4a124bb856eca594c4aa (patch)
tree6feffa21c8bbdb65d3cd67b552b756053590a826 /src/mem/comm_monitor.cc
parent8723b08dbf254bc436eac2b2ddf86efa02fc4274 (diff)
downloadgem5-feded87fc99741a0603c4a124bb856eca594c4aa.tar.xz
mem: Add probe support to the CommMonitor
This changeset adds a standardized probe point type to monitor packets in the memory system and adds two probe points to the CommMonitor class. These probe points enable monitoring of successfully delivered requests and successfully delivered responses. Memory system probe listeners should use the BaseMemProbe base class to provide a unified configuration interface and reuse listener registration code. Unlike the ProbeListenerObject class, the BaseMemProbe allows objects to be wired to multiple ProbeManager instances as long as they use the same probe point name.
Diffstat (limited to 'src/mem/comm_monitor.cc')
-rw-r--r--src/mem/comm_monitor.cc47
1 files changed, 38 insertions, 9 deletions
diff --git a/src/mem/comm_monitor.cc b/src/mem/comm_monitor.cc
index d95a2fd5a..bd9b26816 100644
--- a/src/mem/comm_monitor.cc
+++ b/src/mem/comm_monitor.cc
@@ -139,6 +139,13 @@ CommMonitor::init()
}
+void
+CommMonitor::regProbePoints()
+{
+ ppPktReq.reset(new ProbePoints::Packet(getProbeManager(), "PktRequest"));
+ ppPktResp.reset(new ProbePoints::Packet(getProbeManager(), "PktResponse"));
+}
+
BaseMasterPort&
CommMonitor::getMasterPort(const std::string& if_name, PortID idx)
{
@@ -174,6 +181,8 @@ CommMonitor::recvFunctionalSnoop(PacketPtr pkt)
Tick
CommMonitor::recvAtomic(PacketPtr pkt)
{
+ ppPktReq->notify(pkt);
+
// do stack distance calculations if enabled
if (stackDistCalc)
stackDistCalc->update(pkt->cmd, pkt->getAddr());
@@ -191,7 +200,10 @@ CommMonitor::recvAtomic(PacketPtr pkt)
traceStream->write(pkt_msg);
}
- return masterPort.sendAtomic(pkt);
+ const Tick delay(masterPort.sendAtomic(pkt));
+ assert(pkt->isResponse());
+ ppPktResp->notify(pkt);
+ return delay;
}
Tick
@@ -208,14 +220,15 @@ CommMonitor::recvTimingReq(PacketPtr pkt)
// Store relevant fields of packet, because packet may be modified
// or even deleted when sendTiming() is called.
- bool is_read = pkt->isRead();
- bool is_write = pkt->isWrite();
- MemCmd cmd = pkt->cmd;
- int cmd_idx = pkt->cmdToIndex();
- Request::FlagsType req_flags = pkt->req->getFlags();
- unsigned size = pkt->getSize();
- Addr addr = pkt->getAddr();
- bool expects_response = pkt->needsResponse() && !pkt->memInhibitAsserted();
+ const bool is_read = pkt->isRead();
+ const bool is_write = pkt->isWrite();
+ const MemCmd cmd = pkt->cmd;
+ const int cmd_idx = pkt->cmdToIndex();
+ const Request::FlagsType req_flags = pkt->req->getFlags();
+ const unsigned size = pkt->getSize();
+ const Addr addr = pkt->getAddr();
+ const bool expects_response(
+ pkt->needsResponse() && !pkt->memInhibitAsserted());
// If a cache miss is served by a cache, a monitor near the memory
// would see a request which needs a response, but this response
@@ -234,6 +247,17 @@ CommMonitor::recvTimingReq(PacketPtr pkt)
delete pkt->popSenderState();
}
+ if (successful) {
+ // The receiver might already have modified the packet. We
+ // want to give the probe access to the original packet, which
+ // means we need to fake the original packet by temporarily
+ // restoring the command.
+ const MemCmd response_cmd(pkt->cmd);
+ pkt->cmd = cmd;
+ ppPktReq->notify(pkt);
+ pkt->cmd = response_cmd;
+ }
+
// If successful and we are calculating stack distances, update
// the calculator
if (successful && stackDistCalc)
@@ -378,6 +402,11 @@ CommMonitor::recvTimingResp(PacketPtr pkt)
}
}
+ if (successful) {
+ assert(pkt->isResponse());
+ ppPktResp->notify(pkt);
+ }
+
if (successful && is_read) {
// Decrement number of outstanding read requests
DPRINTF(CommMonitor, "Received read response\n");