mem: Add snoop traffic statistic

This commit is contained in:
David Guillen Fandos 2016-07-21 17:19:14 +01:00
parent 86a25bbcee
commit 0020662459
2 changed files with 14 additions and 1 deletions

View file

@ -317,8 +317,10 @@ CoherentXBar::recvTimingReq(PacketPtr pkt, PortID slave_port_id)
pktSize[slave_port_id][master_port_id] += pkt_size; pktSize[slave_port_id][master_port_id] += pkt_size;
transDist[pkt_cmd]++; transDist[pkt_cmd]++;
if (is_express_snoop) if (is_express_snoop) {
snoops++; snoops++;
snoopTraffic += pkt_size;
}
} }
if (sink_packet) if (sink_packet)
@ -415,8 +417,10 @@ CoherentXBar::recvTimingSnoopReq(PacketPtr pkt, PortID master_port_id)
pkt->getAddr()); pkt->getAddr());
// update stats here as we know the forwarding will succeed // update stats here as we know the forwarding will succeed
unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0;
transDist[pkt->cmdToIndex()]++; transDist[pkt->cmdToIndex()]++;
snoops++; snoops++;
snoopTraffic += pkt_size;
// we should only see express snoops from caches // we should only see express snoops from caches
assert(pkt->isExpressSnoop()); assert(pkt->isExpressSnoop());
@ -588,6 +592,7 @@ CoherentXBar::recvTimingSnoopResp(PacketPtr pkt, PortID slave_port_id)
// stats updates // stats updates
transDist[pkt_cmd]++; transDist[pkt_cmd]++;
snoops++; snoops++;
snoopTraffic += pkt_size;
return true; return true;
} }
@ -739,7 +744,9 @@ CoherentXBar::recvAtomicSnoop(PacketPtr pkt, PortID master_port_id)
pkt->cmdString()); pkt->cmdString());
// add the request snoop data // add the request snoop data
unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0;
snoops++; snoops++;
snoopTraffic += pkt_size;
// forward to all snoopers // forward to all snoopers
std::pair<MemCmd, Tick> snoop_result; std::pair<MemCmd, Tick> snoop_result;
@ -965,6 +972,11 @@ CoherentXBar::regStats()
.desc("Total snoops (count)") .desc("Total snoops (count)")
; ;
snoopTraffic
.name(name() + ".snoopTraffic")
.desc("Total snoop traffic (bytes)")
;
snoopFanout snoopFanout
.init(0, snoopPorts.size(), 1) .init(0, snoopPorts.size(), 1)
.name(name() + ".snoop_fanout") .name(name() + ".snoop_fanout")

View file

@ -394,6 +394,7 @@ class CoherentXBar : public BaseXBar
bool sinkPacket(const PacketPtr pkt) const; bool sinkPacket(const PacketPtr pkt) const;
Stats::Scalar snoops; Stats::Scalar snoops;
Stats::Scalar snoopTraffic;
Stats::Distribution snoopFanout; Stats::Distribution snoopFanout;
public: public: