Hoa Nguyen has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/36476 )
Change subject: mem,stats: Update stats style for mem/probes and mem/qos
......................................................................
mem,stats: Update stats style for mem/probes and mem/qos
Change-Id: I47a094eb8fc56ef998ec3c971dab68ba39b092e3
Signed-off-by: Hoa Nguyen <hoangu...@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/36476
Reviewed-by: Daniel Carvalho <oda...@yahoo.com.br>
Maintainer: Jason Lowe-Power <power...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/mem/probes/mem_footprint.cc
M src/mem/probes/mem_footprint.hh
M src/mem/probes/stack_dist.cc
M src/mem/probes/stack_dist.hh
M src/mem/qos/mem_sink.cc
M src/mem/qos/mem_sink.hh
6 files changed, 94 insertions(+), 98 deletions(-)
Approvals:
Daniel Carvalho: Looks good to me, approved
Jason Lowe-Power: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/mem/probes/mem_footprint.cc
b/src/mem/probes/mem_footprint.cc
index 7e38fad..9dad04b 100644
--- a/src/mem/probes/mem_footprint.cc
+++ b/src/mem/probes/mem_footprint.cc
@@ -51,7 +51,8 @@
cacheLinesAll(),
pages(),
pagesAll(),
- system(p.system)
+ system(p.system),
+ stats(this)
{
fatal_if(!isPowerOf2(system->cacheLineSize()),
"MemFootprintProbe expects cache line size is power of 2.");
@@ -59,30 +60,24 @@
"MemFootprintProbe expects page size parameter is power of
2");
}
-void
-MemFootprintProbe::regStats()
+MemFootprintProbe::
+MemFootprintProbeStats::MemFootprintProbeStats(MemFootprintProbe *parent)
+ : Stats::Group(parent),
+ ADD_STAT(cacheLine, "Memory footprint at cache line granularity"),
+ ADD_STAT(cacheLineTotal, "Total memory footprint at cache line "
+ "granularity since simulation begin"),
+ ADD_STAT(page, "Memory footprint at page granularity"),
+ ADD_STAT(pageTotal, "Total memory footprint at page granularity
since "
+ "simulation begin")
{
- BaseMemProbe::regStats();
-
using namespace Stats;
// clang-format off
- fpCacheLine.name(name() + ".cacheline")
- .desc("Memory footprint at cache line granularity")
- .flags(nozero | nonan);
- fpCacheLineTotal.name(name() + ".cacheline_total")
- .desc("Total memory footprint at cache line granularity since "
- "simulation begin")
- .flags(nozero | nonan);
- fpPage.name(name() + ".page")
- .desc("Memory footprint at page granularity")
- .flags(nozero | nonan);
- fpPageTotal.name(name() + ".page_total")
- .desc("Total memory footprint at page granularity since
simulation "
- "begin")
- .flags(nozero | nonan);
+ cacheLine.flags(nozero | nonan);
+ cacheLineTotal.flags(nozero | nonan);
+ page.flags(nozero | nonan);
+ pageTotal.flags(nozero | nonan);
// clang-format on
-
- registerResetCallback([this]() { statReset(); });
+ registerResetCallback([parent]() { parent->statReset(); });
}
void
@@ -108,10 +103,10 @@
assert(cacheLines.size() <= cacheLinesAll.size());
assert(pages.size() <= pagesAll.size());
- fpCacheLine = cacheLines.size() << cacheLineSizeLg2;
- fpCacheLineTotal = cacheLinesAll.size() << cacheLineSizeLg2;
- fpPage = pages.size() << pageSizeLg2;
- fpPageTotal = pagesAll.size() << pageSizeLg2;
+ stats.cacheLine = cacheLines.size() << cacheLineSizeLg2;
+ stats.cacheLineTotal = cacheLinesAll.size() << cacheLineSizeLg2;
+ stats.page = pages.size() << pageSizeLg2;
+ stats.pageTotal = pagesAll.size() << pageSizeLg2;
}
void
diff --git a/src/mem/probes/mem_footprint.hh
b/src/mem/probes/mem_footprint.hh
index 71438c0..803a99c 100644
--- a/src/mem/probes/mem_footprint.hh
+++ b/src/mem/probes/mem_footprint.hh
@@ -57,7 +57,6 @@
typedef std::unordered_set<Addr> AddrSet;
MemFootprintProbe(const MemFootprintProbeParams &p);
- void regStats() override;
// Fix footprint tracking state on stat reset
void statReset();
@@ -72,14 +71,19 @@
void insertAddr(Addr addr, AddrSet *set, uint64_t limit);
void handleRequest(const ProbePoints::PacketInfo &pkt_info) override;
- /// Footprint at cache line size granularity
- Stats::Scalar fpCacheLine;
- /// Footprint at cache line size granularity, since simulation begin
- Stats::Scalar fpCacheLineTotal;
- /// Footprint at page granularity
- Stats::Scalar fpPage;
- /// Footprint at page granularity, since simulation begin
- Stats::Scalar fpPageTotal;
+ struct MemFootprintProbeStats : public Stats::Group
+ {
+ MemFootprintProbeStats(MemFootprintProbe *parent);
+
+ /// Footprint at cache line size granularity
+ Stats::Scalar cacheLine;
+ /// Footprint at cache line size granularity, since simulation
begin
+ Stats::Scalar cacheLineTotal;
+ /// Footprint at page granularity
+ Stats::Scalar page;
+ /// Footprint at page granularity, since simulation begin
+ Stats::Scalar pageTotal;
+ };
// Addr set to track unique cache lines accessed
AddrSet cacheLines;
@@ -90,6 +94,8 @@
// Addr set to track unique pages accessed since simulation begin
AddrSet pagesAll;
System *system;
+
+ MemFootprintProbeStats stats;
};
#endif //__MEM_PROBES_MEM_FOOTPRINT_HH__
diff --git a/src/mem/probes/stack_dist.cc b/src/mem/probes/stack_dist.cc
index 57f9199..d3c2f66 100644
--- a/src/mem/probes/stack_dist.cc
+++ b/src/mem/probes/stack_dist.cc
@@ -45,50 +45,45 @@
lineSize(p.line_size),
disableLinearHists(p.disable_linear_hists),
disableLogHists(p.disable_log_hists),
- calc(p.verify)
+ calc(p.verify),
+ stats(this)
{
fatal_if(p.system->cacheLineSize() > p.line_size,
"The stack distance probe must use a cache line size that is "
"larger or equal to the system's cahce line size.");
}
-void
-StackDistProbe::regStats()
+StackDistProbe::
+StackDistProbeStats::StackDistProbeStats(StackDistProbe *parent)
+ : Stats::Group(parent),
+ ADD_STAT(readLinearHist, "Reads linear distribution"),
+ ADD_STAT(readLogHist, "Reads logarithmic distribution"),
+ ADD_STAT(writeLinearHist, "Writes linear distribution"),
+ ADD_STAT(writeLogHist, "Writes logarithmic distribution"),
+ ADD_STAT(infiniteSD, "Number of requests with infinite stack
distance")
{
- BaseMemProbe::regStats();
+ using namespace Stats;
const StackDistProbeParams &p =
- dynamic_cast<const StackDistProbeParams &>(params());
-
- using namespace Stats;
+ dynamic_cast<const StackDistProbeParams &>(parent->params());
readLinearHist
.init(p.linear_hist_bins)
- .name(name() + ".readLinearHist")
- .desc("Reads linear distribution")
- .flags(disableLinearHists ? nozero : pdf);
+ .flags(parent->disableLinearHists ? nozero : pdf);
readLogHist
.init(p.log_hist_bins)
- .name(name() + ".readLogHist")
- .desc("Reads logarithmic distribution")
- .flags(disableLogHists ? nozero : pdf);
+ .flags(parent->disableLogHists ? nozero : pdf);
writeLinearHist
.init(p.linear_hist_bins)
- .name(name() + ".writeLinearHist")
- .desc("Writes linear distribution")
- .flags(disableLinearHists ? nozero : pdf);
+ .flags(parent->disableLinearHists ? nozero : pdf);
writeLogHist
.init(p.log_hist_bins)
- .name(name() + ".writeLogHist")
- .desc("Writes logarithmic distribution")
- .flags(disableLogHists ? nozero : pdf);
+ .flags(parent->disableLogHists ? nozero : pdf);
infiniteSD
- .name(name() + ".infinity")
- .desc("Number of requests with infinite stack distance")
.flags(nozero);
}
@@ -106,16 +101,16 @@
// Calculate the stack distance
const uint64_t sd(calc.calcStackDistAndUpdate(aligned_addr).first);
if (sd == StackDistCalc::Infinity) {
- infiniteSD++;
+ stats.infiniteSD++;
return;
}
// Sample the stack distance of the address in linear bins
if (!disableLinearHists) {
if (pkt_info.cmd.isRead())
- readLinearHist.sample(sd);
+ stats.readLinearHist.sample(sd);
else
- writeLinearHist.sample(sd);
+ stats.writeLinearHist.sample(sd);
}
if (!disableLogHists) {
@@ -123,8 +118,8 @@
// Sample the stack distance of the address in log bins
if (pkt_info.cmd.isRead())
- readLogHist.sample(sd_lg2);
+ stats.readLogHist.sample(sd_lg2);
else
- writeLogHist.sample(sd_lg2);
+ stats.writeLogHist.sample(sd_lg2);
}
}
diff --git a/src/mem/probes/stack_dist.hh b/src/mem/probes/stack_dist.hh
index 4a6ae54..009705e 100644
--- a/src/mem/probes/stack_dist.hh
+++ b/src/mem/probes/stack_dist.hh
@@ -50,8 +50,6 @@
public:
StackDistProbe(const StackDistProbeParams ¶ms);
- void regStats() override;
-
protected:
void handleRequest(const ProbePoints::PacketInfo &pkt_info) override;
@@ -66,23 +64,27 @@
const bool disableLogHists;
protected:
- // Reads linear histogram
- Stats::Histogram readLinearHist;
-
- // Reads logarithmic histogram
- Stats::SparseHistogram readLogHist;
-
- // Writes linear histogram
- Stats::Histogram writeLinearHist;
-
- // Writes logarithmic histogram
- Stats::SparseHistogram writeLogHist;
-
- // Writes logarithmic histogram
- Stats::Scalar infiniteSD;
-
- protected:
StackDistCalc calc;
+
+ struct StackDistProbeStats : public Stats::Group
+ {
+ StackDistProbeStats(StackDistProbe* parent);
+
+ // Reads linear histogram
+ Stats::Histogram readLinearHist;
+
+ // Reads logarithmic histogram
+ Stats::SparseHistogram readLogHist;
+
+ // Writes linear histogram
+ Stats::Histogram writeLinearHist;
+
+ // Writes logarithmic histogram
+ Stats::SparseHistogram writeLogHist;
+
+ // Writes logarithmic histogram
+ Stats::Scalar infiniteSD;
+ } stats;
};
diff --git a/src/mem/qos/mem_sink.cc b/src/mem/qos/mem_sink.cc
index 9d57500..8114090 100644
--- a/src/mem/qos/mem_sink.cc
+++ b/src/mem/qos/mem_sink.cc
@@ -52,7 +52,8 @@
readBufferSize(p.read_buffer_size),
writeBufferSize(p.write_buffer_size), port(name() + ".port", *this),
interface(p.interface),
- retryRdReq(false), retryWrReq(false), nextRequest(0),
nextReqEvent(this)
+ retryRdReq(false), retryWrReq(false), nextRequest(0),
nextReqEvent(this),
+ stats(this)
{
// Resize read and write queue to allocate space
// for configured QoS priorities
@@ -155,7 +156,7 @@
"%s Read queue full, not accepting\n", __func__);
// Remember that we have to retry this port
retryRdReq = true;
- numReadRetries++;
+ stats.numReadRetries++;
req_accepted = false;
} else {
// Enqueue the incoming packet into corresponding
@@ -169,7 +170,7 @@
"%s Write queue full, not accepting\n", __func__);
// Remember that we have to retry this port
retryWrReq = true;
- numWriteRetries++;
+ stats.numWriteRetries++;
req_accepted = false;
} else {
// Enqueue the incoming packet into corresponding QoS
@@ -332,18 +333,11 @@
}
}
-void
-MemSinkCtrl::regStats()
+MemSinkCtrl::MemSinkCtrlStats::MemSinkCtrlStats(Stats::Group *parent)
+ : Stats::Group(parent),
+ ADD_STAT(numReadRetries, "Number of read retries"),
+ ADD_STAT(numWriteRetries, "Number of write retries")
{
- MemCtrl::regStats();
-
- // Initialize all the stats
- using namespace Stats;
-
- numReadRetries.name(name() + ".numReadRetries")
- .desc("Number of read retries");
- numWriteRetries.name(name() + ".numWriteRetries")
- .desc("Number of write retries");
}
MemSinkCtrl::MemoryPort::MemoryPort(const std::string& n,
diff --git a/src/mem/qos/mem_sink.hh b/src/mem/qos/mem_sink.hh
index e9c3e74..8a9708d 100644
--- a/src/mem/qos/mem_sink.hh
+++ b/src/mem/qos/mem_sink.hh
@@ -181,11 +181,16 @@
/** Next request service time */
Tick nextRequest;
- /** Count the number of read retries */
- Stats::Scalar numReadRetries;
+ struct MemSinkCtrlStats : public Stats::Group
+ {
+ MemSinkCtrlStats(Stats::Group *parent);
- /** Count the number of write retries */
- Stats::Scalar numWriteRetries;
+ /** Count the number of read retries */
+ Stats::Scalar numReadRetries;
+
+ /** Count the number of write retries */
+ Stats::Scalar numWriteRetries;
+ };
/**
* QoS-aware (per priority) incoming read requests packets queue
@@ -247,8 +252,7 @@
*/
bool recvTimingReq(PacketPtr pkt);
- /** Registers statistics */
- void regStats() override;
+ MemSinkCtrlStats stats;
};
} // namespace QoS
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/36476
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I47a094eb8fc56ef998ec3c971dab68ba39b092e3
Gerrit-Change-Number: 36476
Gerrit-PatchSet: 23
Gerrit-Owner: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: Nikos Nikoleris <nikos.nikole...@arm.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s