changeset 3ab6c2a5a407 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=3ab6c2a5a407
description:
mem: Add a simple snoop counter per bus
This patch adds a simple counter for both total messages and a
histogram for
the fan-out of snoop messages. The fan-out describes to how many ports
snoops
had to be sent per incoming request / snoop-from-below. Without any
cleverness, this usually means to either all, or all but the requesting
port.
diffstat:
src/mem/coherent_bus.cc | 32 +++++++++++++++++++++++++++++++-
src/mem/coherent_bus.hh | 2 ++
2 files changed, 33 insertions(+), 1 deletions(-)
diffs (127 lines):
diff -r 0655a3d869ad -r 3ab6c2a5a407 src/mem/coherent_bus.cc
--- a/src/mem/coherent_bus.cc Thu Apr 24 17:41:26 2014 +0100
+++ b/src/mem/coherent_bus.cc Thu Apr 24 13:28:47 2014 +0100
@@ -197,6 +197,7 @@
if (is_express_snoop) {
assert(success);
snoopDataThroughBus += pkt_size;
+ snoopsThroughBus++;
} else {
// for normal requests, check if successful
if (!success) {
@@ -297,6 +298,7 @@
// update stats here as we know the forwarding will succeed
transDist[pkt->cmdToIndex()]++;
snoopDataThroughBus += pkt->hasData() ? pkt->getSize() : 0;
+ snoopsThroughBus++;
// we should only see express snoops from caches
assert(pkt->isExpressSnoop());
@@ -411,6 +413,7 @@
// stats updates
transDist[pkt_cmd]++;
snoopDataThroughBus += pkt_size;
+ snoopsThroughBus++;
return true;
}
@@ -425,6 +428,8 @@
// snoops should only happen if the system isn't bypassing caches
assert(!system->bypassCaches());
+ unsigned fanout = 0;
+
for (SlavePortIter s = snoopPorts.begin(); s != snoopPorts.end(); ++s) {
SlavePort *p = *s;
// we could have gotten this request from a snooping master
@@ -435,8 +440,12 @@
p->getId() != exclude_slave_port_id) {
// cache is not allowed to refuse snoop
p->sendTimingSnoopReq(pkt);
+ fanout++;
}
}
+
+ // Stats for fanout of this forward operation
+ snoopFanout.sample(fanout);
}
void
@@ -503,6 +512,7 @@
// add the request snoop data
snoopDataThroughBus += pkt->hasData() ? pkt->getSize() : 0;
+ snoopsThroughBus++;
// forward to all snoopers
std::pair<MemCmd, Tick> snoop_result =
@@ -514,8 +524,10 @@
pkt->cmd = snoop_response_cmd;
// add the response snoop data
- if (pkt->isResponse())
+ if (pkt->isResponse()) {
snoopDataThroughBus += pkt->hasData() ? pkt->getSize() : 0;
+ snoopsThroughBus++;
+ }
// @todo: Not setting first-word time
pkt->busLastWordDelay = snoop_response_latency;
@@ -535,6 +547,8 @@
// snoops should only happen if the system isn't bypassing caches
assert(!system->bypassCaches());
+ unsigned fanout = 0;
+
for (SlavePortIter s = snoopPorts.begin(); s != snoopPorts.end(); ++s) {
SlavePort *p = *s;
// we could have gotten this request from a snooping master
@@ -544,6 +558,8 @@
if (exclude_slave_port_id == InvalidPortID ||
p->getId() != exclude_slave_port_id) {
Tick latency = p->sendAtomicSnoop(pkt);
+ fanout++;
+
// in contrast to a functional access, we have to keep on
// going as all snoopers must be updated even if we get a
// response
@@ -562,6 +578,9 @@
}
}
+ // Stats for fanout
+ snoopFanout.sample(fanout);
+
// the packet is restored as part of the loop and any potential
// snoop response is part of the returned pair
return std::make_pair(snoop_response_cmd, snoop_response_latency);
@@ -667,6 +686,17 @@
.desc("Total snoop data (bytes)")
;
+ snoopsThroughBus
+ .name(name() + ".snoops_through_bus")
+ .desc("Total snoops (count)")
+ ;
+
+ snoopFanout
+ .init(0, snoopPorts.size(), 1)
+ .name(name() + ".snoop_fanout")
+ .desc("Request fanout histogram")
+ ;
+
throughput
.name(name() + ".throughput")
.desc("Throughput (bytes/s)")
diff -r 0655a3d869ad -r 3ab6c2a5a407 src/mem/coherent_bus.hh
--- a/src/mem/coherent_bus.hh Thu Apr 24 17:41:26 2014 +0100
+++ b/src/mem/coherent_bus.hh Thu Apr 24 13:28:47 2014 +0100
@@ -341,6 +341,8 @@
Stats::Scalar dataThroughBus;
Stats::Scalar snoopDataThroughBus;
+ Stats::Scalar snoopsThroughBus;
+ Stats::Distribution snoopFanout;
public:
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev