resources folder
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "DebugManager.h"
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -18,30 +19,43 @@ DebugManager& DebugManager::getInstance()
|
||||
|
||||
void DebugManager::printDebug(string message, Sender sender, Importance importance)
|
||||
{
|
||||
cout << "[" << importanceToString(importance) << "]";
|
||||
if(printTime) std::cout << " at " << sc_time_stamp();
|
||||
if(printLocation) std::cout << " in " << senderToString(sender);
|
||||
cout << ": " << message << endl;
|
||||
bool show = count(whiteList.begin(), whiteList.end(),
|
||||
pair<Sender, Importance>(sender, importance));
|
||||
if (show)
|
||||
{
|
||||
cout << "[" << importanceToString(importance) << "]";
|
||||
if (printTime)
|
||||
std::cout << " at " << sc_time_stamp();
|
||||
if (printLocation)
|
||||
std::cout << " in " << senderToString(sender);
|
||||
cout << ": " << message << endl;
|
||||
}
|
||||
}
|
||||
|
||||
string DebugManager::importanceToString(Importance importancy)
|
||||
{
|
||||
switch(importancy)
|
||||
switch (importancy)
|
||||
{
|
||||
case Importance::Info: return "[Info]";
|
||||
case Importance::Warning: return "[Warning]";
|
||||
case Importance::Error: return "[Error]";
|
||||
case Importance::Info:
|
||||
return "Info";
|
||||
case Importance::Warning:
|
||||
return "Warning";
|
||||
case Importance::Error:
|
||||
return "Error";
|
||||
}
|
||||
return "unknown importance";
|
||||
}
|
||||
|
||||
string DebugManager::senderToString(Sender sender)
|
||||
{
|
||||
switch(sender)
|
||||
switch (sender)
|
||||
{
|
||||
case Sender::Core: return "Core";
|
||||
case Sender::Scheduler: return "Scheduler";
|
||||
case Sender::TracePlayer: return "TracePlayer";
|
||||
case Sender::Core:
|
||||
return "Core";
|
||||
case Sender::Scheduler:
|
||||
return "Scheduler";
|
||||
case Sender::TracePlayer:
|
||||
return "TracePlayer";
|
||||
}
|
||||
return "unknown sender";
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ class DebugManager
|
||||
public:
|
||||
static DebugManager& getInstance();
|
||||
|
||||
std::vector<std::pair<Sender, Importance>> whiteList;
|
||||
|
||||
bool printTime;
|
||||
bool printLocation;
|
||||
|
||||
@@ -6,13 +6,12 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
tlmDBPhaseRecorder::tlmDBPhaseRecorder(string name, string pathToConfigs) :
|
||||
transactionIDCounter(1), PicosecondsPerNanosecond(1e3), pathToConfigs(pathToConfigs)
|
||||
tlmDBPhaseRecorder::tlmDBPhaseRecorder(string name, string pathToURI) :
|
||||
transactionIDCounter(1), PicosecondsPerNanosecond(1e3)
|
||||
{
|
||||
|
||||
setUpTransactionTerminatingPhases();
|
||||
openDB(name.c_str());
|
||||
createTables();
|
||||
createTables(pathToURI);
|
||||
cout << "Created tables in file " << name << std::endl;
|
||||
cout << "Set up terminating phases " << name << std::endl;
|
||||
prepareSqlStatements();
|
||||
@@ -63,9 +62,9 @@ void tlmDBPhaseRecorder::recordDebugMessage(std::string message, sc_time time)
|
||||
insertDebugMessageInDB(message, time);
|
||||
}
|
||||
|
||||
void tlmDBPhaseRecorder::createTables()
|
||||
void tlmDBPhaseRecorder::createTables(string pathToURI)
|
||||
{
|
||||
string initial = getFileContents(pathToConfigs + string("/createTraceDB.sql"));
|
||||
string initial = getFileContents(pathToURI);
|
||||
executeSqlCommand(initial);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class tlmDBPhaseRecorder
|
||||
{
|
||||
public:
|
||||
|
||||
tlmDBPhaseRecorder(std::string name, std::string pathToConfigs);
|
||||
tlmDBPhaseRecorder(std::string name, std::string pathToURI);
|
||||
~tlmDBPhaseRecorder();
|
||||
|
||||
void recordPhase(tlm::tlm_generic_payload &trans, tlm::tlm_phase phase, sc_time time);
|
||||
@@ -38,7 +38,7 @@ private:
|
||||
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 createTables(std::string pathToURI);
|
||||
void insertGeneralInfo();
|
||||
void insertTransactionInDB(unsigned int transactionID, tlm::tlm_generic_payload& trans);
|
||||
void insertRangeInDB(unsigned int transactionID, const sc_time& time);
|
||||
@@ -58,7 +58,6 @@ private:
|
||||
insertDebugMessageString;
|
||||
|
||||
double PicosecondsPerNanosecond;
|
||||
std::string pathToConfigs;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,19 +25,13 @@
|
||||
using namespace std;
|
||||
|
||||
int sc_main(int argc, char **argv) {
|
||||
string executableName(argv[0]);
|
||||
string pathOfExecutable = executableName.substr(0,executableName.find_last_of('/'));
|
||||
//string pathToStaticFolder = pathOfExecutable + string("../static");
|
||||
string pathToStaticFolder = string("/home/jonny/git/dram/dram/static");
|
||||
xmlAddressDecoder::URI = pathToStaticFolder + string("/addressConfig.xml");
|
||||
string resources = pathOfFile(argv[0]) + string("/../resources/");
|
||||
|
||||
tlmDBPhaseRecorder *recorder = new tlmDBPhaseRecorder("tpr.tdb", pathToStaticFolder);
|
||||
|
||||
//TracePlayer<> player("player","/home/robert/traces/trace.stl");
|
||||
//TracePlayer<> player("player",string("/home/robert/common/common/static/test2.stl"));
|
||||
//TracePlayer<> player("player",string("/home/jonny/traces/mediabench-h263encode_32.stl"));
|
||||
TracePlayer<> player("player",string("/home/jonny/traces/mediabench-h263decode_32.stl"));
|
||||
xmlAddressDecoder::URI = resources + string("configs/addressConfig.xml");
|
||||
tlmDBPhaseRecorder *recorder = new tlmDBPhaseRecorder("tpr.tdb", resources + string("scripts/createTraceDB.sql"));
|
||||
TracePlayer<> player("player",resources + string("traces/mediabench-h263encode_32.stl"));
|
||||
|
||||
//DebugManager::getInstance().whiteList.push_back(pair<Sender, Importance>(Sender::TracePlayer, Importance::Info));
|
||||
cout << "Toplevel: build player" << std::endl;
|
||||
Dram<> dram("dram");
|
||||
cout << "Toplevel: build dram" << std::endl;
|
||||
@@ -64,7 +58,7 @@ int sc_main(int argc, char **argv) {
|
||||
|
||||
delete recorder;
|
||||
|
||||
string testingScript = pathToStaticFolder + string("/tests.py");
|
||||
string testingScript = resources + string("/scripts/tests.py");
|
||||
string runTestCommand = string("python ") + testingScript + string(" tpr.tdb");
|
||||
//system(runTestCommand.c_str());
|
||||
|
||||
@@ -72,3 +66,8 @@ int sc_main(int argc, char **argv) {
|
||||
system(run_tpr.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
string pathOfFile(string file)
|
||||
{
|
||||
return file.substr(0,file.find_last_of('/'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user