summaryrefslogtreecommitdiff
path: root/src/mem/dram_ctrl.hh
diff options
context:
space:
mode:
authorOmar Naji <Omar.Naji@arm.com>2014-07-29 17:22:44 +0100
committerOmar Naji <Omar.Naji@arm.com>2014-07-29 17:22:44 +0100
commitcd8023a1eebba79e60a62c5cd9bd0ec111d9d88c (patch)
treeae9845257cf7062e455f82910be4945254cc24fb /src/mem/dram_ctrl.hh
parentafc6ce62287a965320e1a85190913264c360e336 (diff)
downloadgem5-cd8023a1eebba79e60a62c5cd9bd0ec111d9d88c.tar.xz
mem: DRAMPower integration for on-line DRAM power stats
This patch takes the final step in integrating DRAMPower and adds the appropriate calls in the DRAM controller to provide the command trace and extract the power and energy stats. The debug printouts are still left in place, but will eventually be removed. At the moment the DRAM power calculation is always on when using the DRAM controller model. The run-time impact of this addition is around 1.5% when looking at the total host seconds of the regressions. We deem this a sensible trade-off to avoid the complication of adding an enable/disable mechanism.
Diffstat (limited to 'src/mem/dram_ctrl.hh')
-rw-r--r--src/mem/dram_ctrl.hh45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/mem/dram_ctrl.hh b/src/mem/dram_ctrl.hh
index cc2bd13fd..cb2197841 100644
--- a/src/mem/dram_ctrl.hh
+++ b/src/mem/dram_ctrl.hh
@@ -60,6 +60,7 @@
#include "mem/qport.hh"
#include "params/DRAMCtrl.hh"
#include "sim/eventq.hh"
+#include "mem/drampower.hh"
/**
* The DRAM controller is a single-channel memory controller capturing
@@ -677,6 +678,20 @@ class DRAMCtrl : public AbstractMemory
Stats::Formula pageHitRate;
Stats::Vector pwrStateTime;
+ //Command energies
+ Stats::Vector actEnergy;
+ Stats::Vector preEnergy;
+ Stats::Vector readEnergy;
+ Stats::Vector writeEnergy;
+ Stats::Vector refreshEnergy;
+ //Active Background Energy
+ Stats::Vector actBackEnergy;
+ //Precharge Background Energy
+ Stats::Vector preBackEnergy;
+ Stats::Vector totalEnergy;
+ //Power Consumed
+ Stats::Vector averagePower;
+
// Track when we transitioned to the current power state
Tick pwrStateTick;
@@ -686,12 +701,42 @@ class DRAMCtrl : public AbstractMemory
// Holds the value of the rank of burst issued
uint8_t activeRank;
+ // timestamp offset
+ uint64_t timeStampOffset;
+
/** @todo this is a temporary workaround until the 4-phase code is
* committed. upstream caches needs this packet until true is returned, so
* hold onto it for deletion until a subsequent call
*/
std::vector<PacketPtr> pendingDelete;
+ // One DRAMPower instance per rank
+ std::vector<DRAMPower> rankPower;
+
+ /**
+ * This function increments the energy when called. If stats are
+ * dumped periodically, note accumulated energy values will
+ * appear in the stats (even if the stats are reset). This is a
+ * result of the energy values coming from DRAMPower, and there
+ * is currently no support for resetting the state.
+ *
+ * @param rank Currrent rank
+ */
+ void updatePowerStats(uint8_t rank);
+
+ /**
+ * Function for sorting commands in the command list of DRAMPower.
+ *
+ * @param a Memory Command in command list of DRAMPower library
+ * @param next Memory Command in command list of DRAMPower
+ * @return true if timestamp of Command 1 < timestamp of Command 2
+ */
+ static bool sortTime(const Data::MemCommand& m1,
+ const Data::MemCommand& m2) {
+ return m1.getTime() < m2.getTime();
+ };
+
+
public:
void regStats();