Power over time
This commit is contained in:
@@ -17,9 +17,9 @@ def plot(function):
|
||||
def memory_utilisation_window(connection, tracePath):
|
||||
# This function determines the average memory bandwidth over time in percentage and in Gbit/s.
|
||||
# The average bandwidth over time is done dividing the time into windows of the same length and getting the average bandwidth in each window.
|
||||
# Through the data from the database, DataStrobeEnd and DataStrobeBegin, it is possible to assess when a data transfer begins or ends.
|
||||
# Hence, it is possible to ckeck when a data transfer happens and if it occupies or is inside a time window. Then, it is possible to determine the average bandwidth in percentage.
|
||||
# Besides, extracting the data from the memory specs, it is possible to calculate the maximum data rate of the memory and then determine the bandwidth in Gbit/s.
|
||||
# Through data from the database, DataStrobeEnd and DataStrobeBegin, it is possible to assess when a data transfer begins or ends.
|
||||
# Hence, it is achievable to ckeck when a data transfer happens and if it occupies or is inside a time window. Then, it is attainable to determine the average bandwidth in percentage.
|
||||
# Besides, extracting the data from the memory specs, it is feasible to calculate the maximum data rate of the memory and then determine the bandwidth in Gbit/s.
|
||||
# The bandwidth data are then plotted in two graphics.
|
||||
|
||||
steps = 1000
|
||||
@@ -28,7 +28,7 @@ def memory_utilisation_window(connection, tracePath):
|
||||
total = cursor.fetchone()
|
||||
windowSize = ceil(float(total[0])/float(steps))
|
||||
if (windowSize == 0):
|
||||
windowSize = 1
|
||||
windowSize = 1
|
||||
# print(steps)
|
||||
# All possible cases of data transfers inside a time window
|
||||
queryFull = """ SELECT sum(DataStrobeEnd - DataStrobeBegin) FROM transactions Where DataStrobeBegin > ? and DataStrobeEnd < ?""" # The data transfer begins and ends inside the time window
|
||||
@@ -101,6 +101,7 @@ def memory_utilisation_window(connection, tracePath):
|
||||
pdf = PdfPages(OUTPUT_FILE)
|
||||
pdf.savefig()
|
||||
pdf.close()
|
||||
return
|
||||
|
||||
|
||||
# @plot
|
||||
@@ -117,7 +118,7 @@ def memory_utilisation_window(connection, tracePath):
|
||||
# return "Saved as hist.png"
|
||||
|
||||
|
||||
def generatePlots(pathToTrace):
|
||||
def generatePlots(pathToTrace):
|
||||
connection = sqlite3.connect(pathToTrace)
|
||||
|
||||
print("================================")
|
||||
|
||||
@@ -67,7 +67,10 @@ struct Dram : sc_module
|
||||
|
||||
// Power Model related
|
||||
bool powerAnalysis = Configuration::getInstance().PowerAnalysis;
|
||||
sc_time windowSize = sc_time(1000,SC_NS);
|
||||
libDRAMPower * DRAMPower;
|
||||
double totalEnergy = 0;
|
||||
|
||||
|
||||
// Error Model related:
|
||||
ErrorStorageMode ErrorStoreMode = Configuration::getInstance().ErrorStoreMode;
|
||||
@@ -86,7 +89,7 @@ struct Dram : sc_module
|
||||
if(powerAnalysis == true)
|
||||
{
|
||||
sc_time clk = Configuration::getInstance().memSpec.clk;
|
||||
|
||||
|
||||
MemArchitectureSpec memArchSpec;
|
||||
memArchSpec.burstLength = Configuration::getInstance().memSpec.BurstLength;
|
||||
memArchSpec.dataRate = Configuration::getInstance().memSpec.DataRate;
|
||||
@@ -164,6 +167,7 @@ struct Dram : sc_module
|
||||
memSpec.memArchSpec = memArchSpec;
|
||||
|
||||
DRAMPower = new libDRAMPower( memSpec, 0 );
|
||||
SC_THREAD(window);
|
||||
}
|
||||
|
||||
printDebugMessage(string("ErrorStorageMode: ") + EnumToString(ErrorStoreMode));
|
||||
@@ -189,8 +193,10 @@ struct Dram : sc_module
|
||||
{
|
||||
DRAMPower->updateCounters(true);
|
||||
DRAMPower->calcEnergy();
|
||||
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()));
|
||||
cout << name() << string("\tTotal Energy: \t") + to_string(DRAMPower->getEnergy().total_energy) << endl;
|
||||
cout << name() << string("\tAverage Power: \t") + to_string(DRAMPower->getPower().average_power) << endl;
|
||||
cout << name() << string("\tAverage Power: \t") + to_string(DRAMPower->getPower().average_power) << endl;
|
||||
}
|
||||
// Clean up:
|
||||
for (auto e : ememory) {
|
||||
@@ -198,6 +204,27 @@ struct Dram : sc_module
|
||||
}
|
||||
//std::cout << "Simulated Memory Size: " << memory.size() << endl; // TODO Aufrauemen
|
||||
}
|
||||
|
||||
void window()
|
||||
{
|
||||
double currentAveragePower = 0;
|
||||
double currentTotalEnergy = 0;
|
||||
|
||||
do
|
||||
{
|
||||
DRAMPower->updateCounters(false);
|
||||
DRAMPower->calcEnergy();
|
||||
currentTotalEnergy = DRAMPower->getEnergy().total_energy - totalEnergy;
|
||||
currentAveragePower = currentTotalEnergy/windowSize.value();
|
||||
totalEnergy = DRAMPower->getEnergy().total_energy;
|
||||
|
||||
printDebugMessage(string("\tCurrent Energy: \t") + to_string(currentTotalEnergy));
|
||||
printDebugMessage(string("\tAverage Power: \t") + to_string(currentAveragePower));
|
||||
wait(windowSize);
|
||||
}
|
||||
while(true);
|
||||
|
||||
}
|
||||
|
||||
virtual tlm::tlm_sync_enum nb_transport_fw(tlm::tlm_generic_payload& payload, tlm::tlm_phase& phase, sc_time& delay)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user