summaryrefslogtreecommitdiff
path: root/src/mem/comm_monitor.cc
diff options
context:
space:
mode:
authorKanishk Sugand <kanishk.sugand@arm.com>2014-12-23 09:31:18 -0500
committerKanishk Sugand <kanishk.sugand@arm.com>2014-12-23 09:31:18 -0500
commit7a25b1a0e02b1587fe18439ad81591704196d519 (patch)
tree2fd66e374324e8e045201f0f15087359e89503c1 /src/mem/comm_monitor.cc
parent888975b29d920df9acdcf55db491d802e607cea6 (diff)
downloadgem5-7a25b1a0e02b1587fe18439ad81591704196d519.tar.xz
mem: Add stack distance statistics to the CommMonitor
This patch adds the stack distance calculator to the CommMonitor. The stats are disabled by default.
Diffstat (limited to 'src/mem/comm_monitor.cc')
-rw-r--r--src/mem/comm_monitor.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/mem/comm_monitor.cc b/src/mem/comm_monitor.cc
index c9cbcb143..7539672cc 100644
--- a/src/mem/comm_monitor.cc
+++ b/src/mem/comm_monitor.cc
@@ -55,6 +55,7 @@ CommMonitor::CommMonitor(Params* params)
readAddrMask(params->read_addr_mask),
writeAddrMask(params->write_addr_mask),
stats(params),
+ stackDistCalc(params->stack_dist_calc),
traceStream(NULL),
system(params->system)
{
@@ -137,6 +138,7 @@ CommMonitor::init()
if (!system->isTimingMode())
warn("%s: Not in timing mode. No trace will be recorded.", name());
}
+
}
BaseMasterPort&
@@ -174,6 +176,10 @@ CommMonitor::recvFunctionalSnoop(PacketPtr pkt)
Tick
CommMonitor::recvAtomic(PacketPtr pkt)
{
+ // allow stack distance calculations for atomic if enabled
+ if (stackDistCalc)
+ stackDistCalc->update(pkt->cmd, pkt->getAddr());
+
return masterPort.sendAtomic(pkt);
}
@@ -193,7 +199,8 @@ CommMonitor::recvTimingReq(PacketPtr pkt)
// or even deleted when sendTiming() is called.
bool is_read = pkt->isRead();
bool is_write = pkt->isWrite();
- int cmd = pkt->cmdToIndex();
+ MemCmd cmd = pkt->cmd;
+ int cmd_idx = pkt->cmdToIndex();
Request::FlagsType req_flags = pkt->req->getFlags();
unsigned size = pkt->getSize();
Addr addr = pkt->getAddr();
@@ -216,13 +223,18 @@ CommMonitor::recvTimingReq(PacketPtr pkt)
delete pkt->popSenderState();
}
+ // If successful and we are calculating stack distances, update
+ // the calculator
+ if (successful && stackDistCalc)
+ stackDistCalc->update(cmd, addr);
+
if (successful && traceStream != NULL) {
// Create a protobuf message representing the
// packet. Currently we do not preserve the flags in the
// trace.
ProtoMessage::Packet pkt_msg;
pkt_msg.set_tick(curTick());
- pkt_msg.set_cmd(cmd);
+ pkt_msg.set_cmd(cmd_idx);
pkt_msg.set_flags(req_flags);
pkt_msg.set_addr(addr);
pkt_msg.set_size(size);