Choose the number of samples instead of the size of the time window
This commit is contained in:
@@ -4,8 +4,7 @@
|
||||
<Debug value="0" />
|
||||
<DatabaseRecording value="1" />
|
||||
<PowerAnalysis value="1" />
|
||||
<PowerWindowSize value="1000" />
|
||||
<PowerWindowUnit value="ns" />
|
||||
<NumberOfTimeWindows value="1000" />
|
||||
<NumberOfTracePlayers value="1"/>
|
||||
<NumberOfMemChannels value="1"/>
|
||||
<ControllerCoreDisableRefresh value="0"/>
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
<Debug value="0" />
|
||||
<DatabaseRecording value="1" />
|
||||
<PowerAnalysis value="1" />
|
||||
<PowerWindowSize value="1000" />
|
||||
<PowerWindowUnit value="ns" />
|
||||
<NumberOfTimeWindows value="1000" />
|
||||
<NumberOfTracePlayers value="1"/>
|
||||
<NumberOfMemChannels value="4"/>
|
||||
<ControllerCoreDisableRefresh value="0"/>
|
||||
|
||||
@@ -136,25 +136,28 @@ 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 == "NumberOfTimeWindows") {
|
||||
if(string2int(value) < 1) {
|
||||
SC_REPORT_FATAL("Configuration", ("Invalid value for parameter " + name + ". This parameter must be at least one.").c_str());
|
||||
throw;
|
||||
}
|
||||
NumberOfTimeWindows = string2int(value);
|
||||
}
|
||||
else if(name == "Debug")
|
||||
Debug = string2bool(value);
|
||||
else if (name == "NumberOfTracePlayers")
|
||||
NumberOfTracePlayers = string2int(value);
|
||||
else if (name == "NumberOfMemChannels") {
|
||||
NumberOfMemChannels = string2int(value);
|
||||
unsigned int maxNumberofMemChannels = xmlAddressDecoder::getInstance().amount["channel"];
|
||||
if (NumberOfMemChannels > maxNumberofMemChannels) {
|
||||
unsigned int maxNumberofMemChannels = xmlAddressDecoder::getInstance().amount["channel"];
|
||||
if (NumberOfMemChannels > maxNumberofMemChannels) {
|
||||
SC_REPORT_FATAL("Configuration", ("Invalid value for parameter "
|
||||
+ name
|
||||
+ ". Value is out of range. The maximum value according to "
|
||||
+ "the address mapping configuration file is "
|
||||
+ std::to_string(maxNumberofMemChannels) + ".").c_str());
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (name == "ControllerCoreDisableRefresh")
|
||||
ControllerCoreDisableRefresh = string2bool(value);
|
||||
|
||||
@@ -75,8 +75,8 @@ struct Configuration
|
||||
//SimConfig
|
||||
bool DatabaseRecording = true;
|
||||
bool PowerAnalysis = false;
|
||||
double PowerWindowSize;
|
||||
enum sc_time_unit PowerWindowUnit;
|
||||
sc_time TraceLength;
|
||||
unsigned int NumberOfTimeWindows;
|
||||
bool Debug = false;
|
||||
unsigned int NumberOfTracePlayers = 1;
|
||||
unsigned int NumberOfMemChannels = 1;
|
||||
|
||||
@@ -67,9 +67,7 @@ struct Dram : sc_module
|
||||
|
||||
// Power Model related
|
||||
bool powerAnalysis = Configuration::getInstance().PowerAnalysis;
|
||||
double pWindowSize = Configuration::getInstance().PowerWindowSize;
|
||||
enum sc_time_unit pWindowUnit = Configuration::getInstance().PowerWindowUnit;
|
||||
sc_time powerWindowSize = sc_time(pWindowSize, pWindowUnit);
|
||||
sc_time powerWindowSize = Configuration::getInstance().TraceLength/Configuration::getInstance().NumberOfTimeWindows;
|
||||
libDRAMPower *DRAMPower;
|
||||
double totalEnergy = 0;
|
||||
double sumOfEnergyWindows = 0;
|
||||
@@ -230,10 +228,10 @@ struct Dram : sc_module
|
||||
double currentAveragePower = 0;
|
||||
double currentTotalEnergy = 0;
|
||||
|
||||
do
|
||||
{
|
||||
do {
|
||||
DRAMPower->updateCounters(false);
|
||||
DRAMPower->calcEnergy();
|
||||
|
||||
currentTotalEnergy = DRAMPower->getEnergy().total_energy - totalEnergy;
|
||||
currentAveragePower = currentTotalEnergy/powerWindowSize.value();
|
||||
tlmRecorder->recordPower(sc_time_stamp(),currentAveragePower);
|
||||
|
||||
@@ -121,11 +121,15 @@ void Simulation::instantiateModules(const string &traceName, const string &pathT
|
||||
// or if you simply dont care about the data the normal StlPlayer is used.
|
||||
if(Configuration::getInstance().ErrorStoreMode == ErrorStorageMode::NoStorage)
|
||||
{
|
||||
player = new StlPlayer<>(playerStr.c_str(), pathToResources + string("traces/") + devices[i].trace, devices[i].clkMhz, this);
|
||||
StlPlayer<> *newPlayer = new StlPlayer<>(playerStr.c_str(), pathToResources + string("traces/") + devices[i].trace, devices[i].clkMhz, this);
|
||||
player = newPlayer;
|
||||
newPlayer->getTraceLength(pathToResources + string("traces/") + devices[i].trace);
|
||||
}
|
||||
else
|
||||
{
|
||||
player = new StlDataPlayer<>(playerStr.c_str(), pathToResources + string("traces/") + devices[i].trace, devices[i].clkMhz, this);
|
||||
StlDataPlayer<> *newPlayer = new StlDataPlayer<>(playerStr.c_str(), pathToResources + string("traces/") + devices[i].trace, devices[i].clkMhz, this);
|
||||
player = newPlayer;
|
||||
newPlayer->getTraceLength(pathToResources + string("traces/") + devices[i].trace);
|
||||
}
|
||||
players.push_back(player);
|
||||
}
|
||||
@@ -177,7 +181,7 @@ Simulation::~Simulation()
|
||||
}
|
||||
|
||||
for (auto rec : tlmRecorders) {
|
||||
delete rec;
|
||||
delete rec;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +193,7 @@ void Simulation::start()
|
||||
report(" -> memspec: \t\t" + Configuration::getInstance().memSpec.MemoryId);
|
||||
cout << endl;
|
||||
simulationStartTime = clock();
|
||||
|
||||
|
||||
for (auto player : players) {
|
||||
player->nextPayload();
|
||||
}
|
||||
|
||||
@@ -134,6 +134,50 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void getTraceLength(string pathToTrace)
|
||||
{
|
||||
ifstream newFile;
|
||||
newFile.open(pathToTrace);
|
||||
if(newFile.is_open()) {
|
||||
newFile.seekg(-1,ios_base::end);// go to one spot before the EOF
|
||||
char ch;
|
||||
newFile.get(ch);
|
||||
|
||||
if(ch == file.eof())
|
||||
SC_REPORT_FATAL(0, (string("Empty Trace ") + pathToTrace).c_str());
|
||||
|
||||
if(ch == '\n')
|
||||
newFile.seekg(-2,ios_base::end);
|
||||
|
||||
bool keepLooping = true;
|
||||
while(keepLooping) {
|
||||
|
||||
newFile.get(ch); // Get current byte's data
|
||||
|
||||
if((int)newFile.tellg() <= 1) { // If the data was at or before the 0th byte
|
||||
newFile.seekg(0); // The first line is the last line
|
||||
keepLooping = false; // So stop there
|
||||
}
|
||||
else if(ch == '\n') { // If the data was a newline
|
||||
keepLooping = false; // Stop at the current position.
|
||||
}
|
||||
else { // If the data was neither a newline nor at the 0 byte
|
||||
newFile.seekg(-2,ios_base::cur); // Move to the front of that data, then to the front of the data before it
|
||||
}
|
||||
}
|
||||
|
||||
string lastLine;
|
||||
getline(newFile,lastLine); // Read the current line
|
||||
std::istringstream iss(lastLine);
|
||||
string time;
|
||||
iss >> time;
|
||||
Configuration::getInstance().TraceLength = std::stoull(time.c_str())*clk;
|
||||
newFile.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
ifstream file;
|
||||
unsigned int burstlength;
|
||||
|
||||
@@ -120,6 +120,52 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void getTraceLength(string pathToTrace)
|
||||
{
|
||||
ifstream newFile;
|
||||
newFile.open(pathToTrace);
|
||||
if(newFile.is_open()) {
|
||||
newFile.seekg(-1,ios_base::end);// go to one spot before the EOF
|
||||
char ch;
|
||||
newFile.get(ch);
|
||||
|
||||
if(ch == file.eof())
|
||||
SC_REPORT_FATAL(0, (string("Empty Trace ") + pathToTrace).c_str());
|
||||
|
||||
if(ch == '\n')
|
||||
newFile.seekg(-2,ios_base::end);
|
||||
|
||||
bool keepLooping = true;
|
||||
while(keepLooping) {
|
||||
|
||||
newFile.get(ch); // Get current byte's data
|
||||
|
||||
if((int)newFile.tellg() <= 1) { // If the data was at or before the 0th byte
|
||||
newFile.seekg(0); // The first line is the last line
|
||||
keepLooping = false; // So stop there
|
||||
}
|
||||
else if(ch == '\n') { // If the data was a newline
|
||||
keepLooping = false; // Stop at the current position.
|
||||
}
|
||||
else { // If the data was neither a newline nor at the 0 byte
|
||||
newFile.seekg(-2,ios_base::cur); // Move to the front of that data, then to the front of the data before it
|
||||
}
|
||||
}
|
||||
|
||||
string lastLine;
|
||||
getline(newFile,lastLine); // Read the current line
|
||||
std::istringstream iss(lastLine);
|
||||
string time;
|
||||
iss >> time;
|
||||
Configuration::getInstance().TraceLength = std::stoull(time.c_str())*clk;
|
||||
newFile.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
ifstream file;
|
||||
unsigned int burstlength;
|
||||
|
||||
17
README.md
17
README.md
@@ -319,8 +319,7 @@ The DRAMSys' main configuration file is presented below.
|
||||
<Debug value="1" />
|
||||
<DatabaseRecording value="1" />
|
||||
<PowerAnalysis value="1" />
|
||||
<PowerWindowSize value="1000" />
|
||||
<PowerWindowUnit value="ns" />
|
||||
<NumberOfTimeWindows value="1000" />
|
||||
<NumberOfTracePlayers value="1"/>
|
||||
<NumberOfMemChannels value="4"/>
|
||||
<ControllerCoreDisableRefresh value="0"/>
|
||||
@@ -419,8 +418,7 @@ The XML code below shows a typic configuration:
|
||||
<Debug value="1"/>
|
||||
<DatabaseRecording value="1"/>
|
||||
<PowerAnalysis value="1"/>
|
||||
<PowerWindowSize value="1000" />
|
||||
<PowerWindowUnit value="ns" />
|
||||
<NumberOfTimeWindows value="1000" />
|
||||
<NumberOfTracePlayers value="5"/>
|
||||
<NumberOfMemChannels value="1"/>
|
||||
<ControllerCoreDisableRefresh value="0"/>
|
||||
@@ -532,15 +530,8 @@ 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
|
||||
- *NumberOfTimeWindows* (int)
|
||||
- number of time windows used to evaluate average bandwidth and average power consumption
|
||||
- *NumberOfTracePlayers* (unsigned int)
|
||||
- Number of trace players
|
||||
- *NumberOfMemChannels* (unsigned int)
|
||||
|
||||
Reference in New Issue
Block a user