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.");
"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
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
typedef std::unordered_set<Addr> AddrSet;
MemFootprintProbe(const MemFootprintProbeParams &p);
- void regStats() override;
// Fix footprint tracking state on stat reset
void statReset();
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;
// Addr set to track unique pages accessed since simulation begin
AddrSet pagesAll;
System *system;
+
+ MemFootprintProbeStats stats;
};
#endif //__MEM_PROBES_MEM_FOOTPRINT_HH__
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);
}
// 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) {
// 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);
}
}
public:
StackDistProbe(const StackDistProbeParams ¶ms);
- void regStats() override;
-
protected:
void handleRequest(const ProbePoints::PacketInfo &pkt_info) override;
const bool disableLogHists;
protected:
- // Reads linear histogram
- Stats::Histogram readLinearHist;
+ StackDistCalc calc;
- // Reads logarithmic histogram
- Stats::SparseHistogram readLogHist;
+ struct StackDistProbeStats : public Stats::Group
+ {
+ StackDistProbeStats(StackDistProbe* parent);
- // Writes linear histogram
- Stats::Histogram writeLinearHist;
+ // Reads linear histogram
+ Stats::Histogram readLinearHist;
- // Writes logarithmic histogram
- Stats::SparseHistogram writeLogHist;
+ // Reads logarithmic histogram
+ Stats::SparseHistogram readLogHist;
- // Writes logarithmic histogram
- Stats::Scalar infiniteSD;
+ // Writes linear histogram
+ Stats::Histogram writeLinearHist;
- protected:
- StackDistCalc calc;
+ // Writes logarithmic histogram
+ Stats::SparseHistogram writeLogHist;
+
+ // Writes logarithmic histogram
+ Stats::Scalar infiniteSD;
+ } stats;
};
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
"%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
"%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
}
}
-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,
/** 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 read retries */
+ Stats::Scalar numReadRetries;
- /** Count the number of write retries */
- Stats::Scalar numWriteRetries;
+ /** Count the number of write retries */
+ Stats::Scalar numWriteRetries;
+ };
/**
* QoS-aware (per priority) incoming read requests packets queue
*/
bool recvTimingReq(PacketPtr pkt);
- /** Registers statistics */
- void regStats() override;
+ MemSinkCtrlStats stats;
};
} // namespace QoS