summaryrefslogtreecommitdiff
path: root/src/mem/dram_ctrl.hh
diff options
context:
space:
mode:
authorRadhika Jagtap <radhika.jagtap@arm.com>2016-12-19 10:32:40 +0000
committerAndreas Sandberg <andreas.sandberg@arm.com>2017-11-16 16:39:19 +0000
commit290a7e7c5c059c1309ca3d02ea3158e2ca9ac338 (patch)
treef04a5c7aa0f5247d467e1bb8b2139d0e11baf532 /src/mem/dram_ctrl.hh
parent0757bef15d934b22555c396bcbcb91c0a1dffbe5 (diff)
downloadgem5-290a7e7c5c059c1309ca3d02ea3158e2ca9ac338.tar.xz
ext, mem: Pull DRAMPower SHA 90d6290 and rebase
This patch syncs the DRAMPower library of gem5 to the external github (https://github.com/ravenrd/DRAMPower). The version pulled in is the commit: 90d6290f802c29b3de9e10233ceee22290907ce6 from 30th Oct. 2016. This change also modifies the DRAM Ctrl interaction with the DRAMPower, due to changes in the lib API in the above version. Previously multiple functions were called to prepare the power lib before calling the function that would calculate the enery. With the new API, these functions are encompassed inside the function to calculate the energy and therefore should now be removed from the DRAM controller. The other key difference is the introduction of a new function called calcWindowEnergy which can be useful for any system that wants to do measurements over intervals. For gem5 DRAM ctrl that means we now need to accumulate the window energy measurements into the total stat. Change-Id: I3570fff2805962e166ff2a1a3217ebf2d5a197fb Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/5724 Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/mem/dram_ctrl.hh')
-rw-r--r--src/mem/dram_ctrl.hh52
1 files changed, 42 insertions, 10 deletions
diff --git a/src/mem/dram_ctrl.hh b/src/mem/dram_ctrl.hh
index 226897b7e..467cfe898 100644
--- a/src/mem/dram_ctrl.hh
+++ b/src/mem/dram_ctrl.hh
@@ -43,6 +43,7 @@
* Omar Naji
* Matthias Jung
* Wendy Elsasser
+ * Radhika Jagtap
*/
/**
@@ -472,15 +473,12 @@ class DRAMCtrl : public AbstractMemory
void suspend();
/**
- * Check if the current rank is available for scheduling.
- * Rank will be unavailable if refresh is ongoing.
- * This includes refresh events explicitly scheduled from the the
- * controller or memory initiated events which will occur during
- * self-refresh mode.
+ * Check if there is no refresh and no preparation of refresh ongoing
+ * i.e. the refresh state machine is in idle
*
* @param Return true if the rank is idle from a refresh point of view
*/
- bool isAvailable() const { return refreshState == REF_IDLE; }
+ bool inRefIdleState() const { return refreshState == REF_IDLE; }
/**
* Check if the current rank has all banks closed and is not
@@ -539,6 +537,11 @@ class DRAMCtrl : public AbstractMemory
void computeStats();
/**
+ * Reset stats on a stats event
+ */
+ void resetStats();
+
+ /**
* Schedule a transition to power-down (sleep)
*
* @param pwr_state Power state to transition to
@@ -575,10 +578,12 @@ 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.
+ /**
+ * Define the process to compute stats on a stats dump event, e.g. on
+ * simulation exit or intermediate stats dump. This is 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;
@@ -587,6 +592,30 @@ class DRAMCtrl : public AbstractMemory
virtual void process() { ranks->computeStats(); };
};
+ /** Define a process to clear power lib counters on a stats reset */
+ class RankResetCallback : public Callback
+ {
+ private:
+ /** Pointer to the rank, thus we instantiate per rank */
+ Rank *rank;
+
+ public:
+ RankResetCallback(Rank *r) : rank(r) {}
+ virtual void process() { rank->resetStats(); };
+ };
+
+ /** Define a process to store the time on a stats reset */
+ class MemResetCallback : public Callback
+ {
+ private:
+ /** A reference to the DRAMCtrl instance */
+ DRAMCtrl *mem;
+
+ public:
+ MemResetCallback(DRAMCtrl *_mem) : mem(_mem) {}
+ virtual void process() { mem->lastStatsResetTick = curTick(); };
+ };
+
/**
* 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
@@ -1039,6 +1068,9 @@ class DRAMCtrl : public AbstractMemory
// timestamp offset
uint64_t timeStampOffset;
+ /** The time when stats were last reset used to calculate average power */
+ Tick lastStatsResetTick;
+
/**
* Upstream caches need this packet until true is returned, so
* hold it for deletion until a subsequent call