mem: Add callback to compute stats prior to dump event
The per rank statistics are periodically updated based on state transition and refresh events. Add a method to update these when a dump event occurs to ensure they reflect accurate values. Specifically, need to ensure that the low-power state durations, power, and energy are logged correctly. Change-Id: Ib642a6668340de8f494a608bb34982e58ba7f1eb Reviewed-by: Radhika Jagtap <radhika.jagtap@arm.com>
This commit is contained in:
parent
0dd0d4ee7a
commit
7b269f2c95
2 changed files with 38 additions and 0 deletions
|
@ -1856,6 +1856,24 @@ DRAMCtrl::Rank::updatePowerStats()
|
||||||
averagePower = rank_power.average_power * memory.devicesPerRank;
|
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
|
void
|
||||||
DRAMCtrl::Rank::regStats()
|
DRAMCtrl::Rank::regStats()
|
||||||
{
|
{
|
||||||
|
@ -1906,6 +1924,8 @@ DRAMCtrl::Rank::regStats()
|
||||||
averagePower
|
averagePower
|
||||||
.name(name() + ".averagePower")
|
.name(name() + ".averagePower")
|
||||||
.desc("Core power per rank (mW)");
|
.desc("Core power per rank (mW)");
|
||||||
|
|
||||||
|
registerDumpCallback(new RankDumpCallback(this));
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
DRAMCtrl::regStats()
|
DRAMCtrl::regStats()
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
|
#include "base/callback.hh"
|
||||||
#include "base/statistics.hh"
|
#include "base/statistics.hh"
|
||||||
#include "enums/AddrMap.hh"
|
#include "enums/AddrMap.hh"
|
||||||
#include "enums/MemSched.hh"
|
#include "enums/MemSched.hh"
|
||||||
|
@ -409,6 +410,11 @@ class DRAMCtrl : public AbstractMemory
|
||||||
*/
|
*/
|
||||||
void regStats();
|
void regStats();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computes stats just prior to dump event
|
||||||
|
*/
|
||||||
|
void computeStats();
|
||||||
|
|
||||||
void processActivateEvent();
|
void processActivateEvent();
|
||||||
EventWrapper<Rank, &Rank::processActivateEvent>
|
EventWrapper<Rank, &Rank::processActivateEvent>
|
||||||
activateEvent;
|
activateEvent;
|
||||||
|
@ -427,6 +433,18 @@ class DRAMCtrl : public AbstractMemory
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 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
|
* 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
|
* the DRAM burst size. A system packet that is larger than the burst size
|
||||||
|
|
Loading…
Reference in a new issue