summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Guillen Fandos <david.guillen@arm.com>2016-07-21 17:19:14 +0100
committerDavid Guillen Fandos <david.guillen@arm.com>2016-07-21 17:19:14 +0100
commit0020662459fdd9efcfe9864ef12160515434ccdb (patch)
tree536e1cebd8a286d55301bccd94163a5190e441cc
parent86a25bbcee88f6e69299867b6264885d738f636e (diff)
downloadgem5-0020662459fdd9efcfe9864ef12160515434ccdb.tar.xz
mem: Add snoop traffic statistic
-rw-r--r--src/mem/coherent_xbar.cc14
-rw-r--r--src/mem/coherent_xbar.hh1
2 files changed, 14 insertions, 1 deletions
diff --git a/src/mem/coherent_xbar.cc b/src/mem/coherent_xbar.cc
index f33a33b0f..c0d8ab037 100644
--- a/src/mem/coherent_xbar.cc
+++ b/src/mem/coherent_xbar.cc
@@ -317,8 +317,10 @@ CoherentXBar::recvTimingReq(PacketPtr pkt, PortID slave_port_id)
pktSize[slave_port_id][master_port_id] += pkt_size;
transDist[pkt_cmd]++;
- if (is_express_snoop)
+ if (is_express_snoop) {
snoops++;
+ snoopTraffic += pkt_size;
+ }
}
if (sink_packet)
@@ -415,8 +417,10 @@ CoherentXBar::recvTimingSnoopReq(PacketPtr pkt, PortID master_port_id)
pkt->getAddr());
// update stats here as we know the forwarding will succeed
+ unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0;
transDist[pkt->cmdToIndex()]++;
snoops++;
+ snoopTraffic += pkt_size;
// we should only see express snoops from caches
assert(pkt->isExpressSnoop());
@@ -588,6 +592,7 @@ CoherentXBar::recvTimingSnoopResp(PacketPtr pkt, PortID slave_port_id)
// stats updates
transDist[pkt_cmd]++;
snoops++;
+ snoopTraffic += pkt_size;
return true;
}
@@ -739,7 +744,9 @@ CoherentXBar::recvAtomicSnoop(PacketPtr pkt, PortID master_port_id)
pkt->cmdString());
// add the request snoop data
+ unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0;
snoops++;
+ snoopTraffic += pkt_size;
// forward to all snoopers
std::pair<MemCmd, Tick> snoop_result;
@@ -965,6 +972,11 @@ CoherentXBar::regStats()
.desc("Total snoops (count)")
;
+ snoopTraffic
+ .name(name() + ".snoopTraffic")
+ .desc("Total snoop traffic (bytes)")
+ ;
+
snoopFanout
.init(0, snoopPorts.size(), 1)
.name(name() + ".snoop_fanout")
diff --git a/src/mem/coherent_xbar.hh b/src/mem/coherent_xbar.hh
index 8c55b59da..0f641664d 100644
--- a/src/mem/coherent_xbar.hh
+++ b/src/mem/coherent_xbar.hh
@@ -394,6 +394,7 @@ class CoherentXBar : public BaseXBar
bool sinkPacket(const PacketPtr pkt) const;
Stats::Scalar snoops;
+ Stats::Scalar snoopTraffic;
Stats::Distribution snoopFanout;
public: