diff --git a/DRAMSys/simulator/resources/simulations/sim-batch.xml b/DRAMSys/simulator/resources/simulations/sim-batch.xml
index 85e6dfce..a6b4d1d8 100644
--- a/DRAMSys/simulator/resources/simulations/sim-batch.xml
+++ b/DRAMSys/simulator/resources/simulations/sim-batch.xml
@@ -4,6 +4,8 @@
+
+
diff --git a/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp b/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp
index 3359dd6a..4959d5a7 100644
--- a/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp
+++ b/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp
@@ -136,6 +136,10 @@ void Configuration::setParameter(std::string name, std::string value)
DatabaseRecording = string2bool(value);
else if(name == "PowerAnalysis")
PowerAnalysis = string2bool(value);
+ else if (name == "PowerWindowSize")
+ PowerWindowSize = std::stod(value.c_str());
+ else if (name == "PowerWindowUnit")
+ PowerWindowUnit = string2TimeUnit(value);
else if(name == "Debug")
Debug = string2bool(value);
else if (name == "NumberOfTracePlayers")
diff --git a/DRAMSys/simulator/src/controller/core/configuration/Configuration.h b/DRAMSys/simulator/src/controller/core/configuration/Configuration.h
index bc867c6e..e6abb2ae 100644
--- a/DRAMSys/simulator/src/controller/core/configuration/Configuration.h
+++ b/DRAMSys/simulator/src/controller/core/configuration/Configuration.h
@@ -75,6 +75,8 @@ struct Configuration
//SimConfig
bool DatabaseRecording = true;
bool PowerAnalysis = false;
+ double PowerWindowSize;
+ enum sc_time_unit PowerWindowUnit;
bool Debug = false;
unsigned int NumberOfTracePlayers = 1;
unsigned int NumberOfMemChannels = 1;
diff --git a/DRAMSys/simulator/src/simulation/Dram.h b/DRAMSys/simulator/src/simulation/Dram.h
index 396af69f..ed5152b0 100644
--- a/DRAMSys/simulator/src/simulation/Dram.h
+++ b/DRAMSys/simulator/src/simulation/Dram.h
@@ -67,8 +67,10 @@ struct Dram : sc_module
// Power Model related
bool powerAnalysis = Configuration::getInstance().PowerAnalysis;
- sc_time windowSize = sc_time(1000,SC_NS); // TODO: this window size should be configurable by the config file
- libDRAMPower * DRAMPower;
+ double pWindowSize = Configuration::getInstance().PowerWindowSize;
+ enum sc_time_unit pWindowUnit = Configuration::getInstance().PowerWindowUnit;
+ sc_time powerWindowSize = sc_time(pWindowSize, pWindowUnit);
+ libDRAMPower *DRAMPower;
double totalEnergy = 0;
double sumOfEnergyWindows = 0;
@@ -168,7 +170,7 @@ struct Dram : sc_module
DRAMPower = new libDRAMPower( memSpec, 0 );
- // Create a thread that is triggered every $windowSize
+ // Create a thread that is triggered every $powerWindowSize
// to generate a Power over Time plot in the Trace analyzer:
SC_THREAD(powerWindow);
}
@@ -199,10 +201,10 @@ struct Dram : sc_module
// Calculate the residual power and energy which was not covered by previous windows...
printDebugMessage(string("\tCurrent Energy: \t") + to_string(DRAMPower->getEnergy().total_energy - totalEnergy));
- printDebugMessage(string("\tAverage Power: \t") + to_string((DRAMPower->getEnergy().total_energy - totalEnergy)/windowSize.value()));
+ printDebugMessage(string("\tAverage Power: \t") + to_string((DRAMPower->getEnergy().total_energy - totalEnergy)/powerWindowSize.value()));
double currentTotalEnergy = DRAMPower->getEnergy().total_energy - totalEnergy;
- double currentAveragePower = currentTotalEnergy/windowSize.value();
+ double currentAveragePower = currentTotalEnergy/powerWindowSize.value();
sumOfEnergyWindows += currentTotalEnergy;
tlmRecorder->recordPower(sc_time_stamp(),currentAveragePower);
totalEnergy = DRAMPower->getEnergy().total_energy;
@@ -222,7 +224,7 @@ struct Dram : sc_module
}
// This Thread is only triggered when Power Simulation is enabled.
- // It estimated the current average power which will be stored in the trace database for visualization purposes.
+ // It estimates the current average power which will be stored in the trace database for visualization purposes.
void powerWindow()
{
double currentAveragePower = 0;
@@ -233,15 +235,14 @@ struct Dram : sc_module
DRAMPower->updateCounters(false);
DRAMPower->calcEnergy();
currentTotalEnergy = DRAMPower->getEnergy().total_energy - totalEnergy;
- currentAveragePower = currentTotalEnergy/windowSize.value();
- // TODO: Store $currentAveragePower in the trace database.
+ currentAveragePower = currentTotalEnergy/powerWindowSize.value();
tlmRecorder->recordPower(sc_time_stamp(),currentAveragePower);
totalEnergy = DRAMPower->getEnergy().total_energy;
sumOfEnergyWindows += currentTotalEnergy;
printDebugMessage(string("\tCurrent Energy: \t") + to_string(currentTotalEnergy));
printDebugMessage(string("\tAverage Power: \t") + to_string(currentAveragePower));
- wait(windowSize);
+ wait(powerWindowSize);
}
while(true);
diff --git a/README.md b/README.md
index 74f08b5f..3a386c6e 100644
--- a/README.md
+++ b/README.md
@@ -308,6 +308,8 @@ The DRAMSys' main configuration file is presented below.
+
+
@@ -406,6 +408,8 @@ The XML code below shows a typic configuration:
+
+
@@ -517,6 +521,15 @@ Below are listed the configuration sections and configuration fields.
- *PowerAnalysis* (boolean)
- "1": enables live power analysis with the DRAMPower tool
- "0": disables power analysis
+ - *PowerWindowSize* (double)
+ - Size of the time window used to evaluate averate power consumption
+ - *PowerWindowUnit* (string)
+ - "s": seconds
+ - "ms": millisecond
+ - "us": microseconds
+ - "ns": nanoseconds
+ - "ps": picoseconds
+ - "fs": femtoseconds
- *NumberOfTracePlayers* (unsigned int)
- Number of trace players
- *NumberOfMemChannels* (unsigned int)