65 lines
2.2 KiB
C++
Executable File
65 lines
2.2 KiB
C++
Executable File
#ifndef TLMPHASERECORDER_H
|
|
#define TLMPHASERECORDER_H
|
|
|
|
#include <iostream>
|
|
#include <ostream>
|
|
#include <string>
|
|
#include <map>
|
|
#include <algorithm>
|
|
#include <sqlite3.h>
|
|
#include <fstream>
|
|
#include <cerrno>
|
|
#include <tlm.h>
|
|
#include <systemc.h>
|
|
#include "xmlAddressdecoder.h"
|
|
|
|
using namespace std;
|
|
|
|
class tlmDBPhaseRecorder
|
|
{
|
|
public:
|
|
|
|
tlmDBPhaseRecorder(std::string name, std::string pathToConfigs);
|
|
~tlmDBPhaseRecorder();
|
|
|
|
void recordPhase(tlm::tlm_generic_payload &trans, tlm::tlm_phase phase, sc_time time);
|
|
void recordDebugMessage(std::string message, sc_time time);
|
|
|
|
private:
|
|
std::string phaseToString(tlm::tlm_phase phase);
|
|
std::string getFileContents(std::string filename);
|
|
|
|
void executeSqlCommand(std::string command);
|
|
void executeSqlStatement(sqlite3_stmt* statement);
|
|
void prepareSqlStatements();
|
|
void openDB(std::string name);
|
|
void setUpTransactionTerminatingPhases();
|
|
|
|
void introduceNewTransactionToSystem(const sc_time& time, tlm::tlm_generic_payload& trans);
|
|
void removeTransactionFromSystem(const sc_time& time, unsigned int transactionID, tlm::tlm_generic_payload& trans);
|
|
|
|
void createTables();
|
|
void insertGeneralInfo();
|
|
void insertTransactionInDB(unsigned int transactionID, tlm::tlm_generic_payload& trans);
|
|
void insertRangeInDB(unsigned int transactionID, const sc_time& time);
|
|
void insertPhaseInDB(string phaseName, const sc_time& time, unsigned int transactionID);
|
|
void updatePhaseEndInDB(string phaseName, const sc_time& time, unsigned int transactionID);
|
|
void insertDebugMessageInDB(string message, const sc_time& time);
|
|
|
|
static const int transactionCommitRate = 10000;
|
|
map<tlm::tlm_generic_payload*, unsigned int> currentTransactionsInSystem;
|
|
unsigned int transactionIDCounter;
|
|
sc_time recordingEndTime;
|
|
std::vector<tlm::tlm_phase> transactionTerminatingPhases;
|
|
sqlite3 *db;
|
|
sqlite3_stmt *insertTransactionStatement, *insertRangeStatement, *updateRangeStatement,
|
|
*insertPhaseStatement, *updatePhaseStatement, *insertGeneralInfoStatement, *insertDebugMessageStatement;
|
|
std::string insertTransactionString, insertRangeString, updateRangeString, insertPhaseString, updatePhaseString, insertGeneralInfoString,
|
|
insertDebugMessageString;
|
|
|
|
double PicosecondsPerNanosecond;
|
|
std::string pathToConfigs;
|
|
};
|
|
|
|
#endif
|