summaryrefslogtreecommitdiff
path: root/src/mem/stack_dist_calc.cc
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2015-08-04 10:29:13 +0100
committerAndreas Sandberg <andreas.sandberg@arm.com>2015-08-04 10:29:13 +0100
commit022e69e6de513fce2efea8d732e9274624ce3e94 (patch)
tree4d2464067387eef65fc798eebc47e11fa382ebef /src/mem/stack_dist_calc.cc
parentfeded87fc99741a0603c4a124bb856eca594c4aa (diff)
downloadgem5-022e69e6de513fce2efea8d732e9274624ce3e94.tar.xz
mem: Redesign the stack distance calculator as a probe
This changeset removes the stack distance calculator hooks from the CommMonitor class and implements a stack distance calculator as a memory system probe instead. The probe can be hooked up to any component that exports probe points of the type ProbePoints::Packet.
Diffstat (limited to 'src/mem/stack_dist_calc.cc')
-rw-r--r--src/mem/stack_dist_calc.cc81
1 files changed, 7 insertions, 74 deletions
diff --git a/src/mem/stack_dist_calc.cc b/src/mem/stack_dist_calc.cc
index c273ee7f4..3dca87384 100644
--- a/src/mem/stack_dist_calc.cc
+++ b/src/mem/stack_dist_calc.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 ARM Limited
+ * Copyright (c) 2014-2015 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -37,15 +37,16 @@
* Authors: Kanishk Sugand
*/
+#include "mem/stack_dist_calc.hh"
+
+#include "base/chunk_generator.hh"
#include "base/intmath.hh"
#include "base/trace.hh"
#include "debug/StackDist.hh"
-#include "mem/stack_dist_calc.hh"
-StackDistCalc::StackDistCalc(const StackDistCalcParams* p) :
- SimObject(p), index(0), verifyStack(p->verify),
- disableLinearHists(p->disable_linear_hists),
- disableLogHists(p->disable_log_hists)
+StackDistCalc::StackDistCalc(bool verify_stack)
+ : index(0),
+ verifyStack(verify_stack)
{
// Instantiate a new root and leaf layer
// Map type variable, representing a layer in the tree
@@ -91,38 +92,6 @@ StackDistCalc::~StackDistCalc()
stack.clear();
}
-void
-StackDistCalc::update(const MemCmd& cmd, Addr addr)
-{
- // only capturing read and write requests (which allocate in the
- // cache)
- if (cmd.isRead() || cmd.isWrite()) {
- auto returnType = calcStackDistAndUpdate(addr);
-
- uint64_t stackDist = returnType.first;
-
- if (stackDist != Infinity) {
- // Sample the stack distance of the address in linear bins
- if (!disableLinearHists) {
- if (cmd.isRead())
- readLinearHist.sample(stackDist);
- else
- writeLinearHist.sample(stackDist);
- }
-
- if (!disableLogHists) {
- int stackDistLog2 = stackDist == 0 ? 1 : floorLog2(stackDist);
-
- // Sample the stack distance of the address in log bins
- if (cmd.isRead())
- readLogHist.sample(stackDistLog2);
- else
- writeLogHist.sample(stackDistLog2);
- }
- }
- }
-}
-
// The updateSum method is a recursive function which updates
// the node sums till the root. It also deletes the nodes that
// are not used anymore.
@@ -632,39 +601,3 @@ StackDistCalc::printStack(int n) const
}
}
}
-
-void
-StackDistCalc::regStats()
-{
- using namespace Stats;
-
- readLinearHist
- .init(params()->linear_hist_bins)
- .name(name() + ".readLinearHist")
- .desc("Reads linear distribution")
- .flags(disableLinearHists ? nozero : pdf);
-
- readLogHist
- .init(params()->log_hist_bins)
- .name(name() + ".readLogHist")
- .desc("Reads logarithmic distribution")
- .flags(disableLogHists ? nozero : pdf);
-
- writeLinearHist
- .init(params()->linear_hist_bins)
- .name(name() + ".writeLinearHist")
- .desc("Writes linear distribution")
- .flags(disableLinearHists ? nozero : pdf);
-
- writeLogHist
- .init(params()->log_hist_bins)
- .name(name() + ".writeLogHist")
- .desc("Writes logarithmic distribution")
- .flags(disableLogHists ? nozero : pdf);
-}
-
-StackDistCalc*
-StackDistCalcParams::create()
-{
- return new StackDistCalc(this);
-}