diff --git a/analyzer/analyzer/businessObjects/tracetime.h b/analyzer/analyzer/businessObjects/tracetime.h index 88bc022c..d2da51de 100644 --- a/analyzer/analyzer/businessObjects/tracetime.h +++ b/analyzer/analyzer/businessObjects/tracetime.h @@ -6,11 +6,18 @@ //time in nanoseconds typedef long long traceTime; -inline QString formatTraceTimePretty(traceTime time) +inline QString prettyFormatTime(traceTime time) { return QString::number(time/1000) + QString(" ns"); } +inline QString formatInClks(traceTime time, unsigned int clkPeriod) +{ + long long numberOfClockCovered = time/clkPeriod; + QString suffix = (numberOfClockCovered != 1) ? QString(" clks") : QString(" clk"); + return QString::number(numberOfClockCovered) + suffix; +} + inline traceTime alignToClk(traceTime time, unsigned int clkPeriod) { return round(1.0*time/clkPeriod)*clkPeriod; diff --git a/analyzer/analyzer/data/tracedb.cpp b/analyzer/analyzer/data/tracedb.cpp index 1ca511ce..46317aaa 100644 --- a/analyzer/analyzer/data/tracedb.cpp +++ b/analyzer/analyzer/data/tracedb.cpp @@ -11,7 +11,7 @@ //define symbol printqueries if all queries should be printed to the console -//#define printqueries +#define printqueries using namespace std; @@ -175,7 +175,7 @@ GeneralInfo TraceDB::getGeneralInfoFromDB() description += memspec + "\n"; description += "Number of Transactions: " + QString::number(numberOfTransactions) + "\n"; description += "Clock period: " + QString::number(clkPeriod) + " " + unitOfTime + "\n"; - description += "Length of trace: " + formatTraceTimePretty(traceEnd); + description += "Length of trace: " + prettyFormatTime(traceEnd); return GeneralInfo(numberOfTransactions, numberOfPhases, Timespan(0,traceEnd),numberOfBanks,description,unitOfTime,clkPeriod); } diff --git a/analyzer/analyzer/evaluationtool.cpp b/analyzer/analyzer/evaluationtool.cpp index 4ca3d52c..16f2af3d 100644 --- a/analyzer/analyzer/evaluationtool.cpp +++ b/analyzer/analyzer/evaluationtool.cpp @@ -17,7 +17,7 @@ using namespace std; EvaluationTool::EvaluationTool(QWidget *parent) : QWidget(parent), - ui(new Ui::EvaluationTool), path("../../dram/resources/scripts""") + ui(new Ui::EvaluationTool), resourcesRelPath("/../../dram/resources/scripts""") { ui->setupUi(this); traceFilesModel = new QStandardItemModel(this); @@ -83,7 +83,9 @@ void EvaluationTool::on_btn_test_clicked() void EvaluationTool::runTests() { - PythonCaller pythonCaller(this->path); + QString resourcesAbsPath = QApplication::applicationDirPath() + this->resourcesRelPath; + qDebug() << resourcesAbsPath; + PythonCaller pythonCaller(this->resourcesRelPath); ui->traceTestTreeWidget->clear(); ui->testLight->setGray(); @@ -116,8 +118,9 @@ void EvaluationTool::on_btn_calculateMetrics_clicked() void EvaluationTool::calculateMetrics() { - qDebug() << this->path; - PythonCaller pythonCaller(this->path); + QString resourcesAbsPath = QApplication::applicationDirPath() + this->resourcesRelPath; + qDebug() << resourcesAbsPath; + PythonCaller pythonCaller(this->resourcesRelPath); ui->traceMetricTreeWidget->clear(); for(int row = 0; row < traceFilesModel->rowCount(); ++row) { diff --git a/analyzer/analyzer/evaluationtool.h b/analyzer/analyzer/evaluationtool.h index c9a4bfd5..94359a1d 100644 --- a/analyzer/analyzer/evaluationtool.h +++ b/analyzer/analyzer/evaluationtool.h @@ -45,7 +45,7 @@ private: Ui::EvaluationTool *ui; QStandardItemModel *traceFilesModel; std::vector calculatedMetrics; - QString path; + QString resourcesRelPath; class TraceFileItem : public QStandardItem { diff --git a/analyzer/analyzer/presentation/commenttreewidget.cpp b/analyzer/analyzer/presentation/commenttreewidget.cpp index 3cbcff55..8ff025dd 100644 --- a/analyzer/analyzer/presentation/commenttreewidget.cpp +++ b/analyzer/analyzer/presentation/commenttreewidget.cpp @@ -60,6 +60,6 @@ void CommentTreeWidget::ContextMenuRequested(QPoint point) CommentTreeWidget::CommentTreeItem::CommentTreeItem(QTreeWidget *parent, const Comment &comment):QTreeWidgetItem(parent),comment(comment) { - this->setText(0,formatTraceTimePretty(comment.Time())); + this->setText(0,prettyFormatTime(comment.Time())); this->setText(1,comment.Text()); } diff --git a/analyzer/analyzer/presentation/debugmessagetreewidget.cpp b/analyzer/analyzer/presentation/debugmessagetreewidget.cpp index 01a58ea5..18344844 100644 --- a/analyzer/analyzer/presentation/debugmessagetreewidget.cpp +++ b/analyzer/analyzer/presentation/debugmessagetreewidget.cpp @@ -56,7 +56,7 @@ void DebugMessageTreeWidget::showDebugMessages(const vector& comments) { if(currentTime != comment.Time()) { - addTopLevelItem(new QTreeWidgetItem({formatTraceTimePretty(comment.Time()), formatDebugMessage(comment.Text())})); + addTopLevelItem(new QTreeWidgetItem({prettyFormatTime(comment.Time()), formatDebugMessage(comment.Text())})); currentTime = comment.Time(); } else diff --git a/analyzer/analyzer/presentation/tracePlotMouseLabel.cpp b/analyzer/analyzer/presentation/tracePlotMouseLabel.cpp index 06209dc2..aa05c412 100644 --- a/analyzer/analyzer/presentation/tracePlotMouseLabel.cpp +++ b/analyzer/analyzer/presentation/tracePlotMouseLabel.cpp @@ -11,12 +11,14 @@ QwtText TracePlotMouseLabel::trackerText(const QPoint &point) const if(mode == MouseLabelMode::AbsoluteTime) { traceTime mouseTime = static_cast(traceplot->invTransform(traceplot->xBottom, point.x())); - return QwtText(formatTraceTimePretty(alignToClk(mouseTime,clkPeriod))); + return QwtText(prettyFormatTime(alignToClk(mouseTime,clkPeriod)) + "(" + formatInClks(mouseTime,clkPeriod) + ")"); } else if(mode == MouseLabelMode::Timedifference) { - long long numberOfClockCovered = timeDifferenceSpan.timeCovered()/clkPeriod; - QString suffix = (numberOfClockCovered != 1) ? QString(" clks") : QString(" clk"); - return(QwtText(QString::number(numberOfClockCovered) + suffix)); + return QwtText(formatInClks(timeDifferenceSpan.timeCovered(),clkPeriod)); + } + else + { + Q_ASSERT(false); } } diff --git a/analyzer/analyzer/presentation/tracePlotMouseLabel.h b/analyzer/analyzer/presentation/tracePlotMouseLabel.h index 9043745e..2e5fe3ae 100644 --- a/analyzer/analyzer/presentation/tracePlotMouseLabel.h +++ b/analyzer/analyzer/presentation/tracePlotMouseLabel.h @@ -12,7 +12,7 @@ public: TracePlotMouseLabel(TracePlot* traceplot, unsigned int clkPeriod, Timespan& timeDifferenceSpan): QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,QwtPlotPicker::VLineRubberBand, QwtPicker::AlwaysOn, traceplot->canvas()), - traceplot(traceplot),clkPeriod(clkPeriod), timeDifferenceSpan(timeDifferenceSpan), mode(MouseLabelMode::AbsoluteTime){} + mode(MouseLabelMode::AbsoluteTime),traceplot(traceplot),clkPeriod(clkPeriod), timeDifferenceSpan(timeDifferenceSpan){} void setMode(MouseLabelMode mode); protected: @@ -21,8 +21,8 @@ protected: private: MouseLabelMode mode; TracePlot* traceplot; - Timespan& timeDifferenceSpan; unsigned int clkPeriod; + Timespan& timeDifferenceSpan; }; #endif // TRACEPLOTPICKER_H diff --git a/analyzer/analyzer/presentation/tracenavigator.cpp b/analyzer/analyzer/presentation/tracenavigator.cpp index 74d11733..c3b06ae2 100644 --- a/analyzer/analyzer/presentation/tracenavigator.cpp +++ b/analyzer/analyzer/presentation/tracenavigator.cpp @@ -73,8 +73,6 @@ void TraceNavigator::commitChangesToDB() } traceFile.updateComments(commentsToInsert); - //TODO : reinsert file description logic - //traceFile.updateFileDescription(traceFile.getGeneralInfo().Description()); changesToCommitExist = false; } @@ -86,12 +84,6 @@ void TraceNavigator::getCommentsFromDB() } } -void TraceNavigator::setFileDescripton(const QString &description) -{ - //TODO : reinsert file description logic - changesToCommitExist = true; -} - void TraceNavigator::refreshData() { traceFile.refreshData(); diff --git a/analyzer/analyzer/presentation/tracenavigator.h b/analyzer/analyzer/presentation/tracenavigator.h index aad497db..b20cfdae 100644 --- a/analyzer/analyzer/presentation/tracenavigator.h +++ b/analyzer/analyzer/presentation/tracenavigator.h @@ -57,7 +57,6 @@ public: const CommentMap& getComments(){return comments;} void removeCommentAtTime(traceTime time); - void setFileDescripton(const QString& text); void commitChangesToDB(); void refreshData(); diff --git a/analyzer/analyzer/presentation/traceplot.cpp b/analyzer/analyzer/presentation/traceplot.cpp index 3127aea9..f17da2f4 100644 --- a/analyzer/analyzer/presentation/traceplot.cpp +++ b/analyzer/analyzer/presentation/traceplot.cpp @@ -361,7 +361,7 @@ void TracePlot::on_insertComment() { traceTime time = invTransform(xBottom, contextMenuMouseDown.x()); bool ok; - QString text = QInputDialog::getText(this,QString("Insert comment"),QString("Insert comment at ") + formatTraceTimePretty(time),QLineEdit::Normal,QString(),&ok); + QString text = QInputDialog::getText(this,QString("Insert comment"),QString("Insert comment at ") + prettyFormatTime(time),QLineEdit::Normal,QString(),&ok); if(ok) { navigator->insertComment(Comment(time,text)); diff --git a/analyzer/analyzer/presentation/transactiontreewidget.cpp b/analyzer/analyzer/presentation/transactiontreewidget.cpp index 6c686eb8..c0d4bc2f 100644 --- a/analyzer/analyzer/presentation/transactiontreewidget.cpp +++ b/analyzer/analyzer/presentation/transactiontreewidget.cpp @@ -54,7 +54,7 @@ TransactionTreeWidget::TransactionTreeItem::TransactionTreeItem(QTreeWidget *par QTreeWidgetItem *time = new QTreeWidgetItem({"Timespan"}); AppendTimespan(time, transaction->Span()); this->addChild(time); - this->addChild(new QTreeWidgetItem( {"Lenght", formatTraceTimePretty(transaction->Span().timeCovered())})); + this->addChild(new QTreeWidgetItem( {"Lenght", prettyFormatTime(transaction->Span().timeCovered())})); this->addChild(new QTreeWidgetItem( {"Channel", QString::number(transaction->Channel())})); this->addChild(new QTreeWidgetItem( {"Bank", QString::number(transaction->Bank())} )); @@ -89,6 +89,6 @@ void TransactionTreeWidget::TransactionTreeItem::AppendPhase(QTreeWidgetItem *pa void TransactionTreeWidget::TransactionTreeItem::AppendTimespan(QTreeWidgetItem *parent, const Timespan ×pan) { - parent->setText(1, formatTraceTimePretty(timespan.Begin())); - parent->setText(2, formatTraceTimePretty(timespan.End())); + parent->setText(1, prettyFormatTime(timespan.Begin())); + parent->setText(2, prettyFormatTime(timespan.End())); } diff --git a/analyzer/analyzer/tracefiletab.cpp b/analyzer/analyzer/tracefiletab.cpp index fde96b89..93801aa4 100644 --- a/analyzer/analyzer/tracefiletab.cpp +++ b/analyzer/analyzer/tracefiletab.cpp @@ -20,7 +20,6 @@ TraceFileTab::TraceFileTab(QWidget *parent,const QString& path) : TraceFileTab::~TraceFileTab() { - navigator->setFileDescripton(ui->fileDescriptionEdit->toPlainText()); navigator->commitChangesToDB(); delete ui; } diff --git a/dram/resources/simulations/sim-batch.xml b/dram/resources/simulations/sim-batch.xml index f3ad5c97..549dcba6 100644 --- a/dram/resources/simulations/sim-batch.xml +++ b/dram/resources/simulations/sim-batch.xml @@ -9,21 +9,14 @@ fifo.xml - fr_fcfs.xml + - - mediabench-epic_32.stl + chstone-jpeg_32.stl diff --git a/dram/src/simulation/main.cpp b/dram/src/simulation/main.cpp index 19f063f6..c064bc67 100644 --- a/dram/src/simulation/main.cpp +++ b/dram/src/simulation/main.cpp @@ -39,7 +39,7 @@ int sc_main(int argc, char **argv) if(argc > 1) simulationToRun = argv[1]; else - simulationToRun = "tests.xml"; + simulationToRun = "sim-batch.xml"; SimulationManager manager(resources); manager.loadSimulationsFromXML(resources + "/simulations/" + simulationToRun);