diff --git a/DRAMSys/analyzer/businessObjects/generalinfo.h b/DRAMSys/analyzer/businessObjects/generalinfo.h index 46b6b3ee..723d2828 100644 --- a/DRAMSys/analyzer/businessObjects/generalinfo.h +++ b/DRAMSys/analyzer/businessObjects/generalinfo.h @@ -49,11 +49,11 @@ struct GeneralInfo QString description; QString unitOfTime; unsigned int clkPeriod; - unsigned long long timeWindowSize; + unsigned int windowSize; public: - GeneralInfo(unsigned int numberOfTransactions,unsigned int numberOfPhases,Timespan span,unsigned int numberOfBanks,const QString& description, QString unitOfTime,unsigned int clkPeriod, unsigned long long timeWindowSize) : - numberOfTransactions(numberOfTransactions) , numberOfPhases(numberOfPhases),span(span), numberOfBanks(numberOfBanks), description(description), unitOfTime(unitOfTime), clkPeriod(clkPeriod), timeWindowSize(timeWindowSize) + GeneralInfo(unsigned int numberOfTransactions,unsigned int numberOfPhases,Timespan span,unsigned int numberOfBanks,const QString& description, QString unitOfTime,unsigned int clkPeriod, unsigned int windowSize) : + numberOfTransactions(numberOfTransactions) , numberOfPhases(numberOfPhases),span(span), numberOfBanks(numberOfBanks), description(description), unitOfTime(unitOfTime), clkPeriod(clkPeriod), windowSize(windowSize) { } diff --git a/DRAMSys/analyzer/businessObjects/pythoncaller.cpp b/DRAMSys/analyzer/businessObjects/pythoncaller.cpp index 79044799..2ca89d5b 100644 --- a/DRAMSys/analyzer/businessObjects/pythoncaller.cpp +++ b/DRAMSys/analyzer/businessObjects/pythoncaller.cpp @@ -33,6 +33,7 @@ * Janik Schlemminger * Robert Gernhardt * Matthias Jung + * Felipe S. Prado */ #include "pythoncaller.h" diff --git a/DRAMSys/analyzer/businessObjects/pythoncaller.h b/DRAMSys/analyzer/businessObjects/pythoncaller.h index 72a3302c..9e58f13a 100644 --- a/DRAMSys/analyzer/businessObjects/pythoncaller.h +++ b/DRAMSys/analyzer/businessObjects/pythoncaller.h @@ -33,6 +33,7 @@ * Janik Schlemminger * Robert Gernhardt * Matthias Jung + * Felipe S. Prado */ #ifndef PYTHONCALLER_H diff --git a/DRAMSys/analyzer/data/tracedb.cpp b/DRAMSys/analyzer/data/tracedb.cpp index 115dc46a..e56ece6e 100644 --- a/DRAMSys/analyzer/data/tracedb.cpp +++ b/DRAMSys/analyzer/data/tracedb.cpp @@ -199,7 +199,7 @@ ID TraceDB::getTransactionIDFromPhaseID(ID phaseID) GeneralInfo TraceDB::getGeneralInfoFromDB() { QSqlQuery query(database); - query.prepare("SELECT NumberOfTransactions,TraceEnd,NumberOfBanks,Clk,UnitOfTime,Traces,Memspec,Memconfig,TimeWindowSize FROM GeneralInfo"); + query.prepare("SELECT NumberOfTransactions,TraceEnd,NumberOfBanks,Clk,UnitOfTime,Traces,Memspec,Memconfig, WindowSize FROM GeneralInfo"); executeQuery(query); if(query.next()) @@ -214,7 +214,7 @@ GeneralInfo TraceDB::getGeneralInfoFromDB() QString traces = "Traces: " + query.value(5).toString(); QString memspec = "Memspec: " + query.value(6).toString(); QString memconfig = "Memconfig: " + query.value(7).toString(); - unsigned long long timeWindowSize = query.value(8).toLongLong(); + unsigned int windowSize = query.value(8).toInt(); QString description = (traces + "\n"); description += memconfig + "\n"; @@ -222,9 +222,9 @@ GeneralInfo TraceDB::getGeneralInfoFromDB() description += "Number of Transactions: " + QString::number(numberOfTransactions) + "\n"; description += "Clock period: " + QString::number(clkPeriod) + " " + unitOfTime + "\n"; description += "Length of trace: " + prettyFormatTime(traceEnd) + "\n"; - description += "Time windows size: " + prettyFormatTime(timeWindowSize); + description += "Window size:" + QString::number(windowSize) + "\n"; - return GeneralInfo(numberOfTransactions, numberOfPhases, Timespan(0,traceEnd),numberOfBanks,description,unitOfTime,clkPeriod,timeWindowSize); + return GeneralInfo(numberOfTransactions, numberOfPhases, Timespan(0,traceEnd),numberOfBanks,description,unitOfTime,clkPeriod, windowSize); } else { diff --git a/DRAMSys/analyzer/evaluationtool.cpp b/DRAMSys/analyzer/evaluationtool.cpp index 5e15b70a..1f778a77 100644 --- a/DRAMSys/analyzer/evaluationtool.cpp +++ b/DRAMSys/analyzer/evaluationtool.cpp @@ -34,6 +34,7 @@ * Robert Gernhardt * Matthias Jung * Éder F. Zulian + * Felipe S. Prado */ #include diff --git a/DRAMSys/analyzer/evaluationtool.h b/DRAMSys/analyzer/evaluationtool.h index 92205c95..496d438a 100644 --- a/DRAMSys/analyzer/evaluationtool.h +++ b/DRAMSys/analyzer/evaluationtool.h @@ -34,6 +34,7 @@ * Robert Gernhardt * Matthias Jung * Éder F. Zulian + * Felipe S. Prado */ #ifndef EVALUATIONTOOL_H diff --git a/DRAMSys/analyzer/presentation/tracemetrictreewidget.cpp b/DRAMSys/analyzer/presentation/tracemetrictreewidget.cpp index 35db2061..96674fc0 100644 --- a/DRAMSys/analyzer/presentation/tracemetrictreewidget.cpp +++ b/DRAMSys/analyzer/presentation/tracemetrictreewidget.cpp @@ -33,6 +33,7 @@ * Janik Schlemminger * Robert Gernhardt * Matthias Jung + * Felipe S. Prado */ #include "tracemetrictreewidget.h" diff --git a/DRAMSys/analyzer/presentation/tracemetrictreewidget.h b/DRAMSys/analyzer/presentation/tracemetrictreewidget.h index 5a0821db..859c5ef9 100644 --- a/DRAMSys/analyzer/presentation/tracemetrictreewidget.h +++ b/DRAMSys/analyzer/presentation/tracemetrictreewidget.h @@ -33,6 +33,7 @@ * Janik Schlemminger * Robert Gernhardt * Matthias Jung + * Felipe S. Prado */ #ifndef TRACEMETRICTREEWIDGET_H diff --git a/DRAMSys/analyzer/scripts/metrics.py b/DRAMSys/analyzer/scripts/metrics.py index 92ad2a99..2fd81b8e 100644 --- a/DRAMSys/analyzer/scripts/metrics.py +++ b/DRAMSys/analyzer/scripts/metrics.py @@ -235,7 +235,7 @@ def bank_overlap_ratio(connection): cursor.execute(""" select p1.PhaseBegin, p1.PhaseName from Phases p1 where - (p1.PhaseName = "ACT" or p1.PhaseName = "PRE_ALL" or p1.PhaseName = "PRE") + (p1.PhaseName = "ACT" or p1.PhaseName = "PRE_ALL" or p1.PhaseName = "PRE" or p1.PhaseName = "RDA" or p1.PhaseName = "WRA") order by PhaseBegin """) prevPhase = "PRE_ALL" @@ -267,6 +267,10 @@ def bank_overlap_ratio(connection): bankCounter = 0 elif(t[1] == "PRE"): bankCounter -= 1 + elif(t[1] == "WRA"): + bankCounter -= 1 + elif(t[1] == "RDA"): + bankCounter -= 1 else: print ("ERROR") return 0 diff --git a/DRAMSys/analyzer/scripts/plots.py b/DRAMSys/analyzer/scripts/plots.py index 3f21394c..f953c4f4 100755 --- a/DRAMSys/analyzer/scripts/plots.py +++ b/DRAMSys/analyzer/scripts/plots.py @@ -14,7 +14,7 @@ def plot(function): @plot -def memory_utilisation_window(connection, tracePath): +def memory_utilisation_window(connection, tracePath, steps): # 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 data from the database, DataStrobeEnd and DataStrobeBegin, it is possible to assess when a data transfer begins or ends. @@ -23,11 +23,8 @@ def memory_utilisation_window(connection, tracePath): # The bandwidth data are then plotted in two graphics. cursor = connection.cursor() - cursor.execute("SELECT TimeWindowSize FROM generalInfo") - windowSize = cursor.fetchone()[0] - cursor.execute("SELECT TraceEnd FROM generalInfo") - traceEnd = cursor.fetchone()[0] - steps = ceil(float(traceEnd)/float(windowSize)) + cursor.execute(" SELECT WindowSize FROM GeneralInfo ") + windowSize = float(cursor.fetchone()[0]) # 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 queryEnd = """ SELECT sum(DataStrobeEnd - ?) FROM transactions Where DataStrobeBegin < ? and DataStrobeEnd > ? and DataStrobeEnd <=?""" # Only the end of the data transfer is inside the time window @@ -67,7 +64,6 @@ def memory_utilisation_window(connection, tracePath): name = ntpath.basename(tracePath) basename, extension = os.path.splitext(name) - outputFile = "" OUTPUT_FILE = 'memory_utilization_' + basename + '.pdf' outputFile = "Output file is {0}".format(OUTPUT_FILE) @@ -76,23 +72,25 @@ def memory_utilisation_window(connection, tracePath): import numpy as np from matplotlib.backends.backend_pdf import PdfPages - time = np.arange(0, (steps+1)*windowSize, windowSize) + #windowSize/1000: picoseconds to nanoseconds conversion + time = np.arange(0, (steps+1)*windowSize/1000, windowSize/1000) plt.figure() subplotIndex = 211 plt.subplot(subplotIndex) - plt.plot(time/1000, bandwidthPercentage) + plt.plot(time, bandwidthPercentage) plt.xlabel('Time (ns)') plt.ylabel('Bandwidth (%)') - plt.ylim(0, maximumPercentage + (10 - maximumPercentage%10)) + plt.ylim(-1, maximumPercentage + (10 - maximumPercentage%10)) plt.grid(True) subplotIndex += 1 plt.subplot(subplotIndex) - plt.plot(time/1000, bandwidth) + plt.plot(time, bandwidth) plt.xlabel('Time (ns)') plt.ylabel('Bandwidth (Gibit/s)') + plt.ylim((-0.01)*float(maxDataRate)/1024, ((maximumPercentage + (10 - maximumPercentage%10))/100)*float(maxDataRate)/1024) plt.grid(True) pdf = PdfPages(OUTPUT_FILE) @@ -103,26 +101,24 @@ def memory_utilisation_window(connection, tracePath): @plot -def power_window(connection, tracePath): - cursor = connection.cursor() - cursor.execute(""" SELECT time FROM Power """) +def power_window(connection, tracePath, steps): outputFile = "" - if(cursor.fetchone() is not None): - cursor.execute("SELECT TimeWindowSize FROM generalInfo") - windowSize = cursor.fetchone()[0] - cursor.execute("SELECT TraceEnd FROM generalInfo") - traceEnd = cursor.fetchone()[0] - steps = ceil(float(traceEnd)/float(windowSize)) - cursor.execute(""" SELECT * FROM Power """) + cursor = connection.cursor() + cursor.execute(" SELECT * FROM Power") + result = cursor.fetchone() + if(result is not None): time = [0] * (steps+1) power = [0] * (steps+1) time[0] = 0 power[0] = 0 - for i in range((steps)): - result = cursor.fetchone() - time[i+1] = float(result[0])*1000000000 - power[i+1] = float(result[1]) + #pow(10,9): seconds to nanoseconds conversion + time[1] = float(result[0])*pow(10,9) + power[1] = float(result[1]) + for i in range((steps-1)): + result = cursor.fetchone() + time[i+2] = float(result[0])*pow(10,9) + power[i+2] = float(result[1]) name = ntpath.basename(tracePath) basename, extension = os.path.splitext(name) @@ -165,8 +161,17 @@ def generatePlots(pathToTrace): #print("Generating plots for {0}".format(pathToTrace)) outputFiles = "" - for p in plots: - outputFiles += p(connection, pathToTrace) + cursor = connection.cursor() + cursor.execute(" SELECT WindowSize FROM GeneralInfo") + windowSize = float(cursor.fetchone()[0]) + if(windowSize == 0): + outputFiles = "No output file created" + else: + cursor.execute(" SELECT TraceEnd FROM GeneralInfo ") + traceEnd = float(cursor.fetchone()[0]) + steps = ceil(traceEnd/windowSize) + for p in plots: + outputFiles += p(connection, pathToTrace, steps) connection.close() diff --git a/DRAMSys/analyzer/selectmetrics.cpp b/DRAMSys/analyzer/selectmetrics.cpp index c119c22b..9c8fbef9 100644 --- a/DRAMSys/analyzer/selectmetrics.cpp +++ b/DRAMSys/analyzer/selectmetrics.cpp @@ -1,3 +1,39 @@ +/* + * Copyright (c) 2015, University of Kaiserslautern + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: + * Felipe S. Prado + * Matthias Jung + */ + #include "selectmetrics.h" #include "ui_selectmetrics.h" #include diff --git a/DRAMSys/analyzer/selectmetrics.h b/DRAMSys/analyzer/selectmetrics.h index c0a4185f..850f27d2 100644 --- a/DRAMSys/analyzer/selectmetrics.h +++ b/DRAMSys/analyzer/selectmetrics.h @@ -1,3 +1,39 @@ +/* + * Copyright (c) 2015, University of Kaiserslautern + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: + * Felipe S. Prado + * Matthias Jung + */ + #ifndef SELECTMETRICS_H #define SELECTMETRICS_H diff --git a/DRAMSys/simulator/resources/scripts/createTraceDB.sql b/DRAMSys/simulator/resources/scripts/createTraceDB.sql index 1f72d197..ed09d7b9 100644 --- a/DRAMSys/simulator/resources/scripts/createTraceDB.sql +++ b/DRAMSys/simulator/resources/scripts/createTraceDB.sql @@ -23,7 +23,7 @@ CREATE TABLE GeneralInfo( Memconfig TEXT, Memspec TEXT, Traces TEXT, - TimeWindowSize INTEGER + WindowSize INTEGER ); CREATE TABLE Power( diff --git a/DRAMSys/simulator/resources/simulations/ddr3-example.xml b/DRAMSys/simulator/resources/simulations/ddr3-example.xml index 19bfe07f..73da61ff 100644 --- a/DRAMSys/simulator/resources/simulations/ddr3-example.xml +++ b/DRAMSys/simulator/resources/simulations/ddr3-example.xml @@ -4,7 +4,8 @@ - + + diff --git a/DRAMSys/simulator/resources/simulations/sim-batch.xml b/DRAMSys/simulator/resources/simulations/sim-batch.xml index 2b8428cf..06d1807c 100644 --- a/DRAMSys/simulator/resources/simulations/sim-batch.xml +++ b/DRAMSys/simulator/resources/simulations/sim-batch.xml @@ -4,7 +4,8 @@ - + + diff --git a/DRAMSys/simulator/src/common/TlmRecorder.cpp b/DRAMSys/simulator/src/common/TlmRecorder.cpp index c2c8a41b..e017dc5b 100644 --- a/DRAMSys/simulator/src/common/TlmRecorder.cpp +++ b/DRAMSys/simulator/src/common/TlmRecorder.cpp @@ -270,8 +270,8 @@ void TlmRecorder::prepareSqlStatements() updatePhaseString = "UPDATE Phases SET PhaseEnd = :end WHERE Transact = :trans AND PhaseName = :name"; insertGeneralInfoString = - "INSERT INTO GeneralInfo (NumberOfTransactions,TraceEnd,NumberOfBanks,clk,UnitOfTime,Memconfig,Memspec,Traces,TimeWindowSize) VALUES" - "(:numberOfTransactions,:end,:numberOfBanks,:clk,:unitOfTime,:memconfig,:memspec,:traces,:timeWindowSize)"; + "INSERT INTO GeneralInfo (NumberOfTransactions,TraceEnd,NumberOfBanks,clk,UnitOfTime,Memconfig,Memspec,Traces, WindowSize) VALUES" + "(:numberOfTransactions,:end,:numberOfBanks,:clk,:unitOfTime,:memconfig,:memspec,:traces,:windowSize)"; insertDebugMessageString = "INSERT INTO DebugMessages (Time,Message) Values (:time,:message)"; insertPowerString = "INSERT INTO Power VALUES (:time,:averagePower)"; @@ -304,8 +304,10 @@ void TlmRecorder::insertGeneralInfo() sqlite3_bind_text(insertGeneralInfoStatement, 6, memconfig.c_str(), memconfig.length(), NULL); sqlite3_bind_text(insertGeneralInfoStatement, 7, memspec.c_str(), memspec.length(), NULL); sqlite3_bind_text(insertGeneralInfoStatement, 8, traces.c_str(), traces.length(), NULL); - sqlite3_bind_int64(insertGeneralInfoStatement, 9, - Configuration::getInstance().TraceLength.value()/Configuration::getInstance().NumberOfTimeWindows); + if(!Configuration::getInstance().EnableWindowing) + sqlite3_bind_int64(insertGeneralInfoStatement, 9, 0); + else + sqlite3_bind_int64(insertGeneralInfoStatement, 9, (Configuration::getInstance().memSpec.clk*Configuration::getInstance().WindowSize).value()); executeSqlStatement(insertGeneralInfoStatement); } diff --git a/DRAMSys/simulator/src/controller/Controller.cpp b/DRAMSys/simulator/src/controller/Controller.cpp index bcd52ca6..7e272ecd 100644 --- a/DRAMSys/simulator/src/controller/Controller.cpp +++ b/DRAMSys/simulator/src/controller/Controller.cpp @@ -482,9 +482,16 @@ bool Controller::containsPhase(tlm_phase phase, std::vector phases) void Controller::terminateSimulation() { - for (Bank bank : controllerCore->getBanks()) + if(Configuration::getInstance().BankwiseLogic) { - controllerCore->powerDownManager->wakeUp(bank, clkAlign(sc_time_stamp())); + for (Bank bank : controllerCore->getBanks()) + { + controllerCore->powerDownManager->wakeUp(bank, clkAlign(sc_time_stamp())); + } + } + else + { + controllerCore->powerDownManager->wakeUp(0, clkAlign(sc_time_stamp())); } } diff --git a/DRAMSys/simulator/src/controller/ControllerState.cpp b/DRAMSys/simulator/src/controller/ControllerState.cpp index 2f97d2d6..56149e0f 100644 --- a/DRAMSys/simulator/src/controller/ControllerState.cpp +++ b/DRAMSys/simulator/src/controller/ControllerState.cpp @@ -32,6 +32,7 @@ * Authors: * Janik Schlemminger * Matthias Jung + * Felipe S. Prado */ #include "ControllerState.h" diff --git a/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp b/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp index 238c95eb..241c264f 100644 --- a/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp +++ b/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp @@ -33,6 +33,7 @@ * Janik Schlemminger * Matthias Jung * Eder F. Zulian + * Felipe S. Prado */ #include "Configuration.h" @@ -136,13 +137,15 @@ void Configuration::setParameter(std::string name, std::string value) DatabaseRecording = string2bool(value); else if(name == "PowerAnalysis") PowerAnalysis = string2bool(value); - else if (name == "NumberOfTimeWindows") { + else if (name == "EnableWindowing") + EnableWindowing = string2bool(value); + else if(name == "WindowSize") 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 + WindowSize = string2int(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 7a117b7f..1bb478b2 100644 --- a/DRAMSys/simulator/src/controller/core/configuration/Configuration.h +++ b/DRAMSys/simulator/src/controller/core/configuration/Configuration.h @@ -33,6 +33,7 @@ * Janik Schlemminger * Matthias Jung * Eder F. Zulian + * Felipe S. Prado */ #ifndef CONFIGURATION_H_ @@ -75,14 +76,14 @@ struct Configuration //SimConfig bool DatabaseRecording = true; bool PowerAnalysis = false; - sc_time TraceLength; - unsigned int NumberOfTimeWindows; + bool EnableWindowing = false; + unsigned int WindowSize = 1000; bool Debug = false; unsigned int NumberOfTracePlayers = 1; unsigned int NumberOfMemChannels = 1; bool ControllerCoreDisableRefresh = false; bool ThermalSimulation = false; - bool SimulationProgressBar; + bool SimulationProgressBar = false; unsigned int NumberOfDevicesOnDIMM = 1; //MemSpec(from DRAM-Power XML) diff --git a/DRAMSys/simulator/src/controller/core/scheduling/checker/PowerDownChecker.cpp b/DRAMSys/simulator/src/controller/core/scheduling/checker/PowerDownChecker.cpp index 2b54d365..a85179da 100644 --- a/DRAMSys/simulator/src/controller/core/scheduling/checker/PowerDownChecker.cpp +++ b/DRAMSys/simulator/src/controller/core/scheduling/checker/PowerDownChecker.cpp @@ -32,6 +32,7 @@ * Authors: * Janik Schlemminger * Matthias Jung + * Felipe S. Prado */ #include "PowerDownChecker.h" @@ -55,8 +56,8 @@ sc_time PowerDownChecker::getTimeConstraintToEnterPowerDown(Command lastCmd, Com constraint = config.memSpec.tXP; } else if (lastCmd == Command::SREFX) { constraint = config.memSpec.tXSR; - } else if(lastCmd == Command::Precharge || lastCmd == Command::PrechargeAll) { - constraint = config.memSpec.tRP; + } else if(lastCmd == Command::Precharge || lastCmd == Command::PrechargeAll) { + constraint = config.memSpec.tRP; } else { reportFatal("Powerdown checker", commandToString(pdnCmd) + " can not follow " + commandToString(lastCmd)); } diff --git a/DRAMSys/simulator/src/controller/core/scheduling/checker/PrechargeAllChecker.cpp b/DRAMSys/simulator/src/controller/core/scheduling/checker/PrechargeAllChecker.cpp index 3f49d179..3dd96e35 100644 --- a/DRAMSys/simulator/src/controller/core/scheduling/checker/PrechargeAllChecker.cpp +++ b/DRAMSys/simulator/src/controller/core/scheduling/checker/PrechargeAllChecker.cpp @@ -32,6 +32,7 @@ * Authors: * Robert Gernhardt * Matthias Jung + * Felipe S. Prado */ #include "PrechargeAllChecker.h" diff --git a/DRAMSys/simulator/src/controller/core/scheduling/checker/RefreshChecker.cpp b/DRAMSys/simulator/src/controller/core/scheduling/checker/RefreshChecker.cpp index 0fec86e2..271ce6db 100644 --- a/DRAMSys/simulator/src/controller/core/scheduling/checker/RefreshChecker.cpp +++ b/DRAMSys/simulator/src/controller/core/scheduling/checker/RefreshChecker.cpp @@ -32,6 +32,7 @@ * Authors: * Janik Schlemminger * Matthias Jung + * Felipe S. Prado */ #include "RefreshChecker.h" diff --git a/DRAMSys/simulator/src/simulation/Dram.h b/DRAMSys/simulator/src/simulation/Dram.h index abc83af5..0641ed23 100644 --- a/DRAMSys/simulator/src/simulation/Dram.h +++ b/DRAMSys/simulator/src/simulation/Dram.h @@ -34,6 +34,7 @@ * Matthias Jung * Peter Ehses * Eder F. Zulian + * Felipe S. Prado */ #ifndef DRAM_H_ @@ -73,7 +74,7 @@ struct Dram : sc_module // Power Model related bool powerAnalysis = Configuration::getInstance().PowerAnalysis; - sc_time powerWindowSize = Configuration::getInstance().TraceLength/Configuration::getInstance().NumberOfTimeWindows; + sc_time powerWindowSize = Configuration::getInstance().memSpec.clk*Configuration::getInstance().WindowSize; libDRAMPower *DRAMPower; double sumOfEnergyWindows = 0.0; @@ -185,7 +186,8 @@ struct Dram : sc_module // Create a thread that is triggered every $powerWindowSize // to generate a Power over Time plot in the Trace analyzer: - SC_THREAD(powerWindow); + if(Configuration::getInstance().EnableWindowing) + SC_THREAD(powerWindow); } // Bandwidth Calculation: @@ -220,7 +222,7 @@ struct Dram : sc_module double totalEnergy = sumOfEnergyWindows + DRAMPower->getEnergy().total_energy * Configuration::getInstance().NumberOfDevicesOnDIMM; // The energy is given in [pJ] and divided by [s] resulting in [pW] then converted to [mW] - double averagePower = (totalEnergy / sc_time_stamp().to_seconds()) / 1e9; + double averagePower = (totalEnergy/ sc_time_stamp().to_seconds()) / 1e9; tlmRecorder->recordPower(sc_time_stamp().to_seconds(), DRAMPower->getPower().average_power * Configuration::getInstance().NumberOfDevicesOnDIMM); diff --git a/DRAMSys/simulator/src/simulation/Simulation.cpp b/DRAMSys/simulator/src/simulation/Simulation.cpp index eaf77ede..db6709e6 100644 --- a/DRAMSys/simulator/src/simulation/Simulation.cpp +++ b/DRAMSys/simulator/src/simulation/Simulation.cpp @@ -33,6 +33,7 @@ * Janik Schlemminger * Matthias Jung * Eder F. Zulian + * Felipe S. Prado */ #include @@ -141,8 +142,10 @@ void Simulation::instantiateModules(const string &traceName, const string &pathT playerClk = FrequencyToClk(devices[i].clkMhz); player = new StlPlayer(playerStr.c_str(), pathToResources + string("traces/") + devices[i].trace, playerClk, this); - player->getTraceLength(pathToResources + string("traces/") + devices[i].trace, playerClk); - totalTransactions += player->getNumberOfLines(pathToResources + string("traces/") + devices[i].trace); + if(Configuration::getInstance().SimulationProgressBar) + { + totalTransactions += player->getNumberOfLines(pathToResources + string("traces/") + devices[i].trace); + } players.push_back(player); } diff --git a/DRAMSys/simulator/src/simulation/Simulation.h b/DRAMSys/simulator/src/simulation/Simulation.h index dd85543e..29d39584 100644 --- a/DRAMSys/simulator/src/simulation/Simulation.h +++ b/DRAMSys/simulator/src/simulation/Simulation.h @@ -33,6 +33,7 @@ * Janik Schlemminger * Matthias Jung * Eder F. Zulian + * Felipe S. Prado */ #ifndef SIMULATION_H_ diff --git a/DRAMSys/simulator/src/simulation/StlPlayer.cpp b/DRAMSys/simulator/src/simulation/StlPlayer.cpp index 7baa9569..67b09f92 100644 --- a/DRAMSys/simulator/src/simulation/StlPlayer.cpp +++ b/DRAMSys/simulator/src/simulation/StlPlayer.cpp @@ -34,6 +34,7 @@ * Robert Gernhardt * Matthias Jung * Éder F. Zulian + * Felipe S. Prado */ #include "StlPlayer.h" diff --git a/DRAMSys/simulator/src/simulation/StlPlayer.h b/DRAMSys/simulator/src/simulation/StlPlayer.h index 5ec9d4fc..4f905a55 100644 --- a/DRAMSys/simulator/src/simulation/StlPlayer.h +++ b/DRAMSys/simulator/src/simulation/StlPlayer.h @@ -34,6 +34,7 @@ * Robert Gernhardt * Matthias Jung * Éder F. Zulian + * Felipe S. Prado */ #ifndef STLPLAYER_H diff --git a/DRAMSys/simulator/src/simulation/TracePlayer.cpp b/DRAMSys/simulator/src/simulation/TracePlayer.cpp index b9e856be..22fe8458 100644 --- a/DRAMSys/simulator/src/simulation/TracePlayer.cpp +++ b/DRAMSys/simulator/src/simulation/TracePlayer.cpp @@ -33,6 +33,7 @@ * Robert Gernhardt * Matthias Jung * Éder F. Zulian + * Felipe S. Prado */ #include "TracePlayer.h" @@ -98,52 +99,6 @@ void TracePlayer::peqCallback(tlm_generic_payload &payload, const tlm_phase &pha } } -void TracePlayer::getTraceLength(string pathToTrace, sc_time clk) -{ - 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 == newFile.eof()) - SC_REPORT_FATAL(0, (string("Empty Trace ") + pathToTrace).c_str()); - - while(ch == '\n') - { - newFile.seekg(-2,ios_base::cur); - newFile.get(ch); - } - - bool keepLooping = true; - while(keepLooping) { - - newFile.clear(); - 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 - newFile.get(ch); - } - } - - 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(); - } - -} - unsigned int TracePlayer::getNumberOfLines(string pathToTrace) { ifstream newFile; diff --git a/DRAMSys/simulator/src/simulation/TracePlayer.h b/DRAMSys/simulator/src/simulation/TracePlayer.h index b1db609a..f73277b5 100644 --- a/DRAMSys/simulator/src/simulation/TracePlayer.h +++ b/DRAMSys/simulator/src/simulation/TracePlayer.h @@ -33,6 +33,7 @@ * Robert Gernhardt * Matthias Jung * Éder F. Zulian + * Felipe S. Prado */ #ifndef TRACEPLAYER_H_ @@ -62,7 +63,6 @@ public: tlm_utils::simple_initiator_socket iSocket; TracePlayer(TracePlayerListener *listener); virtual void nextPayload() = 0; - void getTraceLength(string pathToTrace, sc_time clk); unsigned int getNumberOfLines(string pathToTrace); protected: diff --git a/DRAMSys/tests/error/sim-batch.xml b/DRAMSys/tests/error/sim-batch.xml index 239fb065..31ee9130 100644 --- a/DRAMSys/tests/error/sim-batch.xml +++ b/DRAMSys/tests/error/sim-batch.xml @@ -4,12 +4,14 @@ - + + + diff --git a/DRAMSys/tests/simple/sim-batch.xml b/DRAMSys/tests/simple/sim-batch.xml index 64ae63dd..a439c09c 100644 --- a/DRAMSys/tests/simple/sim-batch.xml +++ b/DRAMSys/tests/simple/sim-batch.xml @@ -4,12 +4,14 @@ - + + + diff --git a/README.md b/README.md index 2d898ed8..d2330084 100644 --- a/README.md +++ b/README.md @@ -398,12 +398,14 @@ The DRAMSys' main configuration file is presented below. - + + + @@ -499,12 +501,14 @@ The XML code below shows a typic configuration: - + + + @@ -612,8 +616,11 @@ Below are listed the configuration sections and configuration fields. - *PowerAnalysis* (boolean) - "1": enables live power analysis with the DRAMPower tool - "0": disables power analysis - - *NumberOfTimeWindows* (int) - - number of time windows used to evaluate average bandwidth and average power consumption + - *EnableWindowing* (boolean) + - "1": enables temporal windowing + - "0": disables temporal windowing + - *WindowSize* (unisgned int) + - Size of the window in clock cycles used to evaluate average bandwidth and average power consumption - *NumberOfTracePlayers* (unsigned int) - Number of trace players - *NumberOfMemChannels* (unsigned int) @@ -627,6 +634,8 @@ Below are listed the configuration sections and configuration fields. - *SimulationProgressBar* (boolean) - "1": enables the simulation progress bar - "0": disables the simulation progress bar + - *NumberOfDevicesOnDIMM* (unsigned int) + - Number of devices on dual inline memory module - **Temperature Simulator Configuration** - *TemperatureScale* (string)