summaryrefslogtreecommitdiff
path: root/src/mem/dram_ctrl.hh
diff options
context:
space:
mode:
authorWendy Elsasser <wendy.elsasser@arm.com>2016-10-13 19:22:11 +0100
committerWendy Elsasser <wendy.elsasser@arm.com>2016-10-13 19:22:11 +0100
commit7b269f2c95f546e69b5f5bea0edc741f2a0d9cfe (patch)
tree1240a654d1a99409cbef30fe6631090de51e95f0 /src/mem/dram_ctrl.hh
parent0dd0d4ee7adb561e89a47c3e8284c237bebdc4ab (diff)
downloadgem5-7b269f2c95f546e69b5f5bea0edc741f2a0d9cfe.tar.xz
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>
Diffstat (limited to 'src/mem/dram_ctrl.hh')
-rw-r--r--src/mem/dram_ctrl.hh18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mem/dram_ctrl.hh b/src/mem/dram_ctrl.hh
index 79a68af4b..b59ed3d2c 100644
--- a/src/mem/dram_ctrl.hh
+++ b/src/mem/dram_ctrl.hh
@@ -56,6 +56,7 @@
#include <string>
#include <unordered_set>
+#include "base/callback.hh"
#include "base/statistics.hh"
#include "enums/AddrMap.hh"
#include "enums/MemSched.hh"
@@ -409,6 +410,11 @@ class DRAMCtrl : public AbstractMemory
*/
void regStats();
+ /**
+ * Computes stats just prior to dump event
+ */
+ void computeStats();
+
void processActivateEvent();
EventWrapper<Rank, &Rank::processActivateEvent>
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
* the DRAM burst size. A system packet that is larger than the burst size