2c2
< * Copyright (c) 2014 ARM Limited
---
> * Copyright (c) 2014-2015 ARM Limited
39a40,42
> #include "mem/stack_dist_calc.hh"
>
> #include "base/chunk_generator.hh"
43d45
< #include "mem/stack_dist_calc.hh"
45,48c47,49
< 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)
94,125d94
< 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);
< }
< }
< }
< }
<
635,670d603
<
< 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);
< }