diff --git a/DRAMSys/analyzer/businessObjects/generalinfo.h b/DRAMSys/analyzer/businessObjects/generalinfo.h index 46b6b3ee..d005d0d5 100644 --- a/DRAMSys/analyzer/businessObjects/generalinfo.h +++ b/DRAMSys/analyzer/businessObjects/generalinfo.h @@ -49,11 +49,10 @@ struct GeneralInfo QString description; QString unitOfTime; unsigned int clkPeriod; - unsigned long long timeWindowSize; 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) : + numberOfTransactions(numberOfTransactions) , numberOfPhases(numberOfPhases),span(span), numberOfBanks(numberOfBanks), description(description), unitOfTime(unitOfTime), clkPeriod(clkPeriod) { } 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..2f9eed87 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 FROM GeneralInfo"); executeQuery(query); if(query.next()) @@ -214,7 +214,6 @@ 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(); QString description = (traces + "\n"); description += memconfig + "\n"; @@ -222,9 +221,8 @@ 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); - return GeneralInfo(numberOfTransactions, numberOfPhases, Timespan(0,traceEnd),numberOfBanks,description,unitOfTime,clkPeriod,timeWindowSize); + return GeneralInfo(numberOfTransactions, numberOfPhases, Timespan(0,traceEnd),numberOfBanks,description,unitOfTime,clkPeriod); } 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..b56fb7fd 100755 --- a/DRAMSys/analyzer/scripts/plots.py +++ b/DRAMSys/analyzer/scripts/plots.py @@ -23,82 +23,85 @@ 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)) - # 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 - queryBegin = """ SELECT sum(? - DataStrobeBegin) FROM transactions Where DataStrobeBegin >= ? and DataStrobeBegin < ? and DataStrobeEnd > ?""" # Only the beginning of the data transfer is inside the time window - queryPart = """ SELECT DataStrobeBegin FROM transactions Where DataStrobeBegin <= ? and DataStrobeEnd >= ?""" # The data transfer occupies all the time window - maxDataRate = maximum_data_rate(connection) - maximumPercentage = 0 - bandwidthPercentage = [0] * (steps+1) - bandwidth = [0] * (steps+1) - bandwidthPercentage[0] = 0 - bandwidth[0] = 0 - for i in range(steps): - bandwidthPercentage[i+1] = 0 - cursor.execute(queryPart, (i*windowSize, (i+1)*windowSize)) - result = cursor.fetchone() - if(result is None): - cursor.execute(queryFull, (i*windowSize, (i+1)*windowSize)) - result = cursor.fetchone() - if(result[0] is not None): - bandwidthPercentage[i+1] += int(result[0]) - cursor.execute(queryEnd, (i*windowSize, i*windowSize, i*windowSize, (i+1)*windowSize)) - result = cursor.fetchone() - if(result[0] is not None): - bandwidthPercentage[i+1] += int(result[0]) - cursor.execute(queryBegin, ((i+1)*windowSize, i*windowSize, (i+1)*windowSize, (i+1)*windowSize)) - result = cursor.fetchone() - if(result[0] is not None): - bandwidthPercentage[i+1] += int(result[0]) - else: - bandwidthPercentage[i+1] = windowSize - bandwidthPercentage[i+1] = float(bandwidthPercentage[i+1]/windowSize) - bandwidth[i+1] = float(bandwidthPercentage[i+1])*float(maxDataRate)/1024 - bandwidthPercentage[i+1] *= 100 - if(maximumPercentage < 100 and maximumPercentage < bandwidthPercentage[i+1]): - maximumPercentage = bandwidthPercentage[i+1] - - name = ntpath.basename(tracePath) - basename, extension = os.path.splitext(name) - + cursor.execute(""" SELECT time FROM Power """) outputFile = "" - OUTPUT_FILE = 'memory_utilization_' + basename + '.pdf' - outputFile = "Output file is {0}".format(OUTPUT_FILE) + if(cursor.fetchone() is not None): + cursor = connection.cursor() + cursor.execute("SELECT max(time) FROM Power") + maxTime = pow(10,12)*cursor.fetchone()[0] + cursor.execute("SELECT min(time) FROM Power WHERE time > 0") + windowSize = pow(10,12)*cursor.fetchone()[0] + steps = ceil(float(maxTime)/float(windowSize)) + # 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 + queryBegin = """ SELECT sum(? - DataStrobeBegin) FROM transactions Where DataStrobeBegin >= ? and DataStrobeBegin < ? and DataStrobeEnd > ?""" # Only the beginning of the data transfer is inside the time window + queryPart = """ SELECT DataStrobeBegin FROM transactions Where DataStrobeBegin <= ? and DataStrobeEnd >= ?""" # The data transfer occupies all the time window + maxDataRate = maximum_data_rate(connection) + maximumPercentage = 0 + bandwidthPercentage = [0] * (steps+1) + bandwidth = [0] * (steps+1) + bandwidthPercentage[0] = 0 + bandwidth[0] = 0 + for i in range(steps): + bandwidthPercentage[i+1] = 0 + cursor.execute(queryPart, (i*windowSize, (i+1)*windowSize)) + result = cursor.fetchone() + if(result is None): + cursor.execute(queryFull, (i*windowSize, (i+1)*windowSize)) + result = cursor.fetchone() + if(result[0] is not None): + bandwidthPercentage[i+1] += int(result[0]) + cursor.execute(queryEnd, (i*windowSize, i*windowSize, i*windowSize, (i+1)*windowSize)) + result = cursor.fetchone() + if(result[0] is not None): + bandwidthPercentage[i+1] += int(result[0]) + cursor.execute(queryBegin, ((i+1)*windowSize, i*windowSize, (i+1)*windowSize, (i+1)*windowSize)) + result = cursor.fetchone() + if(result[0] is not None): + bandwidthPercentage[i+1] += int(result[0]) + else: + bandwidthPercentage[i+1] = windowSize + bandwidthPercentage[i+1] = float(bandwidthPercentage[i+1]/windowSize) + bandwidth[i+1] = float(bandwidthPercentage[i+1])*float(maxDataRate)/1024 + bandwidthPercentage[i+1] *= 100 + if(maximumPercentage < 100 and maximumPercentage < bandwidthPercentage[i+1]): + maximumPercentage = bandwidthPercentage[i+1] + + name = ntpath.basename(tracePath) + basename, extension = os.path.splitext(name) + + OUTPUT_FILE = 'memory_utilization_' + basename + '.pdf' + outputFile = "Output file is {0}".format(OUTPUT_FILE) - import matplotlib.pyplot as plt - import numpy as np - from matplotlib.backends.backend_pdf import PdfPages + '''import matplotlib.pyplot as plt + import numpy as np + from matplotlib.backends.backend_pdf import PdfPages - time = np.arange(0, (steps+1)*windowSize, windowSize) + time = np.arange(0, (steps+1)*windowSize, windowSize) - plt.figure() + plt.figure() - subplotIndex = 211 - plt.subplot(subplotIndex) - plt.plot(time/1000, bandwidthPercentage) - plt.xlabel('Time (ns)') - plt.ylabel('Bandwidth (%)') - plt.ylim(0, maximumPercentage + (10 - maximumPercentage%10)) - plt.grid(True) + subplotIndex = 211 + plt.subplot(subplotIndex) + plt.plot(time/1000, bandwidthPercentage) + plt.xlabel('Time (ns)') + plt.ylabel('Bandwidth (%)') + plt.ylim(0, maximumPercentage + (10 - maximumPercentage%10)) + plt.grid(True) - subplotIndex += 1 - plt.subplot(subplotIndex) - plt.plot(time/1000, bandwidth) - plt.xlabel('Time (ns)') - plt.ylabel('Bandwidth (Gibit/s)') - plt.grid(True) + subplotIndex += 1 + plt.subplot(subplotIndex) + plt.plot(time, bandwidth) + plt.xlabel('Time (ns)') + plt.ylabel('Bandwidth (Gibit/s)') + plt.grid(True) - pdf = PdfPages(OUTPUT_FILE) - pdf.savefig() - pdf.close() - plt.close() + pdf = PdfPages(OUTPUT_FILE) + pdf.savefig() + pdf.close() + plt.close()''' return outputFile @@ -109,11 +112,12 @@ def power_window(connection, tracePath): 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 = connection.cursor() + cursor.execute("SELECT max(time) FROM Power") + maxTime = pow(10,9)*cursor.fetchone()[0] + cursor.execute("SELECT min(time) FROM Power WHERE time > 0") + windowSize = pow(10,9)*cursor.fetchone()[0] + steps = ceil(float(maxTime)/float(windowSize)) cursor.execute(""" SELECT * FROM Power """) time = [0] * (steps+1) power = [0] * (steps+1) @@ -121,7 +125,7 @@ def power_window(connection, tracePath): power[0] = 0 for i in range((steps)): result = cursor.fetchone() - time[i+1] = float(result[0])*1000000000 + time[i+1] = float(result[0])*pow(10,9) power[i+1] = float(result[1]) name = ntpath.basename(tracePath) @@ -131,7 +135,7 @@ def power_window(connection, tracePath): OUTPUT_FILE = 'power_' + basename + '.pdf' outputFile = "\n" + "Output file is {0}".format(OUTPUT_FILE) - import matplotlib.pyplot as plt + '''import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages plt.plot(time, power) @@ -141,7 +145,7 @@ def power_window(connection, tracePath): pdf = PdfPages(OUTPUT_FILE) pdf.savefig() pdf.close() - plt.close() + plt.close()''' return outputFile # @plot 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..42c34a01 100644 --- a/DRAMSys/simulator/resources/scripts/createTraceDB.sql +++ b/DRAMSys/simulator/resources/scripts/createTraceDB.sql @@ -22,8 +22,7 @@ CREATE TABLE GeneralInfo( UnitOfTime TEXT, Memconfig TEXT, Memspec TEXT, - Traces TEXT, - TimeWindowSize INTEGER + Traces TEXT ); 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..c4bde286 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) VALUES" + "(:numberOfTransactions,:end,:numberOfBanks,:clk,:unitOfTime,:memconfig,:memspec,:traces)"; insertDebugMessageString = "INSERT INTO DebugMessages (Time,Message) Values (:time,:message)"; insertPowerString = "INSERT INTO Power VALUES (:time,:averagePower)"; @@ -304,8 +304,6 @@ 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); 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..dfc98b27 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_ @@ -76,13 +77,14 @@ struct Configuration 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..93be0b90 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,9 +222,9 @@ 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; - - tlmRecorder->recordPower(sc_time_stamp().to_seconds(), DRAMPower->getPower().average_power * Configuration::getInstance().NumberOfDevicesOnDIMM); + double averagePower = (totalEnergy/ sc_time_stamp().to_seconds()) / 1e9; + if(Configuration::getInstance().EnableWindowing) + tlmRecorder->recordPower(sc_time_stamp().to_seconds(), DRAMPower->getPower().average_power * Configuration::getInstance().NumberOfDevicesOnDIMM); // Print the final total energy and the average power for the simulation cout << name() << string("\tTotal Energy: \t") << fixed < @@ -141,8 +142,11 @@ 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) + { + player->getTraceLength(pathToResources + string("traces/") + devices[i].trace, playerClk); + 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..c3339646 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" diff --git a/DRAMSys/simulator/src/simulation/TracePlayer.h b/DRAMSys/simulator/src/simulation/TracePlayer.h index b1db609a..4f5ac9b3 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_ 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)