diff options
author | Radhika Jagtap <radhika.jagtap@arm.com> | 2016-12-19 10:32:40 +0000 |
---|---|---|
committer | Andreas Sandberg <andreas.sandberg@arm.com> | 2017-11-16 16:39:19 +0000 |
commit | 290a7e7c5c059c1309ca3d02ea3158e2ca9ac338 (patch) | |
tree | f04a5c7aa0f5247d467e1bb8b2139d0e11baf532 /ext/drampower/src/libdrampower | |
parent | 0757bef15d934b22555c396bcbcb91c0a1dffbe5 (diff) | |
download | gem5-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 'ext/drampower/src/libdrampower')
-rw-r--r-- | ext/drampower/src/libdrampower/LibDRAMPower.cc | 37 | ||||
-rw-r--r-- | ext/drampower/src/libdrampower/LibDRAMPower.h | 25 |
2 files changed, 49 insertions, 13 deletions
diff --git a/ext/drampower/src/libdrampower/LibDRAMPower.cc b/ext/drampower/src/libdrampower/LibDRAMPower.cc index 47ed15a99..65eedacb5 100644 --- a/ext/drampower/src/libdrampower/LibDRAMPower.cc +++ b/ext/drampower/src/libdrampower/LibDRAMPower.cc @@ -31,7 +31,11 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Authors: Matthias Jung, Omar Naji + * Authors: Matthias Jung + * Omar Naji + * Subash Kannoth + * Éder F. Zulian + * Felipe S. Prado * */ @@ -41,8 +45,19 @@ using namespace Data; libDRAMPower::libDRAMPower(const MemorySpecification& memSpec, bool includeIoAndTermination) : memSpec(memSpec), - counters(CommandAnalysis(memSpec.memArchSpec.nbrOfBanks)), - includeIoAndTermination(includeIoAndTermination) + counters(memSpec), + includeIoAndTermination(includeIoAndTermination), + mpm(MemoryPowerModel()) +{ + MemBankWiseParams p (100,100,false,0,false,static_cast<unsigned>(memSpec.memArchSpec.nbrOfBanks)); + libDRAMPower DRAMPower = libDRAMPower(memSpec, 0, p); +} + +libDRAMPower::libDRAMPower(const MemorySpecification& memSpec, bool includeIoAndTermination, const Data::MemBankWiseParams& bwPowerParams) : + memSpec(memSpec), + counters(CommandAnalysis(memSpec)), + includeIoAndTermination(includeIoAndTermination), + bwPowerParams(bwPowerParams) { } @@ -56,17 +71,27 @@ void libDRAMPower::doCommand(MemCommand::cmds type, int bank, int64_t timestamp) cmdList.push_back(cmd); } -void libDRAMPower::updateCounters(bool lastUpdate) +void libDRAMPower::updateCounters(bool lastUpdate, int64_t timestamp) { - counters.getCommands(memSpec, cmdList, lastUpdate); + counters.getCommands(cmdList, lastUpdate, timestamp); cmdList.clear(); } void libDRAMPower::calcEnergy() { - mpm.power_calc(memSpec, counters, includeIoAndTermination); + updateCounters(true); + mpm.power_calc(memSpec, counters, includeIoAndTermination, bwPowerParams); } +void libDRAMPower::calcWindowEnergy(int64_t timestamp) +{ + doCommand(MemCommand::NOP, 0, timestamp); + updateCounters(false, timestamp); + mpm.power_calc(memSpec, counters, includeIoAndTermination, bwPowerParams); + clearCounters(timestamp); +} + + void libDRAMPower::clearState() { counters.clear(); diff --git a/ext/drampower/src/libdrampower/LibDRAMPower.h b/ext/drampower/src/libdrampower/LibDRAMPower.h index 4d9ccefe5..46e14bdd3 100644 --- a/ext/drampower/src/libdrampower/LibDRAMPower.h +++ b/ext/drampower/src/libdrampower/LibDRAMPower.h @@ -31,7 +31,11 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Authors: Matthias Jung, Omar Naji + * Authors: Matthias Jung + * Omar Naji + * Subash Kannoth + * Éder F. Zulian + * Felipe S. Prado * */ @@ -44,35 +48,42 @@ #include "CommandAnalysis.h" #include "MemoryPowerModel.h" #include "MemCommand.h" +#include "MemBankWiseParams.h" + class libDRAMPower { public: libDRAMPower(const Data::MemorySpecification& memSpec, bool includeIoAndTermination); + libDRAMPower(const Data::MemorySpecification& memSpec, bool includeIoAndTermination,const Data::MemBankWiseParams& bwPowerParams); ~libDRAMPower(); void doCommand(Data::MemCommand::cmds type, int bank, int64_t timestamp); - void updateCounters(bool lastUpdate); - - void clearCounters(int64_t timestamp); - - void clearState(); - void calcEnergy(); + void calcWindowEnergy(int64_t timestamp); + const Data::MemoryPowerModel::Energy& getEnergy() const; const Data::MemoryPowerModel::Power& getPower() const; // list of all commands std::vector<Data::MemCommand> cmdList; private: + void updateCounters(bool lastUpdate, int64_t timestamp = 0); + + void clearCounters(int64_t timestamp); + + void clearState(); + Data::MemorySpecification memSpec; public: Data::CommandAnalysis counters; private: bool includeIoAndTermination; + bool bankwiseMode; + Data:: MemBankWiseParams bwPowerParams; // Object of MemoryPowerModel which contains the results // Energies(pJ) stored in energy, Powers(mW) stored in power. Number of // each command stored in timings. |