WindowSize on the database
This commit is contained in:
@@ -49,10 +49,11 @@ struct GeneralInfo
|
||||
QString description;
|
||||
QString unitOfTime;
|
||||
unsigned int clkPeriod;
|
||||
unsigned int windowSize;
|
||||
|
||||
public:
|
||||
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)
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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 FROM GeneralInfo");
|
||||
query.prepare("SELECT NumberOfTransactions,TraceEnd,NumberOfBanks,Clk,UnitOfTime,Traces,Memspec,Memconfig, WindowSize FROM GeneralInfo");
|
||||
executeQuery(query);
|
||||
|
||||
if(query.next())
|
||||
@@ -214,6 +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 int windowSize = query.value(8).toInt();
|
||||
|
||||
QString description = (traces + "\n");
|
||||
description += memconfig + "\n";
|
||||
@@ -221,8 +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 += "Window size:" + QString::number(windowSize) + "\n";
|
||||
|
||||
return GeneralInfo(numberOfTransactions, numberOfPhases, Timespan(0,traceEnd),numberOfBanks,description,unitOfTime,clkPeriod);
|
||||
return GeneralInfo(numberOfTransactions, numberOfPhases, Timespan(0,traceEnd),numberOfBanks,description,unitOfTime,clkPeriod, windowSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -23,9 +23,8 @@ def memory_utilisation_window(connection, tracePath, steps):
|
||||
# The bandwidth data are then plotted in two graphics.
|
||||
|
||||
cursor = connection.cursor()
|
||||
cursor.execute(" SELECT time FROM Power WHERE averagePower = 0 ")
|
||||
#pow(10,12): seconds to picoseconds conversion
|
||||
windowSize = pow(10,12)*float(cursor.fetchone()[0])
|
||||
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
|
||||
@@ -106,22 +105,20 @@ def power_window(connection, tracePath, steps):
|
||||
|
||||
outputFile = ""
|
||||
cursor = connection.cursor()
|
||||
cursor.execute(" SELECT time FROM Power WHERE averagePower > 0")
|
||||
if(cursor.fetchone() is not None):
|
||||
cursor.execute("SELECT max(time) FROM Power")
|
||||
maxTime = cursor.fetchone()[0]
|
||||
cursor.execute("SELECT min(time) FROM Power")
|
||||
windowSize = cursor.fetchone()[0]
|
||||
cursor.execute(""" SELECT * FROM Power WHERE averagePower > 0""")
|
||||
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()
|
||||
#pow(10,9): seconds to nanoseconds conversion
|
||||
time[i+1] = float(result[0])*pow(10,9)
|
||||
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,15 +162,13 @@ def generatePlots(pathToTrace):
|
||||
|
||||
outputFiles = ""
|
||||
cursor = connection.cursor()
|
||||
cursor.execute(" SELECT time FROM Power WHERE averagePower = 0")
|
||||
if(cursor.fetchone() is None):
|
||||
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])
|
||||
cursor.execute(" SELECT min(time) FROM Power WHERE averagePower = 0")
|
||||
#pow(10,12): seconds to picoseconds conversion
|
||||
windowSize = pow(10,12)*float(cursor.fetchone()[0])
|
||||
steps = ceil(traceEnd/windowSize)
|
||||
for p in plots:
|
||||
outputFiles += p(connection, pathToTrace, steps)
|
||||
|
||||
@@ -22,7 +22,8 @@ CREATE TABLE GeneralInfo(
|
||||
UnitOfTime TEXT,
|
||||
Memconfig TEXT,
|
||||
Memspec TEXT,
|
||||
Traces TEXT
|
||||
Traces TEXT,
|
||||
WindowSize INTEGER
|
||||
);
|
||||
|
||||
CREATE TABLE Power(
|
||||
|
||||
@@ -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) VALUES"
|
||||
"(:numberOfTransactions,:end,:numberOfBanks,:clk,:unitOfTime,:memconfig,:memspec,:traces)";
|
||||
"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,6 +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);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -231,9 +231,6 @@ struct Dram : sc_module
|
||||
cout << name() << string("\tAverage Power: \t") << fixed <<std::setprecision( 2 )<< averagePower<< string(" mW") << endl;
|
||||
}
|
||||
|
||||
if(Configuration::getInstance().EnableWindowing)
|
||||
tlmRecorder->recordPower(powerWindowSize.to_seconds(), 0);
|
||||
|
||||
// Bandwidth:
|
||||
|
||||
sc_time activeTime = numberOfTransactionsServed * Configuration::getInstance().memSpec.BurstLength / Configuration::getInstance().memSpec.DataRate * Configuration::getInstance().memSpec.clk;
|
||||
|
||||
Reference in New Issue
Block a user