Change database format (2).
This commit is contained in:
@@ -84,7 +84,6 @@ void TlmRecorder::finalize()
|
||||
sqlite3_finalize(insertGeneralInfoStatement);
|
||||
sqlite3_finalize(insertCommandLengthsStatement);
|
||||
sqlite3_finalize(insertDebugMessageStatement);
|
||||
sqlite3_finalize(updateDataStrobeStatement);
|
||||
sqlite3_finalize(insertPowerStatement);
|
||||
sqlite3_finalize(insertBufferDepthStatement);
|
||||
sqlite3_finalize(insertBandwidthStatement);
|
||||
@@ -115,8 +114,8 @@ void TlmRecorder::recordBandwidth(double timeInSeconds, double averageBandwidth)
|
||||
executeSqlStatement(insertBandwidthStatement);
|
||||
}
|
||||
|
||||
void TlmRecorder::recordPhase(tlm_generic_payload &trans,
|
||||
const tlm_phase &phase, const sc_time &time)
|
||||
void TlmRecorder::recordPhase(tlm_generic_payload &trans, const tlm_phase &phase, const sc_time &time,
|
||||
TimeInterval intervalOnDataStrobe)
|
||||
{
|
||||
if (currentTransactionsInSystem.find(&trans) == currentTransactionsInSystem.end())
|
||||
introduceTransactionSystem(trans);
|
||||
@@ -136,8 +135,9 @@ void TlmRecorder::recordPhase(tlm_generic_payload &trans,
|
||||
{
|
||||
std::string phaseName = getPhaseName(phase).substr(6); // remove "BEGIN_"
|
||||
const ControllerExtension& extension = ControllerExtension::getExtension(trans);
|
||||
currentTransactionsInSystem.at(&trans).recordedPhases.emplace_back(phaseName, time, extension.getRank(),
|
||||
extension.getBankGroup(), extension.getBank(), extension.getRow(), extension.getColumn());
|
||||
currentTransactionsInSystem.at(&trans).recordedPhases.emplace_back(std::move(phaseName), time,
|
||||
std::move(intervalOnDataStrobe), extension.getRank(), extension.getBankGroup(), extension.getBank(),
|
||||
extension.getRow(), extension.getColumn(), extension.getBurstLength());
|
||||
}
|
||||
|
||||
if (currentTransactionsInSystem.at(&trans).cmd == 'X')
|
||||
@@ -164,16 +164,6 @@ void TlmRecorder::recordPhase(tlm_generic_payload &trans,
|
||||
simulationTimeCoveredByRecording = time;
|
||||
}
|
||||
|
||||
|
||||
void TlmRecorder::updateDataStrobe(const sc_time &begin, const sc_time &end,
|
||||
tlm_generic_payload &trans)
|
||||
{
|
||||
assert(currentTransactionsInSystem.count(&trans) != 0);
|
||||
currentTransactionsInSystem.at(&trans).timeOnDataStrobe.start = begin;
|
||||
currentTransactionsInSystem.at(&trans).timeOnDataStrobe.end = end;
|
||||
}
|
||||
|
||||
|
||||
void TlmRecorder::recordDebugMessage(const std::string &message, const sc_time &time)
|
||||
{
|
||||
insertDebugMessageInDB(message, time);
|
||||
@@ -299,18 +289,16 @@ void TlmRecorder::prepareSqlStatements()
|
||||
{
|
||||
insertTransactionString =
|
||||
"INSERT INTO Transactions VALUES (:id,:rangeID,:address,:dataLength,:thread,:channel,"
|
||||
":dataStrobeBegin,:dataStrobeEnd,:timeOfGeneration,:command)";
|
||||
":timeOfGeneration,:command)";
|
||||
|
||||
insertRangeString = "INSERT INTO Ranges VALUES (:id,:begin,:end)";
|
||||
|
||||
updateRangeString = "UPDATE Ranges SET End = :end WHERE ID = :id";
|
||||
|
||||
updateDataStrobeString =
|
||||
"UPDATE Transactions SET DataStrobeBegin = :begin, DataStrobeEnd = :end WHERE ID = :id";
|
||||
|
||||
insertPhaseString =
|
||||
"INSERT INTO Phases (PhaseName,PhaseBegin,PhaseEnd,Rank,BankGroup,Bank,Row,Column,BurstLength,Transact) "
|
||||
"VALUES (:name,:begin,:end,:rank,:bankGroup,:bank,:row,:column,:burstLength,:transaction)";
|
||||
"INSERT INTO Phases (PhaseName,PhaseBegin,PhaseEnd,DataStrobeBegin,DataStrobeEnd,Rank,BankGroup,Bank,"
|
||||
"Row,Column,BurstLength,Transact) VALUES (:name,:begin,:end,:strobeBegin,:strobeEnd,:rank,:bankGroup,:bank,"
|
||||
":row,:column,:burstLength,:transaction)";
|
||||
|
||||
updatePhaseString =
|
||||
"UPDATE Phases SET PhaseEnd = :end WHERE Transact = :trans AND PhaseName = :name";
|
||||
@@ -336,7 +324,6 @@ void TlmRecorder::prepareSqlStatements()
|
||||
sqlite3_prepare_v2(db, updateRangeString.c_str(), -1, &updateRangeStatement, nullptr);
|
||||
sqlite3_prepare_v2(db, insertPhaseString.c_str(), -1, &insertPhaseStatement, nullptr);
|
||||
sqlite3_prepare_v2(db, updatePhaseString.c_str(), -1, &updatePhaseStatement, nullptr);
|
||||
sqlite3_prepare_v2(db, updateDataStrobeString.c_str(), -1, &updateDataStrobeStatement, nullptr);
|
||||
sqlite3_prepare_v2(db, insertGeneralInfoString.c_str(), -1, &insertGeneralInfoStatement, nullptr);
|
||||
sqlite3_prepare_v2(db, insertCommandLengthsString.c_str(), -1, &insertCommandLengthsStatement, nullptr);
|
||||
sqlite3_prepare_v2(db, insertDebugMessageString.c_str(), -1, &insertDebugMessageStatement, nullptr);
|
||||
@@ -428,12 +415,8 @@ void TlmRecorder::insertTransactionInDB(const Transaction &recordingData)
|
||||
sqlite3_bind_int(insertTransactionStatement, 6,
|
||||
static_cast<int>(recordingData.channel.ID()));
|
||||
sqlite3_bind_int64(insertTransactionStatement, 7,
|
||||
static_cast<int64_t>(recordingData.timeOnDataStrobe.start.value()));
|
||||
sqlite3_bind_int64(insertTransactionStatement, 8,
|
||||
static_cast<int64_t>(recordingData.timeOnDataStrobe.end.value()));
|
||||
sqlite3_bind_int64(insertTransactionStatement, 9,
|
||||
static_cast<int64_t>(recordingData.timeOfGeneration.value()));
|
||||
sqlite3_bind_text(insertTransactionStatement, 10,
|
||||
sqlite3_bind_text(insertTransactionStatement, 8,
|
||||
&recordingData.cmd, 1, nullptr);
|
||||
|
||||
executeSqlStatement(insertTransactionStatement);
|
||||
@@ -453,13 +436,15 @@ void TlmRecorder::insertPhaseInDB(const Transaction::Phase& phase, uint64_t tran
|
||||
sqlite3_bind_text(insertPhaseStatement, 1, phase.name.c_str(), static_cast<int>(phase.name.length()), nullptr);
|
||||
sqlite3_bind_int64(insertPhaseStatement, 2, static_cast<int64_t>(phase.interval.start.value()));
|
||||
sqlite3_bind_int64(insertPhaseStatement, 3, static_cast<int64_t>(phase.interval.end.value()));
|
||||
sqlite3_bind_int(insertPhaseStatement, 4, static_cast<int>(phase.rank.ID()));
|
||||
sqlite3_bind_int(insertPhaseStatement, 5, static_cast<int>(phase.bankGroup.ID()));
|
||||
sqlite3_bind_int(insertPhaseStatement, 6, static_cast<int>(phase.bank.ID()));
|
||||
sqlite3_bind_int(insertPhaseStatement, 7, static_cast<int>(phase.row.ID()));
|
||||
sqlite3_bind_int(insertPhaseStatement, 8, static_cast<int>(phase.column.ID()));
|
||||
sqlite3_bind_int(insertPhaseStatement, 9, static_cast<int>(phase.burstLength));
|
||||
sqlite3_bind_int64(insertPhaseStatement, 10, static_cast<int64_t>(transactionID));
|
||||
sqlite3_bind_int64(insertPhaseStatement, 4, static_cast<int64_t>(phase.intervalOnDataStrobe.start.value()));
|
||||
sqlite3_bind_int64(insertPhaseStatement, 5, static_cast<int64_t>(phase.intervalOnDataStrobe.end.value()));
|
||||
sqlite3_bind_int(insertPhaseStatement, 6, static_cast<int>(phase.rank.ID()));
|
||||
sqlite3_bind_int(insertPhaseStatement, 7, static_cast<int>(phase.bankGroup.ID()));
|
||||
sqlite3_bind_int(insertPhaseStatement, 8, static_cast<int>(phase.bank.ID()));
|
||||
sqlite3_bind_int(insertPhaseStatement, 9, static_cast<int>(phase.row.ID()));
|
||||
sqlite3_bind_int(insertPhaseStatement, 10, static_cast<int>(phase.column.ID()));
|
||||
sqlite3_bind_int(insertPhaseStatement, 11, static_cast<int>(phase.burstLength));
|
||||
sqlite3_bind_int64(insertPhaseStatement, 12, static_cast<int64_t>(transactionID));
|
||||
executeSqlStatement(insertPhaseStatement);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,13 +76,12 @@ public:
|
||||
traces = std::move(_traces);
|
||||
}
|
||||
|
||||
void recordPhase(tlm::tlm_generic_payload &trans, const tlm::tlm_phase &phase, const sc_core::sc_time &time);
|
||||
void recordPhase(tlm::tlm_generic_payload &trans, const tlm::tlm_phase &phase, const sc_core::sc_time &time,
|
||||
TimeInterval intervalOnDataStrobe = {sc_core::SC_ZERO_TIME, sc_core::SC_ZERO_TIME});
|
||||
void recordPower(double timeInSeconds, double averagePower);
|
||||
void recordBufferDepth(double timeInSeconds, const std::vector<double> &averageBufferDepth);
|
||||
void recordBandwidth(double timeInSeconds, double averageBandwidth);
|
||||
void recordDebugMessage(const std::string &message, const sc_core::sc_time &time);
|
||||
void updateDataStrobe(const sc_core::sc_time &begin, const sc_core::sc_time &end,
|
||||
tlm::tlm_generic_payload &trans);
|
||||
void finalize();
|
||||
|
||||
private:
|
||||
@@ -104,7 +103,7 @@ private:
|
||||
//ArbiterExtension arbiterExtension; // TODO: remove
|
||||
//ControllerExtension controllerExtension; // TODO: move to phase
|
||||
sc_core::sc_time timeOfGeneration;
|
||||
TimeInterval timeOnDataStrobe; // TODO: move to phase
|
||||
//TimeInterval timeOnDataStrobe; // TODO: move to phase
|
||||
Thread thread;
|
||||
Channel channel;
|
||||
|
||||
@@ -112,12 +111,14 @@ private:
|
||||
{
|
||||
Phase(std::string name, const sc_core::sc_time& begin) : name(std::move(name)),
|
||||
interval(begin, sc_core::SC_ZERO_TIME) {}
|
||||
Phase(std::string name, const sc_core::sc_time& begin, Rank rank, BankGroup bankGroup, Bank bank,
|
||||
Row row, Column column) : name(std::move(name)), interval(begin, sc_core::SC_ZERO_TIME),
|
||||
rank(rank), bankGroup(bankGroup), bank(bank), row(row), column(column) {}
|
||||
Phase(std::string name, const sc_core::sc_time& begin, TimeInterval intervalOnDataStrobe, Rank rank,
|
||||
BankGroup bankGroup, Bank bank, Row row, Column column, unsigned int burstLength) :
|
||||
name(std::move(name)), interval(begin, sc_core::SC_ZERO_TIME),
|
||||
intervalOnDataStrobe(std::move(intervalOnDataStrobe)), rank(rank), bankGroup(bankGroup), bank(bank),
|
||||
row(row), column(column), burstLength(burstLength) {}
|
||||
std::string name;
|
||||
TimeInterval interval;
|
||||
//TimeInterval intervalOnDataStrobe;
|
||||
TimeInterval intervalOnDataStrobe = {sc_core::SC_ZERO_TIME, sc_core::SC_ZERO_TIME};
|
||||
Rank rank = Rank(0);
|
||||
BankGroup bankGroup = BankGroup(0);
|
||||
Bank bank = Bank(0);
|
||||
@@ -166,11 +167,11 @@ private:
|
||||
sqlite3_stmt *insertTransactionStatement = nullptr, *insertRangeStatement = nullptr,
|
||||
*updateRangeStatement = nullptr, *insertPhaseStatement = nullptr, *updatePhaseStatement = nullptr,
|
||||
*insertGeneralInfoStatement = nullptr, *insertCommandLengthsStatement = nullptr,
|
||||
*insertDebugMessageStatement = nullptr, *updateDataStrobeStatement = nullptr,
|
||||
*insertPowerStatement = nullptr, *insertBufferDepthStatement = nullptr, *insertBandwidthStatement = nullptr;
|
||||
*insertDebugMessageStatement = nullptr, *insertPowerStatement = nullptr,
|
||||
*insertBufferDepthStatement = nullptr, *insertBandwidthStatement = nullptr;
|
||||
std::string insertTransactionString, insertRangeString, updateRangeString, insertPhaseString,
|
||||
updatePhaseString, insertGeneralInfoString, insertCommandLengthsString,
|
||||
insertDebugMessageString, updateDataStrobeString, insertPowerString,
|
||||
insertDebugMessageString, insertPowerString,
|
||||
insertBufferDepthString, insertBandwidthString;
|
||||
|
||||
std::string initialCommand =
|
||||
@@ -190,6 +191,8 @@ private:
|
||||
" PhaseName TEXT, \n"
|
||||
" PhaseBegin INTEGER, \n"
|
||||
" PhaseEnd INTEGER, \n"
|
||||
" DataStrobeBegin INTEGER, \n"
|
||||
" DataStrobeEnd INTEGER, \n"
|
||||
" Rank INTEGER, \n"
|
||||
" BankGroup INTEGER, \n"
|
||||
" Bank INTEGER, \n"
|
||||
@@ -264,8 +267,6 @@ private:
|
||||
" DataLength INTEGER, \n"
|
||||
" Thread INTEGER, \n"
|
||||
" Channel INTEGER, \n"
|
||||
" DataStrobeBegin INTEGER, \n"
|
||||
" DataStrobeEnd INTEGER, \n"
|
||||
" TimeOfGeneration INTEGER, \n"
|
||||
" Command TEXT \n"
|
||||
"); \n"
|
||||
|
||||
@@ -183,6 +183,11 @@ bool phaseNeedsEnd(tlm_phase phase)
|
||||
return (phase >= BEGIN_NOP && phase <= BEGIN_RFMAB);
|
||||
}
|
||||
|
||||
bool phaseHasDataStrobe(tlm_phase phase)
|
||||
{
|
||||
return (phase >= BEGIN_RD && phase <= BEGIN_WRA);
|
||||
}
|
||||
|
||||
tlm_phase getEndPhase(tlm_phase phase)
|
||||
{
|
||||
assert(phase >= BEGIN_NOP && phase <= BEGIN_RFMAB);
|
||||
|
||||
@@ -152,6 +152,7 @@ public:
|
||||
|
||||
DRAMPower::MemCommand::cmds phaseToDRAMPowerCommand(tlm::tlm_phase);
|
||||
bool phaseNeedsEnd(tlm::tlm_phase);
|
||||
bool phaseHasDataStrobe(tlm::tlm_phase);
|
||||
tlm::tlm_phase getEndPhase(tlm::tlm_phase);
|
||||
|
||||
struct CommandTuple
|
||||
|
||||
@@ -329,7 +329,8 @@ void Controller::controllerMethod()
|
||||
powerDownManagers[rank.ID()]->triggerEntry();
|
||||
|
||||
sc_time fwDelay = thinkDelayFw + phyDelayFw;
|
||||
sendToDram(command, *payload, fwDelay);
|
||||
tlm_phase phase = command.toPhase();
|
||||
iSocket->nb_transport_fw(*payload, phase, fwDelay);
|
||||
}
|
||||
else
|
||||
readyCmdBlocked = true;
|
||||
@@ -518,9 +519,3 @@ void Controller::sendToFrontend(tlm_generic_payload& payload, tlm_phase& phase,
|
||||
{
|
||||
tSocket->nb_transport_bw(payload, phase, delay);
|
||||
}
|
||||
|
||||
void Controller::sendToDram(Command command, tlm_generic_payload& payload, sc_time& delay)
|
||||
{
|
||||
tlm_phase phase = command.toPhase();
|
||||
iSocket->nb_transport_fw(payload, phase, delay);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,6 @@ protected:
|
||||
unsigned int transport_dbg(tlm::tlm_generic_payload& trans) override;
|
||||
|
||||
virtual void sendToFrontend(tlm::tlm_generic_payload& trans, tlm::tlm_phase& phase, sc_core::sc_time& delay);
|
||||
virtual void sendToDram(Command, tlm::tlm_generic_payload& trans, sc_core::sc_time& delay);
|
||||
|
||||
virtual void controllerMethod();
|
||||
|
||||
|
||||
@@ -77,19 +77,6 @@ void ControllerRecordable::sendToFrontend(tlm_generic_payload& payload, tlm_phas
|
||||
tSocket->nb_transport_bw(payload, phase, delay);
|
||||
}
|
||||
|
||||
void ControllerRecordable::sendToDram(Command command, tlm_generic_payload& payload, sc_time& delay)
|
||||
{
|
||||
if (command.isCasCommand())
|
||||
{
|
||||
TimeInterval dataStrobe = memSpec.getIntervalOnDataStrobe(command, payload);
|
||||
tlmRecorder.updateDataStrobe(sc_time_stamp() + delay + dataStrobe.start,
|
||||
sc_time_stamp() + delay + dataStrobe.end, payload);
|
||||
}
|
||||
tlm_phase phase = command.toPhase();
|
||||
|
||||
iSocket->nb_transport_fw(payload, phase, delay);
|
||||
}
|
||||
|
||||
void ControllerRecordable::recordPhase(tlm_generic_payload &trans, const tlm_phase &phase, const sc_time &delay)
|
||||
{
|
||||
sc_time recTime = delay + sc_time_stamp();
|
||||
|
||||
@@ -54,7 +54,6 @@ protected:
|
||||
sc_core::sc_time &delay) override;
|
||||
|
||||
void sendToFrontend(tlm::tlm_generic_payload& trans, tlm::tlm_phase& phase, sc_core::sc_time& delay) override;
|
||||
void sendToDram(Command command, tlm::tlm_generic_payload& trans, sc_core::sc_time& delay) override;
|
||||
|
||||
void controllerMethod() override;
|
||||
|
||||
|
||||
@@ -105,7 +105,19 @@ void DramRecordable<BaseDram>::recordPhase(tlm_generic_payload &trans, const tlm
|
||||
bg) + " bank " + std::to_string(bank) + " row " + std::to_string(row) + " column " +
|
||||
std::to_string(col) + " at " + recTime.to_string());
|
||||
|
||||
tlmRecorder.recordPhase(trans, phase, recTime);
|
||||
Command command(phase);
|
||||
|
||||
if (phaseHasDataStrobe(phase))
|
||||
{
|
||||
TimeInterval intervalOnDataStrobe = this->memSpec.getIntervalOnDataStrobe(command, trans);
|
||||
intervalOnDataStrobe.start = intervalOnDataStrobe.start + recTime;
|
||||
intervalOnDataStrobe.end = intervalOnDataStrobe.end + recTime;
|
||||
tlmRecorder.recordPhase(trans, phase, recTime, std::move(intervalOnDataStrobe));
|
||||
}
|
||||
else
|
||||
{
|
||||
tlmRecorder.recordPhase(trans, phase, recTime);
|
||||
}
|
||||
|
||||
if (phaseNeedsEnd(phase))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user