diff --git a/DRAMSys/library/resources/scripts/createTraceDB.sql b/DRAMSys/library/resources/scripts/createTraceDB.sql deleted file mode 100644 index ba429652..00000000 --- a/DRAMSys/library/resources/scripts/createTraceDB.sql +++ /dev/null @@ -1,111 +0,0 @@ -DROP TABLE IF EXISTS Phases; -DROP TABLE IF EXISTS GeneralInfo; -DROP TABLE IF EXISTS CommandLengths; -DROP TABLE IF EXISTS Comments; -DROP TABLE IF EXISTS ranges; -DROP TABLE IF EXISTS Transactions; -DROP TABLE IF EXISTS DebugMessages; -DROP TABLE IF EXISTS Power; -DROP TABLE IF EXISTS BufferDepth; -DROP TABLE IF EXISTS Bandwidth; - -CREATE TABLE Phases( - ID INTEGER PRIMARY KEY, - PhaseName TEXT, - PhaseBegin INTEGER, - PhaseEnd INTEGER, - Transact INTEGER -); - -CREATE TABLE GeneralInfo( - NumberOfTransactions INTEGER, - TraceEnd INTEGER, - NumberOfRanks INTEGER, - NumberOfBankgroups INTEGER, - NumberOfBanks INTEGER, - clk INTEGER, - UnitOfTime TEXT, - MCconfig TEXT, - Memspec TEXT, - Traces TEXT, - WindowSize INTEGER, - FlexibleRefresh INTEGER, - MaxRefBurst INTEGER, - ControllerThread INTEGER, - MaxBufferDepth INTEGER -); - -CREATE TABLE CommandLengths( - NOP INTEGER, - RD INTEGER, - WR INTEGER, - RDA INTEGER, - WRA INTEGER, - ACT INTEGER, - PRE INTEGER, - REFB INTEGER, - PRESB INTEGER, - REFSB INTEGER, - PREA INTEGER, - REFA INTEGER, - PDEA INTEGER, - PDXA INTEGER, - PDEP INTEGER, - PDXP INTEGER, - SREFEN INTEGER, - SREFEX INTEGER -); - -CREATE TABLE Power( - time DOUBLE, - AveragePower DOUBLE -); - -CREATE TABLE BufferDepth( - Time DOUBLE, - BufferNumber INTEGER, - AverageBufferDepth DOUBLE -); - -CREATE TABLE Bandwidth( - Time DOUBLE, - AverageBandwidth DOUBLE -); - -CREATE TABLE Comments( - Time INTEGER, - Text TEXT -); - -CREATE TABLE DebugMessages( - Time INTEGER, - Message TEXT -); - --- use SQLITE R* TREE Module to make queries on timespans effecient (see http://www.sqlite.org/rtree.html) -CREATE VIRTUAL TABLE ranges USING rtree( - id, - begin, end -); - -CREATE TABLE Transactions( - ID INTEGER, - Range INTEGER, - Address INTEGER, - Burstlength INTEGER, - TThread INTEGER, - TChannel INTEGER, - TRank INTEGER, - TBankgroup INTEGER, - TBank INTEGER, - TRow INTEGER, - TColumn INTEGER, - DataStrobeBegin INTEGER, - DataStrobeEnd INTEGER, - TimeOfGeneration INTEGER, - Command TEXT -); - -CREATE INDEX ranges_index ON Transactions(Range); -CREATE INDEX "phasesTransactions" ON "Phases" ("Transact" ASC); -CREATE INDEX "messageTimes" ON "DebugMessages" ("Time" ASC); diff --git a/DRAMSys/library/src/common/TlmRecorder.cpp b/DRAMSys/library/src/common/TlmRecorder.cpp index 571d9b0f..51e941de 100644 --- a/DRAMSys/library/src/common/TlmRecorder.cpp +++ b/DRAMSys/library/src/common/TlmRecorder.cpp @@ -46,8 +46,8 @@ using namespace tlm; -TlmRecorder::TlmRecorder(std::string name, std::string uri, std::string dbname) : - name(name), sqlScriptURI(uri), dbName(dbname), +TlmRecorder::TlmRecorder(std::string name, std::string dbname) : + dbName(dbname), name(name), totalNumTransactions(1), simulationTimeCoveredByRecording(SC_ZERO_TIME) { recordedData.reserve(transactionCommitRate); @@ -60,7 +60,7 @@ TlmRecorder::TlmRecorder(std::string name, std::string uri, std::string dbname) sqlite3_exec(db, "PRAGMA main.synchronous=OFF", NULL, NULL, &sErrMsg); sqlite3_exec(db, "PRAGMA journal_mode = OFF", NULL, NULL, &sErrMsg); - createTables(TlmRecorder::sqlScriptURI); + executeInitialSqlCommand(); prepareSqlStatements(); PRINTDEBUGMESSAGE(name, "Starting new database transaction"); @@ -256,23 +256,6 @@ void TlmRecorder::openDB(std::string name) } } -void TlmRecorder::createTables(std::string pathToURI) -{ - std::string initial; - ifstream in(pathToURI.c_str(), ios::in | ios::binary); - - if (!in) - SC_REPORT_FATAL("Error loading file", ("Could not load textfile from " + pathToURI).c_str()); - - in.seekg(0, ios::end); - initial.resize(in.tellg()); - in.seekg(0, ios::beg); - in.read(&initial[0], initial.size()); - in.close(); - - executeSqlCommand(initial); -} - void TlmRecorder::setUpTransactionTerminatingPhases() { transactionTerminatingPhases.push_back(END_RESP); @@ -480,12 +463,12 @@ void TlmRecorder::executeSqlStatement(sqlite3_stmt *statement) sqlite3_reset(statement); } -void TlmRecorder::executeSqlCommand(std::string command) +void TlmRecorder::executeInitialSqlCommand() { PRINTDEBUGMESSAGE(name, "Creating database by running provided sql script"); char *errMsg = 0; - int rc = sqlite3_exec(db, command.c_str(), NULL, 0, &errMsg); + int rc = sqlite3_exec(db, initialCommand.c_str(), NULL, 0, &errMsg); if (rc != SQLITE_OK) { SC_REPORT_FATAL("SQLITE Error", errMsg); sqlite3_free(errMsg); diff --git a/DRAMSys/library/src/common/TlmRecorder.h b/DRAMSys/library/src/common/TlmRecorder.h index 2b32b011..8480b966 100644 --- a/DRAMSys/library/src/common/TlmRecorder.h +++ b/DRAMSys/library/src/common/TlmRecorder.h @@ -58,7 +58,7 @@ public: std::string sqlScriptURI; std::string dbName; - TlmRecorder(std::string name, std::string uri, std::string dbname); + TlmRecorder(std::string name, std::string dbname); ~TlmRecorder(); void recordMCconfig(std::string mcconfig) @@ -98,7 +98,8 @@ private: sc_time timeOfGeneration; TimeInterval timeOnDataStrobe; - struct Phase { + struct Phase + { Phase(std::string name, sc_time begin): name(name), interval(begin, SC_ZERO_TIME) {} std::string name; TimeInterval interval; @@ -114,11 +115,10 @@ private: std::string mcconfig, memspec, traces; void prepareSqlStatements(); - void executeSqlCommand(std::string command); + void executeInitialSqlCommand(); void executeSqlStatement(sqlite3_stmt *statement); void openDB(std::string name); - void createTables(std::string pathToURI); void setUpTransactionTerminatingPhases(); void introduceTransactionSystem(tlm::tlm_generic_payload &trans); @@ -151,6 +151,119 @@ private: updatePhaseString, insertGeneralInfoString, insertCommandLengthsString, insertDebugMessageString, updateDataStrobeString, insertPowerString, insertBufferDepthString, insertBandwidthString; + + std::string initialCommand = + "DROP TABLE IF EXISTS Phases; \n" + "DROP TABLE IF EXISTS GeneralInfo; \n" + "DROP TABLE IF EXISTS CommandLengths; \n" + "DROP TABLE IF EXISTS Comments; \n" + "DROP TABLE IF EXISTS ranges; \n" + "DROP TABLE IF EXISTS Transactions; \n" + "DROP TABLE IF EXISTS DebugMessages; \n" + "DROP TABLE IF EXISTS Power; \n" + "DROP TABLE IF EXISTS BufferDepth; \n" + "DROP TABLE IF EXISTS Bandwidth; \n" + " \n" + "CREATE TABLE Phases( \n" + " ID INTEGER PRIMARY KEY, \n" + " PhaseName TEXT, \n" + " PhaseBegin INTEGER, \n" + " PhaseEnd INTEGER, \n" + " Transact INTEGER \n" + "); \n" + " \n" + "CREATE TABLE GeneralInfo( \n" + " NumberOfTransactions INTEGER, \n" + " TraceEnd INTEGER, \n" + " NumberOfRanks INTEGER, \n" + " NumberOfBankgroups INTEGER, \n" + " NumberOfBanks INTEGER, \n" + " clk INTEGER, \n" + " UnitOfTime TEXT, \n" + " MCconfig TEXT, \n" + " Memspec TEXT, \n" + " Traces TEXT, \n" + " WindowSize INTEGER, \n" + " FlexibleRefresh INTEGER, \n" + " MaxRefBurst INTEGER, \n" + " ControllerThread INTEGER, \n" + " MaxBufferDepth INTEGER \n" + "); \n" + " \n" + "CREATE TABLE CommandLengths( \n" + " NOP INTEGER, \n" + " RD INTEGER, \n" + " WR INTEGER, \n" + " RDA INTEGER, \n" + " WRA INTEGER, \n" + " ACT INTEGER, \n" + " PRE INTEGER, \n" + " REFB INTEGER, \n" + " PRESB INTEGER, \n" + " REFSB INTEGER, \n" + " PREA INTEGER, \n" + " REFA INTEGER, \n" + " PDEA INTEGER, \n" + " PDXA INTEGER, \n" + " PDEP INTEGER, \n" + " PDXP INTEGER, \n" + " SREFEN INTEGER, \n" + " SREFEX INTEGER \n" + "); \n" + " \n" + "CREATE TABLE Power( \n" + " time DOUBLE, \n" + " AveragePower DOUBLE \n" + "); \n" + " \n" + "CREATE TABLE BufferDepth( \n" + " Time DOUBLE, \n" + " BufferNumber INTEGER, \n" + " AverageBufferDepth DOUBLE \n" + "); \n" + " \n" + "CREATE TABLE Bandwidth( \n" + " Time DOUBLE, \n" + " AverageBandwidth DOUBLE \n" + "); \n" + " \n" + "CREATE TABLE Comments( \n" + " Time INTEGER, \n" + " Text TEXT \n" + "); \n" + " \n" + "CREATE TABLE DebugMessages( \n" + " Time INTEGER, \n" + " Message TEXT \n" + "); \n" + " \n" + "-- use SQLITE R* TREE Module to make queries on timespans effecient (see http://www.sqlite.org/rtree.html)\n" + "CREATE VIRTUAL TABLE ranges USING rtree( \n" + " id, \n" + " begin, end \n" + "); \n" + " \n" + "CREATE TABLE Transactions( \n" + " ID INTEGER, \n" + " Range INTEGER, \n" + " Address INTEGER, \n" + " Burstlength INTEGER, \n" + " TThread INTEGER, \n" + " TChannel INTEGER, \n" + " TRank INTEGER, \n" + " TBankgroup INTEGER, \n" + " TBank INTEGER, \n" + " TRow INTEGER, \n" + " TColumn INTEGER, \n" + " DataStrobeBegin INTEGER, \n" + " DataStrobeEnd INTEGER, \n" + " TimeOfGeneration INTEGER, \n" + " Command TEXT \n" + "); \n" + " \n" + "CREATE INDEX ranges_index ON Transactions(Range); \n" + "CREATE INDEX \"phasesTransactions\" ON \"Phases\" (\"Transact\" ASC); \n" + "CREATE INDEX \"messageTimes\" ON \"DebugMessages\" (\"Time\" ASC); \n"; }; #endif // TLMRECORDER_H diff --git a/DRAMSys/library/src/simulation/DRAMSysRecordable.cpp b/DRAMSys/library/src/simulation/DRAMSysRecordable.cpp index 5c50081f..cdc0caf5 100644 --- a/DRAMSys/library/src/simulation/DRAMSysRecordable.cpp +++ b/DRAMSys/library/src/simulation/DRAMSysRecordable.cpp @@ -88,21 +88,17 @@ DRAMSysRecordable::~DRAMSysRecordable() delete rec; } -void DRAMSysRecordable::setupTlmRecorders(const std::string &traceName, - const std::string &pathToResources) +void DRAMSysRecordable::setupTlmRecorders(const std::string &traceName) { // Create TLM Recorders, one per channel. for (size_t i = 0; i < Configuration::getInstance().memSpec->numberOfChannels; i++) { - std::string sqlScriptURI = pathToResources - + std::string("scripts/createTraceDB.sql"); - std::string dbName = traceName + std::string("_ch") + std::to_string(i) + ".tdb"; std::string recorderName = "tlmRecorder" + std::to_string(i); TlmRecorder *tlmRecorder = - new TlmRecorder(recorderName, sqlScriptURI.c_str(), dbName.c_str()); + new TlmRecorder(recorderName, dbName.c_str()); tlmRecorder->recordMCconfig(Configuration::getInstance().mcconfigUri); tlmRecorder->recordMemspec(Configuration::getInstance().memspecUri); @@ -125,7 +121,7 @@ void DRAMSysRecordable::instantiateModules(const std::string &traceName, // Create and properly initialize TLM recorders. // They need to be ready before creating some modules. - setupTlmRecorders(traceName, pathToResources); + setupTlmRecorders(traceName); // Create new ECC Controller if (config.eccMode == Configuration::ECCMode::Hamming) diff --git a/DRAMSys/library/src/simulation/DRAMSysRecordable.h b/DRAMSys/library/src/simulation/DRAMSysRecordable.h index b2f10c8f..6640d40d 100644 --- a/DRAMSys/library/src/simulation/DRAMSysRecordable.h +++ b/DRAMSys/library/src/simulation/DRAMSysRecordable.h @@ -53,8 +53,7 @@ private: // They generate the output databases. std::vector tlmRecorders; - void setupTlmRecorders(const std::string &traceName, - const std::string &pathToResources); + void setupTlmRecorders(const std::string &traceName); void instantiateModules(const std::string &traceName, const std::string &pathToResources, diff --git a/DRAMSys/tests/DDR4/scripts/createTraceDB.sql b/DRAMSys/tests/DDR4/scripts/createTraceDB.sql deleted file mode 100644 index ba429652..00000000 --- a/DRAMSys/tests/DDR4/scripts/createTraceDB.sql +++ /dev/null @@ -1,111 +0,0 @@ -DROP TABLE IF EXISTS Phases; -DROP TABLE IF EXISTS GeneralInfo; -DROP TABLE IF EXISTS CommandLengths; -DROP TABLE IF EXISTS Comments; -DROP TABLE IF EXISTS ranges; -DROP TABLE IF EXISTS Transactions; -DROP TABLE IF EXISTS DebugMessages; -DROP TABLE IF EXISTS Power; -DROP TABLE IF EXISTS BufferDepth; -DROP TABLE IF EXISTS Bandwidth; - -CREATE TABLE Phases( - ID INTEGER PRIMARY KEY, - PhaseName TEXT, - PhaseBegin INTEGER, - PhaseEnd INTEGER, - Transact INTEGER -); - -CREATE TABLE GeneralInfo( - NumberOfTransactions INTEGER, - TraceEnd INTEGER, - NumberOfRanks INTEGER, - NumberOfBankgroups INTEGER, - NumberOfBanks INTEGER, - clk INTEGER, - UnitOfTime TEXT, - MCconfig TEXT, - Memspec TEXT, - Traces TEXT, - WindowSize INTEGER, - FlexibleRefresh INTEGER, - MaxRefBurst INTEGER, - ControllerThread INTEGER, - MaxBufferDepth INTEGER -); - -CREATE TABLE CommandLengths( - NOP INTEGER, - RD INTEGER, - WR INTEGER, - RDA INTEGER, - WRA INTEGER, - ACT INTEGER, - PRE INTEGER, - REFB INTEGER, - PRESB INTEGER, - REFSB INTEGER, - PREA INTEGER, - REFA INTEGER, - PDEA INTEGER, - PDXA INTEGER, - PDEP INTEGER, - PDXP INTEGER, - SREFEN INTEGER, - SREFEX INTEGER -); - -CREATE TABLE Power( - time DOUBLE, - AveragePower DOUBLE -); - -CREATE TABLE BufferDepth( - Time DOUBLE, - BufferNumber INTEGER, - AverageBufferDepth DOUBLE -); - -CREATE TABLE Bandwidth( - Time DOUBLE, - AverageBandwidth DOUBLE -); - -CREATE TABLE Comments( - Time INTEGER, - Text TEXT -); - -CREATE TABLE DebugMessages( - Time INTEGER, - Message TEXT -); - --- use SQLITE R* TREE Module to make queries on timespans effecient (see http://www.sqlite.org/rtree.html) -CREATE VIRTUAL TABLE ranges USING rtree( - id, - begin, end -); - -CREATE TABLE Transactions( - ID INTEGER, - Range INTEGER, - Address INTEGER, - Burstlength INTEGER, - TThread INTEGER, - TChannel INTEGER, - TRank INTEGER, - TBankgroup INTEGER, - TBank INTEGER, - TRow INTEGER, - TColumn INTEGER, - DataStrobeBegin INTEGER, - DataStrobeEnd INTEGER, - TimeOfGeneration INTEGER, - Command TEXT -); - -CREATE INDEX ranges_index ON Transactions(Range); -CREATE INDEX "phasesTransactions" ON "Phases" ("Transact" ASC); -CREATE INDEX "messageTimes" ON "DebugMessages" ("Time" ASC); diff --git a/DRAMSys/tests/HBM2/scripts/createTraceDB.sql b/DRAMSys/tests/HBM2/scripts/createTraceDB.sql deleted file mode 100644 index ba429652..00000000 --- a/DRAMSys/tests/HBM2/scripts/createTraceDB.sql +++ /dev/null @@ -1,111 +0,0 @@ -DROP TABLE IF EXISTS Phases; -DROP TABLE IF EXISTS GeneralInfo; -DROP TABLE IF EXISTS CommandLengths; -DROP TABLE IF EXISTS Comments; -DROP TABLE IF EXISTS ranges; -DROP TABLE IF EXISTS Transactions; -DROP TABLE IF EXISTS DebugMessages; -DROP TABLE IF EXISTS Power; -DROP TABLE IF EXISTS BufferDepth; -DROP TABLE IF EXISTS Bandwidth; - -CREATE TABLE Phases( - ID INTEGER PRIMARY KEY, - PhaseName TEXT, - PhaseBegin INTEGER, - PhaseEnd INTEGER, - Transact INTEGER -); - -CREATE TABLE GeneralInfo( - NumberOfTransactions INTEGER, - TraceEnd INTEGER, - NumberOfRanks INTEGER, - NumberOfBankgroups INTEGER, - NumberOfBanks INTEGER, - clk INTEGER, - UnitOfTime TEXT, - MCconfig TEXT, - Memspec TEXT, - Traces TEXT, - WindowSize INTEGER, - FlexibleRefresh INTEGER, - MaxRefBurst INTEGER, - ControllerThread INTEGER, - MaxBufferDepth INTEGER -); - -CREATE TABLE CommandLengths( - NOP INTEGER, - RD INTEGER, - WR INTEGER, - RDA INTEGER, - WRA INTEGER, - ACT INTEGER, - PRE INTEGER, - REFB INTEGER, - PRESB INTEGER, - REFSB INTEGER, - PREA INTEGER, - REFA INTEGER, - PDEA INTEGER, - PDXA INTEGER, - PDEP INTEGER, - PDXP INTEGER, - SREFEN INTEGER, - SREFEX INTEGER -); - -CREATE TABLE Power( - time DOUBLE, - AveragePower DOUBLE -); - -CREATE TABLE BufferDepth( - Time DOUBLE, - BufferNumber INTEGER, - AverageBufferDepth DOUBLE -); - -CREATE TABLE Bandwidth( - Time DOUBLE, - AverageBandwidth DOUBLE -); - -CREATE TABLE Comments( - Time INTEGER, - Text TEXT -); - -CREATE TABLE DebugMessages( - Time INTEGER, - Message TEXT -); - --- use SQLITE R* TREE Module to make queries on timespans effecient (see http://www.sqlite.org/rtree.html) -CREATE VIRTUAL TABLE ranges USING rtree( - id, - begin, end -); - -CREATE TABLE Transactions( - ID INTEGER, - Range INTEGER, - Address INTEGER, - Burstlength INTEGER, - TThread INTEGER, - TChannel INTEGER, - TRank INTEGER, - TBankgroup INTEGER, - TBank INTEGER, - TRow INTEGER, - TColumn INTEGER, - DataStrobeBegin INTEGER, - DataStrobeEnd INTEGER, - TimeOfGeneration INTEGER, - Command TEXT -); - -CREATE INDEX ranges_index ON Transactions(Range); -CREATE INDEX "phasesTransactions" ON "Phases" ("Transact" ASC); -CREATE INDEX "messageTimes" ON "DebugMessages" ("Time" ASC); diff --git a/DRAMSys/tests/ddr3_multirank/scripts/createTraceDB.sql b/DRAMSys/tests/ddr3_multirank/scripts/createTraceDB.sql deleted file mode 100644 index ba429652..00000000 --- a/DRAMSys/tests/ddr3_multirank/scripts/createTraceDB.sql +++ /dev/null @@ -1,111 +0,0 @@ -DROP TABLE IF EXISTS Phases; -DROP TABLE IF EXISTS GeneralInfo; -DROP TABLE IF EXISTS CommandLengths; -DROP TABLE IF EXISTS Comments; -DROP TABLE IF EXISTS ranges; -DROP TABLE IF EXISTS Transactions; -DROP TABLE IF EXISTS DebugMessages; -DROP TABLE IF EXISTS Power; -DROP TABLE IF EXISTS BufferDepth; -DROP TABLE IF EXISTS Bandwidth; - -CREATE TABLE Phases( - ID INTEGER PRIMARY KEY, - PhaseName TEXT, - PhaseBegin INTEGER, - PhaseEnd INTEGER, - Transact INTEGER -); - -CREATE TABLE GeneralInfo( - NumberOfTransactions INTEGER, - TraceEnd INTEGER, - NumberOfRanks INTEGER, - NumberOfBankgroups INTEGER, - NumberOfBanks INTEGER, - clk INTEGER, - UnitOfTime TEXT, - MCconfig TEXT, - Memspec TEXT, - Traces TEXT, - WindowSize INTEGER, - FlexibleRefresh INTEGER, - MaxRefBurst INTEGER, - ControllerThread INTEGER, - MaxBufferDepth INTEGER -); - -CREATE TABLE CommandLengths( - NOP INTEGER, - RD INTEGER, - WR INTEGER, - RDA INTEGER, - WRA INTEGER, - ACT INTEGER, - PRE INTEGER, - REFB INTEGER, - PRESB INTEGER, - REFSB INTEGER, - PREA INTEGER, - REFA INTEGER, - PDEA INTEGER, - PDXA INTEGER, - PDEP INTEGER, - PDXP INTEGER, - SREFEN INTEGER, - SREFEX INTEGER -); - -CREATE TABLE Power( - time DOUBLE, - AveragePower DOUBLE -); - -CREATE TABLE BufferDepth( - Time DOUBLE, - BufferNumber INTEGER, - AverageBufferDepth DOUBLE -); - -CREATE TABLE Bandwidth( - Time DOUBLE, - AverageBandwidth DOUBLE -); - -CREATE TABLE Comments( - Time INTEGER, - Text TEXT -); - -CREATE TABLE DebugMessages( - Time INTEGER, - Message TEXT -); - --- use SQLITE R* TREE Module to make queries on timespans effecient (see http://www.sqlite.org/rtree.html) -CREATE VIRTUAL TABLE ranges USING rtree( - id, - begin, end -); - -CREATE TABLE Transactions( - ID INTEGER, - Range INTEGER, - Address INTEGER, - Burstlength INTEGER, - TThread INTEGER, - TChannel INTEGER, - TRank INTEGER, - TBankgroup INTEGER, - TBank INTEGER, - TRow INTEGER, - TColumn INTEGER, - DataStrobeBegin INTEGER, - DataStrobeEnd INTEGER, - TimeOfGeneration INTEGER, - Command TEXT -); - -CREATE INDEX ranges_index ON Transactions(Range); -CREATE INDEX "phasesTransactions" ON "Phases" ("Transact" ASC); -CREATE INDEX "messageTimes" ON "DebugMessages" ("Time" ASC); diff --git a/DRAMSys/tests/lpddr4/scripts/createTraceDB.sql b/DRAMSys/tests/lpddr4/scripts/createTraceDB.sql deleted file mode 100644 index ba429652..00000000 --- a/DRAMSys/tests/lpddr4/scripts/createTraceDB.sql +++ /dev/null @@ -1,111 +0,0 @@ -DROP TABLE IF EXISTS Phases; -DROP TABLE IF EXISTS GeneralInfo; -DROP TABLE IF EXISTS CommandLengths; -DROP TABLE IF EXISTS Comments; -DROP TABLE IF EXISTS ranges; -DROP TABLE IF EXISTS Transactions; -DROP TABLE IF EXISTS DebugMessages; -DROP TABLE IF EXISTS Power; -DROP TABLE IF EXISTS BufferDepth; -DROP TABLE IF EXISTS Bandwidth; - -CREATE TABLE Phases( - ID INTEGER PRIMARY KEY, - PhaseName TEXT, - PhaseBegin INTEGER, - PhaseEnd INTEGER, - Transact INTEGER -); - -CREATE TABLE GeneralInfo( - NumberOfTransactions INTEGER, - TraceEnd INTEGER, - NumberOfRanks INTEGER, - NumberOfBankgroups INTEGER, - NumberOfBanks INTEGER, - clk INTEGER, - UnitOfTime TEXT, - MCconfig TEXT, - Memspec TEXT, - Traces TEXT, - WindowSize INTEGER, - FlexibleRefresh INTEGER, - MaxRefBurst INTEGER, - ControllerThread INTEGER, - MaxBufferDepth INTEGER -); - -CREATE TABLE CommandLengths( - NOP INTEGER, - RD INTEGER, - WR INTEGER, - RDA INTEGER, - WRA INTEGER, - ACT INTEGER, - PRE INTEGER, - REFB INTEGER, - PRESB INTEGER, - REFSB INTEGER, - PREA INTEGER, - REFA INTEGER, - PDEA INTEGER, - PDXA INTEGER, - PDEP INTEGER, - PDXP INTEGER, - SREFEN INTEGER, - SREFEX INTEGER -); - -CREATE TABLE Power( - time DOUBLE, - AveragePower DOUBLE -); - -CREATE TABLE BufferDepth( - Time DOUBLE, - BufferNumber INTEGER, - AverageBufferDepth DOUBLE -); - -CREATE TABLE Bandwidth( - Time DOUBLE, - AverageBandwidth DOUBLE -); - -CREATE TABLE Comments( - Time INTEGER, - Text TEXT -); - -CREATE TABLE DebugMessages( - Time INTEGER, - Message TEXT -); - --- use SQLITE R* TREE Module to make queries on timespans effecient (see http://www.sqlite.org/rtree.html) -CREATE VIRTUAL TABLE ranges USING rtree( - id, - begin, end -); - -CREATE TABLE Transactions( - ID INTEGER, - Range INTEGER, - Address INTEGER, - Burstlength INTEGER, - TThread INTEGER, - TChannel INTEGER, - TRank INTEGER, - TBankgroup INTEGER, - TBank INTEGER, - TRow INTEGER, - TColumn INTEGER, - DataStrobeBegin INTEGER, - DataStrobeEnd INTEGER, - TimeOfGeneration INTEGER, - Command TEXT -); - -CREATE INDEX ranges_index ON Transactions(Range); -CREATE INDEX "phasesTransactions" ON "Phases" ("Transact" ASC); -CREATE INDEX "messageTimes" ON "DebugMessages" ("Time" ASC);