averagePower = rank_power.average_power * memory.devicesPerRank;
}
+void
+DRAMCtrl::Rank::computeStats()
+{
+ DPRINTF(DRAM,"Computing final stats\n");
+
+ // Force DRAM power to update counters based on time spent in
+ // current state up to curTick()
+ cmdList.push_back(Command(MemCommand::NOP, 0, curTick()));
+
+ // Update the stats
+ updatePowerStats();
+
+ // final update of power state times
+ pwrStateTime[pwrState] += (curTick() - pwrStateTick);
+ pwrStateTick = curTick();
+
+}
+
void
DRAMCtrl::Rank::regStats()
{
averagePower
.name(name() + ".averagePower")
.desc("Core power per rank (mW)");
+
+ registerDumpCallback(new RankDumpCallback(this));
}
void
DRAMCtrl::regStats()
#include <string>
#include <unordered_set>
+#include "base/callback.hh"
#include "base/statistics.hh"
#include "enums/AddrMap.hh"
#include "enums/MemSched.hh"
*/
void regStats();
+ /**
+ * Computes stats just prior to dump event
+ */
+ void computeStats();
+
void processActivateEvent();
EventWrapper<Rank, &Rank::processActivateEvent>
activateEvent;
};
+ // define the process to compute stats on simulation exit
+ // defined per rank as the per rank stats are based on state
+ // transition and periodically updated, requiring re-sync at
+ // exit.
+ class RankDumpCallback : public Callback
+ {
+ Rank *ranks;
+ public:
+ RankDumpCallback(Rank *r) : ranks(r) {}
+ virtual void process() { ranks->computeStats(); };
+ };
+
/**
* A burst helper helps organize and manage a packet that is larger than
* the DRAM burst size. A system packet that is larger than the burst size