summaryrefslogtreecommitdiff
path: root/src/mem/xbar.cc
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2019-09-23 18:18:28 +0100
committerAndreas Sandberg <andreas.sandberg@arm.com>2019-09-30 12:34:16 +0000
commita2286fe344f0fd6484f232329a56e9f07e2136de (patch)
tree968122748728e3ce45d5a0732bf59d9f4a93df97 /src/mem/xbar.cc
parent0d98a7170f50d07d737a6a78e32e6ac3021262ec (diff)
downloadgem5-a2286fe344f0fd6484f232329a56e9f07e2136de.tar.xz
mem: Use new-style stats in the XBar models
Migrate to new-world stats with an explicit hierarchy in all of the XBar models. Change-Id: I18b6746a1303ca415638e6d382fb4757607f1123 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/21141 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Diffstat (limited to 'src/mem/xbar.cc')
-rw-r--r--src/mem/xbar.cc54
1 files changed, 23 insertions, 31 deletions
diff --git a/src/mem/xbar.cc b/src/mem/xbar.cc
index 16f0e21dd..5efb2c947 100644
--- a/src/mem/xbar.cc
+++ b/src/mem/xbar.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2015, 2018 ARM Limited
+ * Copyright (c) 2011-2015, 2018-2019 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -64,8 +64,15 @@ BaseXBar::BaseXBar(const BaseXBarParams *p)
gotAddrRanges(p->port_default_connection_count +
p->port_master_connection_count, false),
gotAllAddrRanges(false), defaultPortID(InvalidPortID),
- useDefaultRange(p->use_default_range)
-{}
+ useDefaultRange(p->use_default_range),
+
+ transDist(this, "trans_dist", "Transaction distribution"),
+ pktCount(this, "pkt_count",
+ "Packet count per connected master and slave (bytes)"),
+ pktSize(this, "pkt_size",
+ "Cumulative packet size per connected master and slave (bytes)")
+{
+}
BaseXBar::~BaseXBar()
{
@@ -133,9 +140,20 @@ BaseXBar::calcPacketTiming(PacketPtr pkt, Tick header_delay)
template <typename SrcType, typename DstType>
BaseXBar::Layer<SrcType, DstType>::Layer(DstType& _port, BaseXBar& _xbar,
const std::string& _name) :
- port(_port), xbar(_xbar), _name(_name), state(IDLE),
- waitingForPeer(NULL), releaseEvent([this]{ releaseLayer(); }, name())
+ Stats::Group(&_xbar, _name.c_str()),
+ port(_port), xbar(_xbar), _name(xbar.name() + "." + _name), state(IDLE),
+ waitingForPeer(NULL), releaseEvent([this]{ releaseLayer(); }, name()),
+ ADD_STAT(occupancy, "Layer occupancy (ticks)"),
+ ADD_STAT(utilization, "Layer utilization (%)")
{
+ occupancy
+ .flags(Stats::nozero);
+
+ utilization
+ .precision(1)
+ .flags(Stats::nozero);
+
+ utilization = 100 * occupancy / simTicks;
}
template <typename SrcType, typename DstType>
@@ -527,8 +545,6 @@ BaseXBar::regStats()
transDist
.init(MemCmd::NUM_MEM_CMDS)
- .name(name() + ".trans_dist")
- .desc("Transaction distribution")
.flags(nozero);
// get the string representation of the commands
@@ -540,14 +556,10 @@ BaseXBar::regStats()
pktCount
.init(slavePorts.size(), masterPorts.size())
- .name(name() + ".pkt_count")
- .desc("Packet count per connected master and slave (bytes)")
.flags(total | nozero | nonan);
pktSize
.init(slavePorts.size(), masterPorts.size())
- .name(name() + ".pkt_size")
- .desc("Cumulative packet size per connected master and slave (bytes)")
.flags(total | nozero | nonan);
// both the packet count and total size are two-dimensional
@@ -581,26 +593,6 @@ BaseXBar::Layer<SrcType, DstType>::drain()
}
}
-template <typename SrcType, typename DstType>
-void
-BaseXBar::Layer<SrcType, DstType>::regStats()
-{
- using namespace Stats;
-
- occupancy
- .name(name() + ".occupancy")
- .desc("Layer occupancy (ticks)")
- .flags(nozero);
-
- utilization
- .name(name() + ".utilization")
- .desc("Layer utilization (%)")
- .precision(1)
- .flags(nozero);
-
- utilization = 100 * occupancy / simTicks;
-}
-
/**
* Crossbar layer template instantiations. Could be removed with _impl.hh
* file, but since there are only two given options (MasterPort and