From 166ec66a92569310eed7f2055787e5037f45042d Mon Sep 17 00:00:00 2001 From: Iron Prando da Silva Date: Mon, 18 Oct 2021 10:42:47 +0200 Subject: [PATCH 01/18] Added dependency visualizations. --- DRAMSys/traceAnalyzer/CMakeLists.txt | 1 + .../businessObjects/phases/phase.cpp | 58 ++++++++++- .../businessObjects/phases/phase.h | 12 +++ .../phases/phasedependency.cpp | 98 +++++++++++++++++++ .../businessObjects/phases/phasedependency.h | 41 ++++++++ DRAMSys/traceAnalyzer/data/QueryTexts.h | 8 ++ DRAMSys/traceAnalyzer/data/tracedb.cpp | 91 ++++++++++++++++- DRAMSys/traceAnalyzer/data/tracedb.h | 9 +- DRAMSys/traceAnalyzer/mainwindow.cpp | 1 + .../traceAnalyzer/presentation/traceplot.cpp | 2 + .../presentation/tracescroller.cpp | 2 + 11 files changed, 317 insertions(+), 6 deletions(-) create mode 100644 DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp create mode 100644 DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.h diff --git a/DRAMSys/traceAnalyzer/CMakeLists.txt b/DRAMSys/traceAnalyzer/CMakeLists.txt index 96594a93..361f8553 100644 --- a/DRAMSys/traceAnalyzer/CMakeLists.txt +++ b/DRAMSys/traceAnalyzer/CMakeLists.txt @@ -90,6 +90,7 @@ add_executable(TraceAnalyzer businessObjects/tracetestresults.cpp presentation/tracemetrictreewidget.cpp businessObjects/phases/phase.cpp + businessObjects/phases/phasedependency.cpp presentation/tracedrawingproperties.cpp presentation/util/traceplotline.cpp presentation/util/traceplotlinecache.cpp diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp index 4f89bf0f..17a46d4e 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp @@ -67,9 +67,22 @@ void Phase::draw(QPainter *painter, const QwtScaleMap &xMap, for (auto line : getTracePlotLines(drawingProperties)) { - if (!line->isCollapsed()) + if (!line->isCollapsed()) { drawPhaseSymbol(span.Begin(), span.End(), line->getYVal(), drawingProperties.drawText, getPhaseSymbol(), painter, xMap, yMap); + + if (getGranularity() == Granularity::Bankwise) { + bool drawAllDependencies = false; + bool drawDependencies = true; + bool drawDependencyText = true; + if (drawAllDependencies || (highlight && drawDependencies)) { + drawPhaseDependencies(span.Begin(), span.End(), line->getYVal(), + drawingProperties, drawDependencyText, painter, xMap, yMap); + } + + } + + } } for (Timespan span : spansOnCommandBus) @@ -116,6 +129,45 @@ void Phase::drawPhaseSymbol(traceTime begin, traceTime end, double y, static_cast(yVal + symbolHeight / 2)), TextPositioning::bottomRight); } +void Phase::drawPhaseDependencies(traceTime begin, traceTime end, double y, const TraceDrawingProperties &drawingProperties, + bool drawtext, QPainter *painter, const QwtScaleMap &xMap, + const QwtScaleMap &yMap) const +{ + QPen pen; + pen.setWidth(2); + painter->setPen(pen); + painter->setRenderHint(QPainter::Antialiasing); + + double yVal = yMap.transform(y); + double symbolHeight = yMap.transform(0) - yMap.transform(hexagonHeight); + + traceTime offset = (begin == end) ? static_cast(0.05 * clk) : 0; + + size_t invisibleDeps = 0; + + QPoint depLineTo(static_cast(xMap.transform(begin/* + (end + offset - begin)/4*/)), static_cast(yVal)); + + for (auto dep : _dependencies) { + bool visible = false; + if (dep->isVisible()) { + if (!dep->draw(depLineTo, drawingProperties, drawtext, painter, xMap, yMap) ) { + invisibleDeps += 1; + } + + } else { + invisibleDeps += 1; + + } + } + + if (invisibleDeps > 0) { + QPoint invisibleDepsPoint(static_cast(xMap.transform(begin + (end + offset - begin)/2)), static_cast(yVal + 0.1*symbolHeight)); + drawText(painter, QString(std::to_string(invisibleDeps).c_str()), invisibleDepsPoint, TextPositioning::centerCenter); + } + + +} + QColor Phase::getColor(const TraceDrawingProperties &drawingProperties) const { switch (drawingProperties.colorGrouping) { @@ -197,3 +249,7 @@ std::vector> Phase::getTracePlotLines(const Trace % drawingProperties.banksPerGroup); } } + +void Phase::addDependency(std::shared_ptr dependency) { + _dependencies.push_back(dependency); +} diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.h b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.h index df6185aa..87c819ef 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.h +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.h @@ -41,6 +41,7 @@ #include "presentation/util/colorgenerator.h" #include "presentation/tracedrawingproperties.h" #include "businessObjects/timespan.h" +#include "businessObjects/phases/phasedependency.h" #include #include #include @@ -75,6 +76,8 @@ public: } virtual QString Name() const = 0; + void addDependency(std::shared_ptr dependency); + protected: ID id; Timespan span; @@ -82,6 +85,8 @@ protected: std::weak_ptr transaction; std::vector spansOnCommandBus; std::shared_ptr spanOnDataBus; + std::vector> _dependencies; + double hexagonHeight; TextPositioning captionPosition; @@ -94,6 +99,11 @@ protected: virtual void drawPhaseSymbol(traceTime begin, traceTime end, double y, bool drawtext, PhaseSymbol symbol, QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap) const; + virtual void drawPhaseDependencies(traceTime begin, traceTime end, double y, + const TraceDrawingProperties &drawingProperties, + bool drawtext, QPainter *painter, const QwtScaleMap &xMap, + const QwtScaleMap &yMap) const; + virtual std::vector> getTracePlotLines(const TraceDrawingProperties &drawingProperties) const; @@ -103,6 +113,8 @@ protected: { return Granularity::Bankwise; } + + friend class PhaseDependency; }; class REQ : public Phase diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp new file mode 100644 index 00000000..05bbdc61 --- /dev/null +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp @@ -0,0 +1,98 @@ +#include "phasedependency.h" +#include "phase.h" +#include + +PhaseDependency::PhaseDependency(DependencyType type, QString timeDependency, std::shared_ptr dependency) +{ + _type = type; + _timeDependency = timeDependency; + _dependency = dependency; +} + +PhaseDependency::PhaseDependency(DependencyType type, QString timeDependency) +{ + _type = type; + _timeDependency = timeDependency; + _dependency = nullptr; + _isInvisible = true; +} + +PhaseDependency::~PhaseDependency() +{ + +} + +bool PhaseDependency::draw(QPoint& end, const TraceDrawingProperties &drawingProperties, + bool drawtext, QPainter *painter, const QwtScaleMap &xMap, + const QwtScaleMap &yMap) +{ + if (_isInvisible) return false; + + traceTime depBegin = _dependency->span.Begin(); + traceTime depEnd = _dependency->span.End(); + + if (xMap.transform(depEnd) < 0) return false; + + bool drawn = false; + for (auto line : _dependency->getTracePlotLines(drawingProperties)) { + if (!line->isCollapsed()) { + _draw(end, line->getYVal(), drawingProperties, drawtext, painter, xMap, yMap); + drawn = true; + } + } + + + + return drawn; +} + +void PhaseDependency::_draw(QPoint& end, double depY, const TraceDrawingProperties &drawingProperties, + bool drawtext, QPainter *painter, const QwtScaleMap &xMap, + const QwtScaleMap &yMap) +{ + traceTime depBegin = _dependency->span.Begin(); + traceTime depEnd = _dependency->span.End(); + + traceTime depOffset = (depBegin == depEnd) ? static_cast(0.05 * _dependency->clk) : 0; + + double depYVal = yMap.transform(depY); + double depSymbolHeight = yMap.transform(0) - yMap.transform(_dependency->hexagonHeight); + QPoint depLineFrom(static_cast(xMap.transform(depBegin/* + (depEnd + depOffset - depBegin)/4*/)), static_cast(depYVal)); + + QLineF line(depLineFrom, end); + double angle = std::atan2(-line.dy(), line.dx()); + + qreal arrowSize = 10; + QPointF arrowP1 = line.p2() - QPointF(sin(angle + M_PI / 3) * arrowSize, cos(angle + M_PI / 3) * arrowSize); + QPointF arrowP2 = line.p2() - QPointF(sin(angle + M_PI - M_PI / 3) * arrowSize, cos(angle + M_PI - M_PI / 3) * arrowSize); + QPolygonF arrowHead; + arrowHead << line.p2() << arrowP1 << arrowP2; + + QColor color = _dependency->getColor(drawingProperties); + painter->setBrush(QBrush(color, _dependency->getBrushStyle())); + + painter->drawLine(line); + painter->drawPolygon(arrowHead); + + if (drawtext) { + QPoint textPosition(line.x1() + (line.x2() - line.x1()) / 2, line.y1() + (line.y2() - line.y1()) / 2); + auto alignment = TextPositioning::topRight; + + if (textPosition.y() == line.y1()) { + alignment = TextPositioning::topCenter; + + } else if (textPosition.x() == line.x1()) { + if (line.y1() > line.y2()) { + alignment = TextPositioning::bottomRight; + } + } + + drawText( + painter, + _timeDependency, + textPosition, + alignment + ); + + } +} \ No newline at end of file diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.h b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.h new file mode 100644 index 00000000..34fc4ec0 --- /dev/null +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.h @@ -0,0 +1,41 @@ +#pragma once + +#include "presentation/tracedrawingproperties.h" +#include "businessObjects/timespan.h" + +#include +#include +#include +#include +#include + +class Phase; + +enum DependencyType { + Bank, Rank, InterRank +}; + +class PhaseDependency +{ + public: + PhaseDependency(DependencyType type, QString timeDependency, std::shared_ptr dependency); + PhaseDependency(DependencyType type, QString timeDependency); + ~PhaseDependency(); + + bool isVisible() { return !_isInvisible; } + + bool draw(QPoint& end, const TraceDrawingProperties &drawingProperties, + bool drawtext, QPainter *painter, const QwtScaleMap &xMap, + const QwtScaleMap &yMap); + + protected: + DependencyType _type; + QString _timeDependency; + std::shared_ptr _dependency; + + bool _isInvisible = false; + + void _draw(QPoint& end, double depY, const TraceDrawingProperties &drawingProperties, + bool drawtext, QPainter *painter, const QwtScaleMap &xMap, + const QwtScaleMap &yMap); +}; diff --git a/DRAMSys/traceAnalyzer/data/QueryTexts.h b/DRAMSys/traceAnalyzer/data/QueryTexts.h index 4101d106..9ff3d2a5 100644 --- a/DRAMSys/traceAnalyzer/data/QueryTexts.h +++ b/DRAMSys/traceAnalyzer/data/QueryTexts.h @@ -42,6 +42,7 @@ struct TransactionQueryTexts { QString queryHead; QString selectTransactionsByTimespan, selectTransactionById; + QString checkDependenciesExist, selectDependenciesByTimespan; TransactionQueryTexts() { @@ -53,6 +54,13 @@ struct TransactionQueryTexts { " WHERE Ranges.end >= :begin AND Ranges.begin <= :end"; selectTransactionById = queryHead + " WHERE Transactions.ID = :id"; + checkDependenciesExist = "SELECT CASE WHEN 0 < (SELECT count(*) FROM sqlite_master WHERE type = 'table' AND name = 'DirectDependencies') THEN 1 ELSE 0 END AS result"; + selectDependenciesByTimespan = "WITH timespanTransactions AS (" + selectTransactionsByTimespan + + ") SELECT * from DirectDependencies WHERE DelayedPhaseID IN (" + " SELECT DirectDependencies.DelayedPhaseID FROM DirectDependencies JOIN timespanTransactions " + " ON DirectDependencies.DelayedPhaseID = timespanTransactions.PhaseID )"; + + } }; diff --git a/DRAMSys/traceAnalyzer/data/tracedb.cpp b/DRAMSys/traceAnalyzer/data/tracedb.cpp index a30c3c77..2a3ace91 100644 --- a/DRAMSys/traceAnalyzer/data/tracedb.cpp +++ b/DRAMSys/traceAnalyzer/data/tracedb.cpp @@ -85,6 +85,12 @@ void TraceDB::prepareQueries() selectDebugMessagesByTimespan.prepare("SELECT time, Message FROM DebugMessages WHERE :begin <= time AND time <= :end "); selectDebugMessagesByTimespanWithLimit = QSqlQuery(database); selectDebugMessagesByTimespanWithLimit.prepare("SELECT time, Message FROM DebugMessages WHERE :begin <= time AND time <= :end LIMIT :limit"); + + checkDependenciesExist = QSqlQuery(database); + checkDependenciesExist.prepare(queryTexts.checkDependenciesExist); + selectDependenciesByTimespan = QSqlQuery(database); + selectDependenciesByTimespan.prepare(queryTexts.selectDependenciesByTimespan); + } void TraceDB::updateComments(const std::vector &comments) @@ -133,9 +139,25 @@ vector> TraceDB::getTransactionsInTimespan( selectTransactionsByTimespan.bindValue(":begin", span.Begin()); selectTransactionsByTimespan.bindValue(":end", span.End()); executeQuery(selectTransactionsByTimespan); - return parseTransactionsFromQuery(selectTransactionsByTimespan); + return parseTransactionsFromQuery(selectTransactionsByTimespan, true); } +void TraceDB::updateDependenciesInTimespan(const Timespan &span) +{ + executeQuery(checkDependenciesExist); + if (checkDependenciesExist.next()) { + + if (checkDependenciesExist.value(0).toInt() == 1) { + selectDependenciesByTimespan.bindValue(":begin", span.Begin()); + selectDependenciesByTimespan.bindValue(":end", span.End()); + executeQuery(selectDependenciesByTimespan); + _updateDependenciesFromQuery(selectDependenciesByTimespan); + + } + + } + +} //TODO Remove exception shared_ptr TraceDB::getTransactionByID(ID id) @@ -381,8 +403,13 @@ shared_ptr TraceDB::parseTransactionFromQuery(QSqlQuery &query) } vector> TraceDB::parseTransactionsFromQuery( - QSqlQuery &query) + QSqlQuery &query, + bool updateVisiblePhases) { + if (updateVisiblePhases) { + _visiblePhases.clear(); + } + vector> result; bool firstIteration = true; @@ -416,12 +443,68 @@ vector> TraceDB::parseTransactionsFromQuery( unsigned int phaseID = query.value(14).toInt(); QString phaseName = query.value(15).toString(); Timespan span(query.value(16).toLongLong(), query.value(17).toLongLong()); - result.at(result.size() - 1)->addPhase(PhaseFactory::CreatePhase(phaseID, - phaseName, span, result.at(result.size() - 1), *this)); + auto phase = PhaseFactory::CreatePhase(phaseID, phaseName, span, result.at(result.size() - 1), *this); + result.at(result.size() - 1)->addPhase(phase); + + if (updateVisiblePhases) { + _visiblePhases[phaseID] = phase; + } + } return result; } +void TraceDB::_updateDependenciesFromQuery(QSqlQuery &query) { + DependencyType type; + while(query.next()) { + ID delayedID = query.value(0).toInt(); + ID dependencyID = query.value(4).toInt(); + + QString dependencyTypeStr = query.value(2).toString(); + if (dependencyTypeStr == "bank") { + type = DependencyType::Bank; + } else if (dependencyTypeStr == "rank") { + type = DependencyType::Rank; + } else if (dependencyTypeStr == "interRank") { + type = DependencyType::InterRank; + } + + QString timeDependencyStr = query.value(3).toString(); + + if (_visiblePhases.count(delayedID) > 0) { + + if (_visiblePhases.count(dependencyID) > 0) { + + _visiblePhases[delayedID]->addDependency( + std::shared_ptr( + new PhaseDependency( + type, + timeDependencyStr, + _visiblePhases[dependencyID] + ) + ) + ); + + } else { + + _visiblePhases[delayedID]->addDependency( + std::shared_ptr( + new PhaseDependency( + type, + timeDependencyStr + ) + ) + ); + + } + + } else { + // TODO delayed phase not visible? + } + + } +} + vector TraceDB::parseCommentsFromQuery(QSqlQuery &query) { vector result; diff --git a/DRAMSys/traceAnalyzer/data/tracedb.h b/DRAMSys/traceAnalyzer/data/tracedb.h index 18abb1ae..ef9a8454 100644 --- a/DRAMSys/traceAnalyzer/data/tracedb.h +++ b/DRAMSys/traceAnalyzer/data/tracedb.h @@ -71,6 +71,7 @@ public: void updateComments(const std::vector &comments); void updateFileDescription(const QString &description); + void updateDependenciesInTimespan(const Timespan &span); void refreshData(); const GeneralInfo &getGeneralInfo() const @@ -95,6 +96,7 @@ public: // std::shared_ptr getNextActb(ID currentTransactionId); // std::shared_ptr getNextRefb(ID currentTransactionId); + void _updateDependenciesFromQuery(QSqlQuery &query); std::shared_ptr getTransactionByID(ID id); ID getTransactionIDFromPhaseID(ID phaseID); @@ -118,6 +120,8 @@ private: QSqlQuery selectTransactionById; QSqlQuery selectDebugMessagesByTimespan; QSqlQuery selectDebugMessagesByTimespanWithLimit; + QSqlQuery checkDependenciesExist; + QSqlQuery selectDependenciesByTimespan; TransactionQueryTexts queryTexts; void prepareQueries(); @@ -125,7 +129,8 @@ private: QString queryToString(QSqlQuery query); std::shared_ptr parseTransactionFromQuery(QSqlQuery &query); std::vector> parseTransactionsFromQuery( - QSqlQuery &query); + QSqlQuery &query, + bool updateVisiblePhases = false); std::vector parseCommentsFromQuery(QSqlQuery &query); void executeScriptFile(QString fileName); @@ -135,6 +140,8 @@ private: GeneralInfo *getGeneralInfoFromDB(); CommandLengths getCommandLengthsFromDB(); unsigned int getLengthOfCommandFromDB(const std::string& command); + + std::map> _visiblePhases; // Updated at parseTransactionsFromQuery }; diff --git a/DRAMSys/traceAnalyzer/mainwindow.cpp b/DRAMSys/traceAnalyzer/mainwindow.cpp index 2b0ba7bd..8b68f2c3 100644 --- a/DRAMSys/traceAnalyzer/mainwindow.cpp +++ b/DRAMSys/traceAnalyzer/mainwindow.cpp @@ -57,6 +57,7 @@ MainWindow::MainWindow(QWidget *parent) : traceNavigator->GeneralTraceInfo().TraceSpan()); transactions = db->getTransactionsInTimespan( traceNavigator->GeneralTraceInfo().TraceSpan()); + db->updateDependenciesInTimespan(traceNavigator->GeneralTraceInfo().TraceSpan()); ui->qwtPlot->setAxisScale(QwtPlot::xBottom, traceNavigator->GeneralTraceInfo().TraceSpan().Begin(), diff --git a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp index 03f96539..7adbcc69 100644 --- a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp +++ b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp @@ -448,6 +448,8 @@ void TracePlot::currentTraceTimeChanged() { transactions = navigator->TraceFile().getTransactionsInTimespan( GetCurrentTimespan()); + navigator->TraceFile().updateDependenciesInTimespan(GetCurrentTimespan()); + setAxisScale(xBottom, GetCurrentTimespan().Begin(), GetCurrentTimespan().End()); replot(); } diff --git a/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp b/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp index 564df655..03803b87 100644 --- a/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp +++ b/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp @@ -196,6 +196,8 @@ void TraceScroller::currentTraceTimeChanged() canvasClip->setInterval(spanOnTracePlot.Begin(), spanOnTracePlot.End()); Timespan span = GetCurrentTimespan(); transactions = navigator->TraceFile().getTransactionsInTimespan(span); + navigator->TraceFile().updateDependenciesInTimespan(span); + setAxisScale(xBottom, span.Begin(), span.End()); replot(); } From 1cf0d0c7436245dc75152f2172df2dc7005b25a5 Mon Sep 17 00:00:00 2001 From: Derek Christ Date: Mon, 25 Oct 2021 15:34:58 +0200 Subject: [PATCH 02/18] Add a switch in the context menu to disable and enable dependency drawing --- .../businessObjects/phases/phase.cpp | 18 +++++---- .../presentation/tracedrawingproperties.cpp | 9 ++--- .../presentation/tracedrawingproperties.h | 12 +++++- .../traceAnalyzer/presentation/traceplot.cpp | 38 +++++++++++++++++++ .../traceAnalyzer/presentation/traceplot.h | 3 ++ .../presentation/tracescroller.cpp | 6 +-- 6 files changed, 68 insertions(+), 18 deletions(-) diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp index 17a46d4e..c7f261a5 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp @@ -72,16 +72,16 @@ void Phase::draw(QPainter *painter, const QwtScaleMap &xMap, drawingProperties.drawText, getPhaseSymbol(), painter, xMap, yMap); if (getGranularity() == Granularity::Bankwise) { - bool drawAllDependencies = false; - bool drawDependencies = true; + bool drawDependencyText = true; - if (drawAllDependencies || (highlight && drawDependencies)) { - drawPhaseDependencies(span.Begin(), span.End(), line->getYVal(), - drawingProperties, drawDependencyText, painter, xMap, yMap); + DependencyOption drawDependenciesOption = drawingProperties.drawDependenciesOption; + if (drawDependenciesOption == DependencyOption::All || + (drawDependenciesOption == DependencyOption::Selected && highlight)) + { + drawPhaseDependencies(span.Begin(), span.End(), line->getYVal(), drawingProperties, + drawDependencyText, painter, xMap, yMap); } - } - } } @@ -135,6 +135,8 @@ void Phase::drawPhaseDependencies(traceTime begin, traceTime end, double y, cons { QPen pen; pen.setWidth(2); + + painter->save(); painter->setPen(pen); painter->setRenderHint(QPainter::Antialiasing); @@ -164,8 +166,8 @@ void Phase::drawPhaseDependencies(traceTime begin, traceTime end, double y, cons QPoint invisibleDepsPoint(static_cast(xMap.transform(begin + (end + offset - begin)/2)), static_cast(yVal + 0.1*symbolHeight)); drawText(painter, QString(std::to_string(invisibleDeps).c_str()), invisibleDepsPoint, TextPositioning::centerCenter); } - + painter->restore(); } QColor Phase::getColor(const TraceDrawingProperties &drawingProperties) const diff --git a/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.cpp b/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.cpp index 95c0a4cd..25650211 100644 --- a/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.cpp +++ b/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.cpp @@ -40,11 +40,10 @@ #include "util/traceplotlinecache.h" #include "traceselector.h" -TraceDrawingProperties::TraceDrawingProperties(bool drawText, bool drawBorder, - ColorGrouping colorGrouping) : - drawText(drawText), - drawBorder(drawBorder), - colorGrouping(colorGrouping) +TraceDrawingProperties::TraceDrawingProperties(bool drawText, bool drawBorder, DependencyOption drawDependenciesOption, + ColorGrouping colorGrouping) + : drawText(drawText), drawBorder(drawBorder), drawDependenciesOption(drawDependenciesOption), + colorGrouping(colorGrouping) { } diff --git a/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h b/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h index c51ee834..764498f5 100644 --- a/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h +++ b/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h @@ -58,6 +58,13 @@ class TracePlotLineCache; using TracePlotLineVector = std::vector>; +enum class DependencyOption +{ + Disabled, + Selected, + All +}; + class TraceDrawingProperties : public QObject { Q_OBJECT @@ -65,6 +72,7 @@ class TraceDrawingProperties : public QObject public: bool drawText; bool drawBorder; + DependencyOption drawDependenciesOption; ColorGrouping colorGrouping; unsigned int numberOfRanks; @@ -74,8 +82,8 @@ public: unsigned int groupsPerRank; unsigned int banksPerGroup; - TraceDrawingProperties(bool drawText = true, - bool drawBorder = true, + TraceDrawingProperties(bool drawText = true, bool drawBorder = true, + DependencyOption drawDependenciesOption = DependencyOption::Disabled, ColorGrouping colorGrouping = ColorGrouping::PhaseType); ~TraceDrawingProperties(); diff --git a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp index 7adbcc69..d82a1347 100644 --- a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp +++ b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp @@ -162,6 +162,40 @@ void TracePlot::setUpActions() SLOT(on_toggleCollapsedState())); toggleCollapsedState->setShortcut(Qt::CTRL + Qt::Key_X); + disabledDependencies = new QAction("Disabled", this); + selectedDependencies = new QAction("Selected transactions", this); + allDependencies = new QAction("All transactions", this); + + disabledDependencies->setCheckable(true); + selectedDependencies->setCheckable(true); + allDependencies->setCheckable(true); + + disabledDependencies->setChecked(true); + + QObject::connect(disabledDependencies, &QAction::triggered, this, + [&]() + { + drawingProperties.drawDependenciesOption = DependencyOption::Disabled; + replot(); + }); + QObject::connect(selectedDependencies, &QAction::triggered, this, + [&]() + { + drawingProperties.drawDependenciesOption = DependencyOption::Selected; + replot(); + }); + QObject::connect(allDependencies, &QAction::triggered, this, + [&]() + { + drawingProperties.drawDependenciesOption = DependencyOption::All; + replot(); + }); + + QActionGroup *dependenciesGroup = new QActionGroup(this); + dependenciesGroup->addAction(disabledDependencies); + dependenciesGroup->addAction(selectedDependencies); + dependenciesGroup->addAction(allDependencies); + setUpContextMenu(); } @@ -174,6 +208,10 @@ void TracePlot::setUpContextMenu() colorGroupingSubMenu->addActions({setColorGroupingPhase, setColorGroupingTransaction, setColorGroupingThread}); contextMenu->addMenu(colorGroupingSubMenu); + QMenu *dependenciesSubMenu = new QMenu("Show dependencies", contextMenu); + dependenciesSubMenu->addActions({disabledDependencies, selectedDependencies, allDependencies}); + contextMenu->addMenu(dependenciesSubMenu); + QMenu *goToSubMenu = new QMenu("Go to", contextMenu); goToSubMenu->addActions({goToPhase, goToTransaction, goToTime}); contextMenu->addMenu(goToSubMenu); diff --git a/DRAMSys/traceAnalyzer/presentation/traceplot.h b/DRAMSys/traceAnalyzer/presentation/traceplot.h index 5fff9b23..5a4399db 100644 --- a/DRAMSys/traceAnalyzer/presentation/traceplot.h +++ b/DRAMSys/traceAnalyzer/presentation/traceplot.h @@ -180,6 +180,9 @@ private: QAction *setColorGroupingTransaction; QAction *setColorGroupingThread; QAction *exportToPdf; + QAction *disabledDependencies; + QAction *selectedDependencies; + QAction *allDependencies; ToggleCollapsedAction *toggleCollapsedState; TracePlotMouseLabel *mouseLabel; diff --git a/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp b/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp index 03803b87..287197ba 100644 --- a/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp +++ b/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp @@ -43,9 +43,9 @@ #include "traceplotitem.h" #include "util/engineeringScaleDraw.h" -TraceScroller::TraceScroller(QWidget *parent): - QwtPlot(parent), isInitialized(false), drawingProperties(false, false, - ColorGrouping::PhaseType) +TraceScroller::TraceScroller(QWidget *parent) + : QwtPlot(parent), isInitialized(false), + drawingProperties(false, false, DependencyOption::Disabled, ColorGrouping::PhaseType) { setAxisScaleDraw(xBottom, new EngineeringScaleDraw); canvas()->setCursor(Qt::ArrowCursor); From f9c0d045095264114b7e412e6f5217117f532061 Mon Sep 17 00:00:00 2001 From: Iron Prando da Silva Date: Wed, 27 Oct 2021 08:49:52 +0200 Subject: [PATCH 03/18] Removed underlines. --- .../phases/phasedependency.cpp | 40 +++++++++---------- .../businessObjects/phases/phasedependency.h | 12 +++--- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp index 05bbdc61..e8ab05ba 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp @@ -4,17 +4,17 @@ PhaseDependency::PhaseDependency(DependencyType type, QString timeDependency, std::shared_ptr dependency) { - _type = type; - _timeDependency = timeDependency; - _dependency = dependency; + mType = type; + mTimeDependency = timeDependency; + mDependency = dependency; } PhaseDependency::PhaseDependency(DependencyType type, QString timeDependency) { - _type = type; - _timeDependency = timeDependency; - _dependency = nullptr; - _isInvisible = true; + mType = type; + mTimeDependency = timeDependency; + mDependency = nullptr; + mIsInvisible = true; } PhaseDependency::~PhaseDependency() @@ -26,17 +26,17 @@ bool PhaseDependency::draw(QPoint& end, const TraceDrawingProperties &drawingPro bool drawtext, QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap) { - if (_isInvisible) return false; + if (mIsInvisible) return false; - traceTime depBegin = _dependency->span.Begin(); - traceTime depEnd = _dependency->span.End(); + traceTime depBegin = mDependency->span.Begin(); + traceTime depEnd = mDependency->span.End(); if (xMap.transform(depEnd) < 0) return false; bool drawn = false; - for (auto line : _dependency->getTracePlotLines(drawingProperties)) { + for (auto line : mDependency->getTracePlotLines(drawingProperties)) { if (!line->isCollapsed()) { - _draw(end, line->getYVal(), drawingProperties, drawtext, painter, xMap, yMap); + mDraw(end, line->getYVal(), drawingProperties, drawtext, painter, xMap, yMap); drawn = true; } } @@ -46,17 +46,17 @@ bool PhaseDependency::draw(QPoint& end, const TraceDrawingProperties &drawingPro return drawn; } -void PhaseDependency::_draw(QPoint& end, double depY, const TraceDrawingProperties &drawingProperties, +void PhaseDependency::mDraw(QPoint& end, double depY, const TraceDrawingProperties &drawingProperties, bool drawtext, QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap) { - traceTime depBegin = _dependency->span.Begin(); - traceTime depEnd = _dependency->span.End(); + traceTime depBegin = mDependency->span.Begin(); + traceTime depEnd = mDependency->span.End(); - traceTime depOffset = (depBegin == depEnd) ? static_cast(0.05 * _dependency->clk) : 0; + traceTime depOffset = (depBegin == depEnd) ? static_cast(0.05 * mDependency->clk) : 0; double depYVal = yMap.transform(depY); - double depSymbolHeight = yMap.transform(0) - yMap.transform(_dependency->hexagonHeight); + double depSymbolHeight = yMap.transform(0) - yMap.transform(mDependency->hexagonHeight); QPoint depLineFrom(static_cast(xMap.transform(depBegin/* + (depEnd + depOffset - depBegin)/4*/)), static_cast(depYVal)); QLineF line(depLineFrom, end); @@ -68,8 +68,8 @@ void PhaseDependency::_draw(QPoint& end, double depY, const TraceDrawingProperti QPolygonF arrowHead; arrowHead << line.p2() << arrowP1 << arrowP2; - QColor color = _dependency->getColor(drawingProperties); - painter->setBrush(QBrush(color, _dependency->getBrushStyle())); + QColor color = mDependency->getColor(drawingProperties); + painter->setBrush(QBrush(color, mDependency->getBrushStyle())); painter->drawLine(line); painter->drawPolygon(arrowHead); @@ -89,7 +89,7 @@ void PhaseDependency::_draw(QPoint& end, double depY, const TraceDrawingProperti drawText( painter, - _timeDependency, + mTimeDependency, textPosition, alignment ); diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.h b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.h index 34fc4ec0..7a0564b4 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.h +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.h @@ -22,20 +22,20 @@ class PhaseDependency PhaseDependency(DependencyType type, QString timeDependency); ~PhaseDependency(); - bool isVisible() { return !_isInvisible; } + bool isVisible() { return !mIsInvisible; } bool draw(QPoint& end, const TraceDrawingProperties &drawingProperties, bool drawtext, QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap); protected: - DependencyType _type; - QString _timeDependency; - std::shared_ptr _dependency; + DependencyType mType; + QString mTimeDependency; + std::shared_ptr mDependency; - bool _isInvisible = false; + bool mIsInvisible = false; - void _draw(QPoint& end, double depY, const TraceDrawingProperties &drawingProperties, + void mDraw(QPoint& end, double depY, const TraceDrawingProperties &drawingProperties, bool drawtext, QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap); }; From 028c69f71bbfafc26ff8d56546718f463481ac0f Mon Sep 17 00:00:00 2001 From: Iron Prando da Silva Date: Wed, 27 Oct 2021 09:14:59 +0200 Subject: [PATCH 04/18] Added toggle to enable/disable dependency name presentation. --- .../businessObjects/phases/phase.cpp | 17 +++++------ .../businessObjects/phases/phase.h | 4 +-- .../phases/phasedependency.cpp | 8 ++--- .../businessObjects/phases/phasedependency.h | 4 +-- .../presentation/tracedrawingproperties.cpp | 2 +- .../presentation/tracedrawingproperties.h | 10 +++++-- .../traceAnalyzer/presentation/traceplot.cpp | 29 +++++++++++++++++-- .../traceAnalyzer/presentation/traceplot.h | 2 ++ .../presentation/tracescroller.cpp | 3 +- 9 files changed, 55 insertions(+), 24 deletions(-) diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp index c7f261a5..2961d89d 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp @@ -74,12 +74,11 @@ void Phase::draw(QPainter *painter, const QwtScaleMap &xMap, if (getGranularity() == Granularity::Bankwise) { bool drawDependencyText = true; - DependencyOption drawDependenciesOption = drawingProperties.drawDependenciesOption; - if (drawDependenciesOption == DependencyOption::All || - (drawDependenciesOption == DependencyOption::Selected && highlight)) + DependencyOptions drawDependenciesOptions = drawingProperties.drawDependenciesOption; + if (drawDependenciesOptions.draw == DependencyOption::All || + (drawDependenciesOptions.draw == DependencyOption::Selected && highlight)) { - drawPhaseDependencies(span.Begin(), span.End(), line->getYVal(), drawingProperties, - drawDependencyText, painter, xMap, yMap); + drawPhaseDependencies(span.Begin(), span.End(), line->getYVal(), drawingProperties, painter, xMap, yMap); } } } @@ -130,7 +129,7 @@ void Phase::drawPhaseSymbol(traceTime begin, traceTime end, double y, } void Phase::drawPhaseDependencies(traceTime begin, traceTime end, double y, const TraceDrawingProperties &drawingProperties, - bool drawtext, QPainter *painter, const QwtScaleMap &xMap, + QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap) const { QPen pen; @@ -149,10 +148,10 @@ void Phase::drawPhaseDependencies(traceTime begin, traceTime end, double y, cons QPoint depLineTo(static_cast(xMap.transform(begin/* + (end + offset - begin)/4*/)), static_cast(yVal)); - for (auto dep : _dependencies) { + for (auto dep : mDependencies) { bool visible = false; if (dep->isVisible()) { - if (!dep->draw(depLineTo, drawingProperties, drawtext, painter, xMap, yMap) ) { + if (!dep->draw(depLineTo, drawingProperties, painter, xMap, yMap) ) { invisibleDeps += 1; } @@ -253,5 +252,5 @@ std::vector> Phase::getTracePlotLines(const Trace } void Phase::addDependency(std::shared_ptr dependency) { - _dependencies.push_back(dependency); + mDependencies.push_back(dependency); } diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.h b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.h index 87c819ef..fb590845 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.h +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.h @@ -85,7 +85,7 @@ protected: std::weak_ptr transaction; std::vector spansOnCommandBus; std::shared_ptr spanOnDataBus; - std::vector> _dependencies; + std::vector> mDependencies; double hexagonHeight; TextPositioning captionPosition; @@ -101,7 +101,7 @@ protected: const QwtScaleMap &yMap) const; virtual void drawPhaseDependencies(traceTime begin, traceTime end, double y, const TraceDrawingProperties &drawingProperties, - bool drawtext, QPainter *painter, const QwtScaleMap &xMap, + QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap) const; diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp index e8ab05ba..7e515d37 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp @@ -23,7 +23,7 @@ PhaseDependency::~PhaseDependency() } bool PhaseDependency::draw(QPoint& end, const TraceDrawingProperties &drawingProperties, - bool drawtext, QPainter *painter, const QwtScaleMap &xMap, + QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap) { if (mIsInvisible) return false; @@ -36,7 +36,7 @@ bool PhaseDependency::draw(QPoint& end, const TraceDrawingProperties &drawingPro bool drawn = false; for (auto line : mDependency->getTracePlotLines(drawingProperties)) { if (!line->isCollapsed()) { - mDraw(end, line->getYVal(), drawingProperties, drawtext, painter, xMap, yMap); + mDraw(end, line->getYVal(), drawingProperties, painter, xMap, yMap); drawn = true; } } @@ -47,7 +47,7 @@ bool PhaseDependency::draw(QPoint& end, const TraceDrawingProperties &drawingPro } void PhaseDependency::mDraw(QPoint& end, double depY, const TraceDrawingProperties &drawingProperties, - bool drawtext, QPainter *painter, const QwtScaleMap &xMap, + QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap) { traceTime depBegin = mDependency->span.Begin(); @@ -74,7 +74,7 @@ void PhaseDependency::mDraw(QPoint& end, double depY, const TraceDrawingProperti painter->drawLine(line); painter->drawPolygon(arrowHead); - if (drawtext) { + if (drawingProperties.drawDependenciesOption.text == DependencyTextOption::Enabled) { QPoint textPosition(line.x1() + (line.x2() - line.x1()) / 2, line.y1() + (line.y2() - line.y1()) / 2); auto alignment = TextPositioning::topRight; diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.h b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.h index 7a0564b4..05aa23c2 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.h +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.h @@ -25,7 +25,7 @@ class PhaseDependency bool isVisible() { return !mIsInvisible; } bool draw(QPoint& end, const TraceDrawingProperties &drawingProperties, - bool drawtext, QPainter *painter, const QwtScaleMap &xMap, + QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap); protected: @@ -36,6 +36,6 @@ class PhaseDependency bool mIsInvisible = false; void mDraw(QPoint& end, double depY, const TraceDrawingProperties &drawingProperties, - bool drawtext, QPainter *painter, const QwtScaleMap &xMap, + QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap); }; diff --git a/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.cpp b/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.cpp index 25650211..f693034b 100644 --- a/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.cpp +++ b/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.cpp @@ -40,7 +40,7 @@ #include "util/traceplotlinecache.h" #include "traceselector.h" -TraceDrawingProperties::TraceDrawingProperties(bool drawText, bool drawBorder, DependencyOption drawDependenciesOption, +TraceDrawingProperties::TraceDrawingProperties(bool drawText, bool drawBorder, DependencyOptions drawDependenciesOption, ColorGrouping colorGrouping) : drawText(drawText), drawBorder(drawBorder), drawDependenciesOption(drawDependenciesOption), colorGrouping(colorGrouping) diff --git a/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h b/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h index 764498f5..8b4551f1 100644 --- a/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h +++ b/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h @@ -64,6 +64,12 @@ enum class DependencyOption Selected, All }; +enum class DependencyTextOption {Enabled, Disabled}; + +typedef struct s_DependencyOptions { + DependencyOption draw; + DependencyTextOption text; +} DependencyOptions; class TraceDrawingProperties : public QObject { @@ -72,7 +78,7 @@ class TraceDrawingProperties : public QObject public: bool drawText; bool drawBorder; - DependencyOption drawDependenciesOption; + DependencyOptions drawDependenciesOption; ColorGrouping colorGrouping; unsigned int numberOfRanks; @@ -83,7 +89,7 @@ public: unsigned int banksPerGroup; TraceDrawingProperties(bool drawText = true, bool drawBorder = true, - DependencyOption drawDependenciesOption = DependencyOption::Disabled, + DependencyOptions drawDependenciesOption = {DependencyOption::Disabled, DependencyTextOption::Disabled}, ColorGrouping colorGrouping = ColorGrouping::PhaseType); ~TraceDrawingProperties(); diff --git a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp index d82a1347..78f06ab2 100644 --- a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp +++ b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp @@ -165,29 +165,46 @@ void TracePlot::setUpActions() disabledDependencies = new QAction("Disabled", this); selectedDependencies = new QAction("Selected transactions", this); allDependencies = new QAction("All transactions", this); + enableDrawDependencyTexts = new QAction("Enabled", this); + disableDrawDependencyTexts = new QAction("Disabled", this); disabledDependencies->setCheckable(true); selectedDependencies->setCheckable(true); allDependencies->setCheckable(true); + enableDrawDependencyTexts->setCheckable(true); + disableDrawDependencyTexts->setCheckable(true); disabledDependencies->setChecked(true); + disableDrawDependencyTexts->setChecked(true); QObject::connect(disabledDependencies, &QAction::triggered, this, [&]() { - drawingProperties.drawDependenciesOption = DependencyOption::Disabled; + drawingProperties.drawDependenciesOption.draw = DependencyOption::Disabled; replot(); }); QObject::connect(selectedDependencies, &QAction::triggered, this, [&]() { - drawingProperties.drawDependenciesOption = DependencyOption::Selected; + drawingProperties.drawDependenciesOption.draw = DependencyOption::Selected; replot(); }); QObject::connect(allDependencies, &QAction::triggered, this, [&]() { - drawingProperties.drawDependenciesOption = DependencyOption::All; + drawingProperties.drawDependenciesOption.draw = DependencyOption::All; + replot(); + }); + QObject::connect(enableDrawDependencyTexts, &QAction::triggered, this, + [&]() + { + drawingProperties.drawDependenciesOption.text = DependencyTextOption::Enabled; + replot(); + }); + QObject::connect(disableDrawDependencyTexts, &QAction::triggered, this, + [&]() + { + drawingProperties.drawDependenciesOption.text = DependencyTextOption::Disabled; replot(); }); @@ -195,6 +212,9 @@ void TracePlot::setUpActions() dependenciesGroup->addAction(disabledDependencies); dependenciesGroup->addAction(selectedDependencies); dependenciesGroup->addAction(allDependencies); + QActionGroup *dependencyTextsGroup = new QActionGroup(this); + dependencyTextsGroup->addAction(enableDrawDependencyTexts); + dependencyTextsGroup->addAction(disableDrawDependencyTexts); setUpContextMenu(); } @@ -211,6 +231,9 @@ void TracePlot::setUpContextMenu() QMenu *dependenciesSubMenu = new QMenu("Show dependencies", contextMenu); dependenciesSubMenu->addActions({disabledDependencies, selectedDependencies, allDependencies}); contextMenu->addMenu(dependenciesSubMenu); + QMenu *dependenciesTextSubMenu = new QMenu("Show dependency names", dependenciesSubMenu); + dependenciesTextSubMenu->addActions({enableDrawDependencyTexts, disableDrawDependencyTexts}); + dependenciesSubMenu->addMenu(dependenciesTextSubMenu); QMenu *goToSubMenu = new QMenu("Go to", contextMenu); goToSubMenu->addActions({goToPhase, goToTransaction, goToTime}); diff --git a/DRAMSys/traceAnalyzer/presentation/traceplot.h b/DRAMSys/traceAnalyzer/presentation/traceplot.h index 5a4399db..36fcedfb 100644 --- a/DRAMSys/traceAnalyzer/presentation/traceplot.h +++ b/DRAMSys/traceAnalyzer/presentation/traceplot.h @@ -183,6 +183,8 @@ private: QAction *disabledDependencies; QAction *selectedDependencies; QAction *allDependencies; + QAction *enableDrawDependencyTexts; + QAction *disableDrawDependencyTexts; ToggleCollapsedAction *toggleCollapsedState; TracePlotMouseLabel *mouseLabel; diff --git a/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp b/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp index 287197ba..4220a9d5 100644 --- a/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp +++ b/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp @@ -45,7 +45,8 @@ TraceScroller::TraceScroller(QWidget *parent) : QwtPlot(parent), isInitialized(false), - drawingProperties(false, false, DependencyOption::Disabled, ColorGrouping::PhaseType) + drawingProperties(false, false, {DependencyOption::Disabled, DependencyTextOption::Disabled}, + ColorGrouping::PhaseType) { setAxisScaleDraw(xBottom, new EngineeringScaleDraw); canvas()->setCursor(Qt::ArrowCursor); From fe0881a0076efdde87a732e74a3e386901dd1d35 Mon Sep 17 00:00:00 2001 From: Iron Prando da Silva Date: Wed, 27 Oct 2021 11:34:52 +0200 Subject: [PATCH 05/18] Added alpha colored transaction sequences. Removed dependency texts submenu. --- .../businessObjects/phases/phase.cpp | 25 +++++---- .../businessObjects/transaction.cpp | 2 + .../businessObjects/transaction.h | 7 +++ .../presentation/tracedrawingproperties.h | 6 +-- .../presentation/tracenavigator.cpp | 2 + .../traceAnalyzer/presentation/traceplot.cpp | 51 +++++++++++-------- .../traceAnalyzer/presentation/traceplot.h | 5 +- .../presentation/util/colorgenerator.cpp | 12 ++++- .../presentation/util/colorgenerator.h | 1 + 9 files changed, 73 insertions(+), 38 deletions(-) diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp index 2961d89d..490038d5 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp @@ -172,17 +172,22 @@ void Phase::drawPhaseDependencies(traceTime begin, traceTime end, double y, cons QColor Phase::getColor(const TraceDrawingProperties &drawingProperties) const { switch (drawingProperties.colorGrouping) { - case ColorGrouping::PhaseType: - return getPhaseColor(); - break; - case ColorGrouping::Thread: - return ColorGenerator::getColor(static_cast - (transaction.lock()->thread)); - break; - case ColorGrouping::Transaction: - default: - return ColorGenerator::getColor(transaction.lock()->id); + case ColorGrouping::PhaseType: + return getPhaseColor(); + break; + case ColorGrouping::Thread: + return ColorGenerator::getColor(static_cast + (transaction.lock()->thread)); + break; + case ColorGrouping::AlphaTransaction: + return ColorGenerator::getAlphaColored(transaction.lock()->id); + + break; + case ColorGrouping::Transaction: + default: + return ColorGenerator::getColor(transaction.lock()->id); } + } Qt::BrushStyle Phase::getBrushStyle() const diff --git a/DRAMSys/traceAnalyzer/businessObjects/transaction.cpp b/DRAMSys/traceAnalyzer/businessObjects/transaction.cpp index 87a46f99..cc2753dd 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/transaction.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/transaction.cpp @@ -39,6 +39,8 @@ using namespace std; +unsigned int Transaction::mSNumTransactions = 0; + Transaction::Transaction(ID id, unsigned int address, unsigned int burstlength, unsigned int thread, unsigned int channel, unsigned int rank, unsigned int bankgroup, unsigned int bank, unsigned int row, unsigned int column, diff --git a/DRAMSys/traceAnalyzer/businessObjects/transaction.h b/DRAMSys/traceAnalyzer/businessObjects/transaction.h index ef489083..fce35c05 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/transaction.h +++ b/DRAMSys/traceAnalyzer/businessObjects/transaction.h @@ -74,6 +74,13 @@ public: { return phases; } + +public: + static void setNumTransactions(const unsigned int numTransactions) { mSNumTransactions = numTransactions; } + static unsigned int getNumTransactions(const unsigned int numTransactions) { return mSNumTransactions; } + +private: + static unsigned int mSNumTransactions; }; #endif // TRANSACTION_H diff --git a/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h b/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h index 8b4551f1..20158a2b 100644 --- a/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h +++ b/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h @@ -51,7 +51,7 @@ #include "util/togglecollapsedaction.h" #include "traceselector.h" -enum class ColorGrouping {PhaseType, Transaction, Thread}; +enum class ColorGrouping {PhaseType, Transaction, Thread, AlphaTransaction}; class TracePlot; class TracePlotLineCache; @@ -66,10 +66,10 @@ enum class DependencyOption }; enum class DependencyTextOption {Enabled, Disabled}; -typedef struct s_DependencyOptions { +struct DependencyOptions { DependencyOption draw; DependencyTextOption text; -} DependencyOptions; +}; class TraceDrawingProperties : public QObject { diff --git a/DRAMSys/traceAnalyzer/presentation/tracenavigator.cpp b/DRAMSys/traceAnalyzer/presentation/tracenavigator.cpp index f5ab5a0b..f3e4df78 100644 --- a/DRAMSys/traceAnalyzer/presentation/tracenavigator.cpp +++ b/DRAMSys/traceAnalyzer/presentation/tracenavigator.cpp @@ -57,6 +57,8 @@ TraceNavigator::TraceNavigator(QString path, CommentModel *commentModel, QObject QObject::connect(commentModel, &CommentModel::dataChanged, this, &TraceNavigator::traceFileModified); QObject::connect(commentModel, &CommentModel::rowsRemoved, this, &TraceNavigator::traceFileModified); + Transaction::setNumTransactions(GeneralTraceInfo().numberOfTransactions); + tracePlotLineCache = std::make_shared(getTracePlotLines(), GeneralTraceInfo().numberOfRanks, GeneralTraceInfo().groupsPerRank, GeneralTraceInfo().banksPerGroup); diff --git a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp index 78f06ab2..2c47f948 100644 --- a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp +++ b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp @@ -146,11 +146,16 @@ void TracePlot::setUpActions() QObject::connect(setColorGroupingTransaction, SIGNAL(triggered()), this, SLOT(on_colorGroupingTransaction())); + setColorGroupingAlphaTransaction = new QAction("Group by Transaction - Alpha Colored", this); + addAction(setColorGroupingAlphaTransaction); + QObject::connect(setColorGroupingAlphaTransaction, SIGNAL(triggered()), this, + SLOT(on_colorGroupingAlphaTransaction())); + setColorGroupingThread = new QAction("Group by Thread", this); addAction(setColorGroupingThread); QObject::connect(setColorGroupingThread, SIGNAL(triggered()), this, SLOT(on_colorGroupingThread())); - + exportToPdf = new QAction("Export to SVG", this); addAction(exportToPdf); QObject::connect(exportToPdf, SIGNAL(triggered()), this, @@ -165,17 +170,14 @@ void TracePlot::setUpActions() disabledDependencies = new QAction("Disabled", this); selectedDependencies = new QAction("Selected transactions", this); allDependencies = new QAction("All transactions", this); - enableDrawDependencyTexts = new QAction("Enabled", this); - disableDrawDependencyTexts = new QAction("Disabled", this); + switchDrawDependencyTextsOption = new QAction("Draw Texts", this); disabledDependencies->setCheckable(true); selectedDependencies->setCheckable(true); allDependencies->setCheckable(true); - enableDrawDependencyTexts->setCheckable(true); - disableDrawDependencyTexts->setCheckable(true); + switchDrawDependencyTextsOption->setCheckable(true); - disabledDependencies->setChecked(true); - disableDrawDependencyTexts->setChecked(true); + switchDrawDependencyTextsOption->setChecked(false); QObject::connect(disabledDependencies, &QAction::triggered, this, [&]() @@ -195,16 +197,18 @@ void TracePlot::setUpActions() drawingProperties.drawDependenciesOption.draw = DependencyOption::All; replot(); }); - QObject::connect(enableDrawDependencyTexts, &QAction::triggered, this, + QObject::connect(switchDrawDependencyTextsOption, &QAction::triggered, this, [&]() { - drawingProperties.drawDependenciesOption.text = DependencyTextOption::Enabled; - replot(); - }); - QObject::connect(disableDrawDependencyTexts, &QAction::triggered, this, - [&]() - { - drawingProperties.drawDependenciesOption.text = DependencyTextOption::Disabled; + if (drawingProperties.drawDependenciesOption.text == DependencyTextOption::Disabled) { + drawingProperties.drawDependenciesOption.text = DependencyTextOption::Enabled; + switchDrawDependencyTextsOption->setChecked(true); + + } else { + drawingProperties.drawDependenciesOption.text = DependencyTextOption::Disabled; + switchDrawDependencyTextsOption->setChecked(false); + + } replot(); }); @@ -213,8 +217,7 @@ void TracePlot::setUpActions() dependenciesGroup->addAction(selectedDependencies); dependenciesGroup->addAction(allDependencies); QActionGroup *dependencyTextsGroup = new QActionGroup(this); - dependencyTextsGroup->addAction(enableDrawDependencyTexts); - dependencyTextsGroup->addAction(disableDrawDependencyTexts); + dependencyTextsGroup->addAction(switchDrawDependencyTextsOption); setUpContextMenu(); } @@ -225,15 +228,12 @@ void TracePlot::setUpContextMenu() contextMenu->addActions({deselectAll}); QMenu *colorGroupingSubMenu = new QMenu("Group by", contextMenu); - colorGroupingSubMenu->addActions({setColorGroupingPhase, setColorGroupingTransaction, setColorGroupingThread}); + colorGroupingSubMenu->addActions({setColorGroupingPhase, setColorGroupingTransaction, setColorGroupingThread, setColorGroupingAlphaTransaction}); contextMenu->addMenu(colorGroupingSubMenu); QMenu *dependenciesSubMenu = new QMenu("Show dependencies", contextMenu); - dependenciesSubMenu->addActions({disabledDependencies, selectedDependencies, allDependencies}); + dependenciesSubMenu->addActions({disabledDependencies, selectedDependencies, allDependencies, switchDrawDependencyTextsOption}); contextMenu->addMenu(dependenciesSubMenu); - QMenu *dependenciesTextSubMenu = new QMenu("Show dependency names", dependenciesSubMenu); - dependenciesTextSubMenu->addActions({enableDrawDependencyTexts, disableDrawDependencyTexts}); - dependenciesSubMenu->addMenu(dependenciesTextSubMenu); QMenu *goToSubMenu = new QMenu("Go to", contextMenu); goToSubMenu->addActions({goToPhase, goToTransaction, goToTime}); @@ -585,6 +585,13 @@ void TracePlot::on_colorGroupingTransaction() replot(); } +void TracePlot::on_colorGroupingAlphaTransaction() +{ + drawingProperties.colorGrouping = ColorGrouping::AlphaTransaction; + Q_EMIT(colorGroupingChanged(ColorGrouping::AlphaTransaction)); + replot(); +} + void TracePlot::on_colorGroupingThread() { drawingProperties.colorGrouping = ColorGrouping::Thread; diff --git a/DRAMSys/traceAnalyzer/presentation/traceplot.h b/DRAMSys/traceAnalyzer/presentation/traceplot.h index 36fcedfb..911b1692 100644 --- a/DRAMSys/traceAnalyzer/presentation/traceplot.h +++ b/DRAMSys/traceAnalyzer/presentation/traceplot.h @@ -107,6 +107,7 @@ private Q_SLOTS: void on_colorGroupingPhase(); void on_colorGroupingTransaction(); void on_colorGroupingThread(); + void on_colorGroupingAlphaTransaction(); void on_goToTransaction(); void on_goToPhase(); void on_deselectAll(); @@ -179,12 +180,12 @@ private: QAction *setColorGroupingPhase; QAction *setColorGroupingTransaction; QAction *setColorGroupingThread; + QAction *setColorGroupingAlphaTransaction; QAction *exportToPdf; QAction *disabledDependencies; QAction *selectedDependencies; QAction *allDependencies; - QAction *enableDrawDependencyTexts; - QAction *disableDrawDependencyTexts; + QAction *switchDrawDependencyTextsOption; ToggleCollapsedAction *toggleCollapsedState; TracePlotMouseLabel *mouseLabel; diff --git a/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.cpp b/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.cpp index 2dc133a5..8c903705 100644 --- a/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.cpp +++ b/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.cpp @@ -101,4 +101,14 @@ QColor ColorGenerator::getColor(unsigned int i) result.setAlpha(130); return result; } - +#include +QColor ColorGenerator::getAlphaColored(unsigned int i) { + static ColorGenerator gen; + const int minAlpha = 25; + const int alphaLevels = 40 - 255/minAlpha; + int alpha = minAlpha + (int) (((255.-minAlpha)/alphaLevels) * (i % alphaLevels)); + i = (i / alphaLevels) % 16; + QColor result(gen.r[i], gen.g[i], gen.b[i]); + result.setAlpha(alpha); + return result; +} diff --git a/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.h b/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.h index 5b7b22dd..024203ac 100644 --- a/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.h +++ b/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.h @@ -52,6 +52,7 @@ private: public: static QColor getColor(unsigned int i); + static QColor getAlphaColored(unsigned int i); }; From 152a2996a0b186ead0a21da2eb699335f52205a8 Mon Sep 17 00:00:00 2001 From: Iron Prando da Silva Date: Wed, 27 Oct 2021 11:36:52 +0200 Subject: [PATCH 06/18] Dependency texts drawn by default. --- DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h | 2 +- DRAMSys/traceAnalyzer/presentation/traceplot.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h b/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h index 20158a2b..1ae4c238 100644 --- a/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h +++ b/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h @@ -89,7 +89,7 @@ public: unsigned int banksPerGroup; TraceDrawingProperties(bool drawText = true, bool drawBorder = true, - DependencyOptions drawDependenciesOption = {DependencyOption::Disabled, DependencyTextOption::Disabled}, + DependencyOptions drawDependenciesOption = {DependencyOption::Disabled, DependencyTextOption::Enabled}, ColorGrouping colorGrouping = ColorGrouping::PhaseType); ~TraceDrawingProperties(); diff --git a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp index 2c47f948..eba52055 100644 --- a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp +++ b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp @@ -177,7 +177,7 @@ void TracePlot::setUpActions() allDependencies->setCheckable(true); switchDrawDependencyTextsOption->setCheckable(true); - switchDrawDependencyTextsOption->setChecked(false); + switchDrawDependencyTextsOption->setChecked(true); QObject::connect(disabledDependencies, &QAction::triggered, this, [&]() From 4b448ecc26d82dc461de06f2063bd54c337b8250 Mon Sep 17 00:00:00 2001 From: Iron Prando da Silva Date: Wed, 27 Oct 2021 11:50:57 +0200 Subject: [PATCH 07/18] Minor simplification. --- DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp | 2 +- .../traceAnalyzer/businessObjects/phases/phasedependency.cpp | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp index 490038d5..73c63ead 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp @@ -163,7 +163,7 @@ void Phase::drawPhaseDependencies(traceTime begin, traceTime end, double y, cons if (invisibleDeps > 0) { QPoint invisibleDepsPoint(static_cast(xMap.transform(begin + (end + offset - begin)/2)), static_cast(yVal + 0.1*symbolHeight)); - drawText(painter, QString(std::to_string(invisibleDeps).c_str()), invisibleDepsPoint, TextPositioning::centerCenter); + drawText(painter, QString::number(invisibleDeps), invisibleDepsPoint, TextPositioning::centerCenter); } painter->restore(); diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp index 7e515d37..df7fcb6b 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp @@ -40,8 +40,6 @@ bool PhaseDependency::draw(QPoint& end, const TraceDrawingProperties &drawingPro drawn = true; } } - - return drawn; } From f855dbb16e3a7d7e5cd02016bc05de54e970e3bd Mon Sep 17 00:00:00 2001 From: Iron Prando da Silva Date: Thu, 4 Nov 2021 07:58:19 +0100 Subject: [PATCH 08/18] Removed dependencyTextGroup. Added disabledDependencies as default. --- DRAMSys/traceAnalyzer/presentation/traceplot.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp index eba52055..9123b5a9 100644 --- a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp +++ b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp @@ -178,6 +178,7 @@ void TracePlot::setUpActions() switchDrawDependencyTextsOption->setCheckable(true); switchDrawDependencyTextsOption->setChecked(true); + disabledDependencies->setChecked(true); QObject::connect(disabledDependencies, &QAction::triggered, this, [&]() @@ -216,8 +217,6 @@ void TracePlot::setUpActions() dependenciesGroup->addAction(disabledDependencies); dependenciesGroup->addAction(selectedDependencies); dependenciesGroup->addAction(allDependencies); - QActionGroup *dependencyTextsGroup = new QActionGroup(this); - dependencyTextsGroup->addAction(switchDrawDependencyTextsOption); setUpContextMenu(); } From 0be4e0d6fb9f1d6ab2c40ee1234e8565919a344e Mon Sep 17 00:00:00 2001 From: Iron Prando da Silva Date: Thu, 4 Nov 2021 13:12:26 +0100 Subject: [PATCH 09/18] Began adding DependencyInfos. --- DRAMSys/traceAnalyzer/CMakeLists.txt | 1 + .../phases/dependencyinfos.cpp | 19 +++++++ .../businessObjects/phases/dependencyinfos.h | 36 ++++++++++++ .../businessObjects/phases/phase.cpp | 1 - DRAMSys/traceAnalyzer/data/QueryTexts.h | 57 +++++++++++++++++++ DRAMSys/traceAnalyzer/data/tracedb.cpp | 50 +++++++++++++++- DRAMSys/traceAnalyzer/data/tracedb.h | 10 ++++ 7 files changed, 172 insertions(+), 2 deletions(-) create mode 100644 DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.cpp create mode 100644 DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.h diff --git a/DRAMSys/traceAnalyzer/CMakeLists.txt b/DRAMSys/traceAnalyzer/CMakeLists.txt index 361f8553..38de4eea 100644 --- a/DRAMSys/traceAnalyzer/CMakeLists.txt +++ b/DRAMSys/traceAnalyzer/CMakeLists.txt @@ -91,6 +91,7 @@ add_executable(TraceAnalyzer presentation/tracemetrictreewidget.cpp businessObjects/phases/phase.cpp businessObjects/phases/phasedependency.cpp + businessObjects/phases/dependencyinfos.cpp presentation/tracedrawingproperties.cpp presentation/util/traceplotline.cpp presentation/util/traceplotlinecache.cpp diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.cpp b/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.cpp new file mode 100644 index 00000000..1b5c2e54 --- /dev/null +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.cpp @@ -0,0 +1,19 @@ + +#include "dependencyinfos.h" + +DependencyInfos::DependencyInfos(Type type) + : mType(type) +{} + +DependencyInfos::DependencyInfos() +{ + mType = DependencyType; +} + +DependencyInfos::~DependencyInfos() +{} + +void DependencyInfos::addInfo(DependencyInfo info) +{ + mInfos.push_back(info); +} diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.h b/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.h new file mode 100644 index 00000000..7c70ec52 --- /dev/null +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.h @@ -0,0 +1,36 @@ +#pragma once + +#include + +#include + +struct DependencyInfo { + QString id; + float value; +}; + +class DependencyInfos +{ + public: + enum Type { + DependencyType, + TimeDependency, + DelayedPhase, + DependencyPhase + }; + + public: + DependencyInfos(Type); + DependencyInfos(); + ~DependencyInfos(); + + void setType(Type type) { mType = type; } + void addInfo(DependencyInfo); + + const std::vector& getInfos() const { return mInfos; } + + private: + Type mType; + std::vector mInfos; + +}; diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp index 73c63ead..488a6287 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp @@ -73,7 +73,6 @@ void Phase::draw(QPainter *painter, const QwtScaleMap &xMap, if (getGranularity() == Granularity::Bankwise) { - bool drawDependencyText = true; DependencyOptions drawDependenciesOptions = drawingProperties.drawDependenciesOption; if (drawDependenciesOptions.draw == DependencyOption::All || (drawDependenciesOptions.draw == DependencyOption::Selected && highlight)) diff --git a/DRAMSys/traceAnalyzer/data/QueryTexts.h b/DRAMSys/traceAnalyzer/data/QueryTexts.h index 9ff3d2a5..dda28293 100644 --- a/DRAMSys/traceAnalyzer/data/QueryTexts.h +++ b/DRAMSys/traceAnalyzer/data/QueryTexts.h @@ -43,6 +43,7 @@ struct TransactionQueryTexts { QString queryHead; QString selectTransactionsByTimespan, selectTransactionById; QString checkDependenciesExist, selectDependenciesByTimespan; + QString selectDependencyTypePercentages, selectTimeDependencyPercentages, selectDelayedPhasePercentages, selectDependencyPhasePercentages; TransactionQueryTexts() { @@ -61,6 +62,62 @@ struct TransactionQueryTexts { " ON DirectDependencies.DelayedPhaseID = timespanTransactions.PhaseID )"; + // For some reason I could not use a parameter for these below + selectDependencyTypePercentages = "WITH TotalDeps (total) AS ( " + "SELECT COUNT(*) FROM DirectDependencies " + "), " + "DependencyTypeDeps (param, ndeps) AS ( " + "SELECT " + "DependencyType, " + "COUNT(*) " + "FROM DirectDependencies " + "GROUP BY \"DependencyType\" " + ") " + "SELECT param, ROUND(ndeps*100.0 / (SELECT total FROM TotalDeps), 3) as percentage " + "FROM DependencyTypeDeps " + "ORDER BY percentage DESC "; + + selectTimeDependencyPercentages = "WITH TotalDeps (total) AS ( " + "SELECT COUNT(*) FROM DirectDependencies " + "), " + "DependencyTypeDeps (param, ndeps) AS ( " + "SELECT " + "TimeDependency, " + "COUNT(*) " + "FROM DirectDependencies " + "GROUP BY \"TimeDependency\" " + ") " + "SELECT param, ROUND(ndeps*100.0 / (SELECT total FROM TotalDeps), 3) as percentage " + "FROM DependencyTypeDeps " + "ORDER BY percentage DESC "; + + selectDelayedPhasePercentages = "WITH TotalDeps (total) AS ( " + "SELECT COUNT(*) FROM DirectDependencies " + "), " + "DependencyTypeDeps (param, ndeps) AS ( " + "SELECT " + "DelayedPhaseName, " + "COUNT(*) " + "FROM DirectDependencies " + "GROUP BY \"DelayedPhaseName\" " + ") " + "SELECT param, ROUND(ndeps*100.0 / (SELECT total FROM TotalDeps), 3) as percentage " + "FROM DependencyTypeDeps " + "ORDER BY percentage DESC "; + + selectDependencyPhasePercentages = "WITH TotalDeps (total) AS ( " + "SELECT COUNT(*) FROM DirectDependencies " + "), " + "DependencyTypeDeps (param, ndeps) AS ( " + "SELECT " + "DependencyPhaseName, " + "COUNT(*) " + "FROM DirectDependencies " + "GROUP BY \"DependencyPhaseName\" " + ") " + "SELECT param, ROUND(ndeps*100.0 / (SELECT total FROM TotalDeps), 3) as percentage " + "FROM DependencyTypeDeps " + "ORDER BY percentage DESC "; } }; diff --git a/DRAMSys/traceAnalyzer/data/tracedb.cpp b/DRAMSys/traceAnalyzer/data/tracedb.cpp index 2a3ace91..f7f85123 100644 --- a/DRAMSys/traceAnalyzer/data/tracedb.cpp +++ b/DRAMSys/traceAnalyzer/data/tracedb.cpp @@ -91,11 +91,18 @@ void TraceDB::prepareQueries() selectDependenciesByTimespan = QSqlQuery(database); selectDependenciesByTimespan.prepare(queryTexts.selectDependenciesByTimespan); + selectDependencyTypePercentages = QSqlQuery(database); + selectDependencyTypePercentages.prepare(queryTexts.selectDependencyTypePercentages); + selectTimeDependencyPercentages = QSqlQuery(database); + selectTimeDependencyPercentages.prepare(queryTexts.selectTimeDependencyPercentages); + selectDelayedPhasePercentages = QSqlQuery(database); + selectDelayedPhasePercentages.prepare(queryTexts.selectDelayedPhasePercentages); + selectDependencyPhasePercentages = QSqlQuery(database); + selectDependencyPhasePercentages.prepare(queryTexts.selectDependencyPhasePercentages); } void TraceDB::updateComments(const std::vector &comments) { - QSqlQuery query(database); query.prepare("DELETE FROM Comments"); executeQuery(query); @@ -381,6 +388,36 @@ vector TraceDB::getDebugMessagesInTimespan(const Timespan return parseCommentsFromQuery(selectDebugMessagesByTimespanWithLimit); } +DependencyInfos TraceDB::getDependencyInfos(DependencyInfos::Type infoType) +{ + DependencyInfos dummy; + executeQuery(checkDependenciesExist); + if (!checkDependenciesExist.next() || checkDependenciesExist.value(0).toInt() != 1) { + return dummy; + } + + switch(infoType) { + case DependencyInfos::Type::DependencyType: + executeQuery(selectDependencyTypePercentages); + return parseDependencyInfos(selectDependencyTypePercentages, infoType); + + case DependencyInfos::Type::TimeDependency: + executeQuery(selectTimeDependencyPercentages); + return parseDependencyInfos(selectTimeDependencyPercentages, infoType); + + case DependencyInfos::Type::DelayedPhase: + executeQuery(selectDelayedPhasePercentages); + return parseDependencyInfos(selectDelayedPhasePercentages, infoType); + + case DependencyInfos::Type::DependencyPhase: + executeQuery(selectDependencyPhasePercentages); + return parseDependencyInfos(selectDependencyPhasePercentages, infoType); + + } + + return dummy; +} + QSqlDatabase TraceDB::getDatabase() const { return database; @@ -515,6 +552,17 @@ vector TraceDB::parseCommentsFromQuery(QSqlQuery &query) return result; } +DependencyInfos TraceDB::parseDependencyInfos(QSqlQuery & query, const DependencyInfos::Type infoType) +{ + DependencyInfos infos(infoType); + + while(query.next()) { + infos.addInfo({query.value(0).toString(), query.value(1).toFloat()}); + } + + return infos; +} + void TraceDB::executeQuery(QSqlQuery query) { diff --git a/DRAMSys/traceAnalyzer/data/tracedb.h b/DRAMSys/traceAnalyzer/data/tracedb.h index ef9a8454..c81599a9 100644 --- a/DRAMSys/traceAnalyzer/data/tracedb.h +++ b/DRAMSys/traceAnalyzer/data/tracedb.h @@ -51,6 +51,7 @@ #include "businessObjects/generalinfo.h" #include "businessObjects/commandlengths.h" #include "businessObjects/phases/phasefactory.h" +#include "businessObjects/phases/dependencyinfos.h" #include "businessObjects/commentmodel.h" #include "QueryTexts.h" @@ -106,6 +107,9 @@ public: std::vector getDebugMessagesInTimespan(const Timespan &span, unsigned int limit); + // TODO + DependencyInfos getDependencyInfos(DependencyInfos::Type infoType); + QSqlDatabase getDatabase() const; private: @@ -122,6 +126,10 @@ private: QSqlQuery selectDebugMessagesByTimespanWithLimit; QSqlQuery checkDependenciesExist; QSqlQuery selectDependenciesByTimespan; + QSqlQuery selectDependencyTypePercentages; + QSqlQuery selectTimeDependencyPercentages; + QSqlQuery selectDelayedPhasePercentages; + QSqlQuery selectDependencyPhasePercentages; TransactionQueryTexts queryTexts; void prepareQueries(); @@ -133,6 +141,8 @@ private: bool updateVisiblePhases = false); std::vector parseCommentsFromQuery(QSqlQuery &query); + DependencyInfos parseDependencyInfos(QSqlQuery & query, const DependencyInfos::Type infoType); + void executeScriptFile(QString fileName); void dropAndCreateTables(); From 706db2f44ca32cbf9e5edba7a379f4bf869171a2 Mon Sep 17 00:00:00 2001 From: Iron Prando da Silva Date: Fri, 5 Nov 2021 10:55:30 +0100 Subject: [PATCH 10/18] Added dependency information tab. --- .../businessObjects/configmodels.cpp | 139 ++++++++++++++++++ .../businessObjects/configmodels.h | 47 ++++++ .../businessObjects/phases/dependencyinfos.h | 1 + DRAMSys/traceAnalyzer/data/tracedb.cpp | 4 +- DRAMSys/traceAnalyzer/data/tracedb.h | 3 +- DRAMSys/traceAnalyzer/tracefiletab.cpp | 6 +- DRAMSys/traceAnalyzer/tracefiletab.h | 2 + DRAMSys/traceAnalyzer/tracefiletab.ui | 16 ++ 8 files changed, 213 insertions(+), 5 deletions(-) diff --git a/DRAMSys/traceAnalyzer/businessObjects/configmodels.cpp b/DRAMSys/traceAnalyzer/businessObjects/configmodels.cpp index 94fe6ddd..7a1e893c 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/configmodels.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/configmodels.cpp @@ -282,3 +282,142 @@ QModelIndex MemSpecModel::parent(const QModelIndex &index) const return createIndex(parentNode->getRow(), 0, const_cast(parentNode)); } + +DependencyInfosModel::DependencyInfosModel(TraceDB &traceFile, QObject *parent) + : QAbstractItemModel(parent) +{ + mDepInfosDepType = traceFile.getDependencyInfos(DependencyInfos::Type::DependencyType); + mDepInfosTimeDep = traceFile.getDependencyInfos(DependencyInfos::Type::TimeDependency); + mDepInfosDelPhase = traceFile.getDependencyInfos(DependencyInfos::Type::DelayedPhase); + mDepInfosDepPhase = traceFile.getDependencyInfos(DependencyInfos::Type::DependencyPhase); + + parseInfos(); +} + +int DependencyInfosModel::Node::getRow() const +{ + if (!parent) + return 0; + + const auto &siblings = parent->children; + const auto siblingsIt = std::find_if(siblings.begin(), siblings.end(), [this](const std::unique_ptr &node){ + return node.get() == this; + }); + + Q_ASSERT(siblingsIt != siblings.end()); + + return std::distance(siblings.begin(), siblingsIt); +} + +void DependencyInfosModel::parseInfos() +{ + std::vector> infos = { + {"Dependency Granularity", mDepInfosDepType}, + {"Time Dependencies", mDepInfosTimeDep}, + {"Delayed Phases", mDepInfosDelPhase}, + {"Dependency Phases", mDepInfosDepPhase} + }; + + for (auto pair : infos) + { + std::unique_ptr node = std::unique_ptr(new Node({pair.first, ""}, rootNode.get())); + + for (auto v : pair.second.getInfos()) { + QString value = QString::number(v.value) + " %"; + node->children.push_back(std::move(std::unique_ptr(new Node({v.id, value}, node.get())))); + + } + + rootNode->children.push_back(std::move(node)); + + } +} + +int DependencyInfosModel::rowCount(const QModelIndex &parent) const +{ + if (parent.column() > 0) + return 0; + + const Node *parentNode; + + if (!parent.isValid()) + parentNode = rootNode.get(); + else + parentNode = static_cast(parent.internalPointer()); + + return parentNode->childCount(); +} + +int DependencyInfosModel::columnCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent) + + return 2; +} + +QVariant DependencyInfosModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid()) + return QVariant(); + + if (role != Qt::DisplayRole && role != Qt::ToolTipRole) + return QVariant(); + + auto *node = static_cast(index.internalPointer()); + + if (index.column() == 0) + return QVariant(node->data.first); + else + return QVariant(node->data.second); +} + +QVariant DependencyInfosModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + if (role != Qt::DisplayRole) + return QVariant(); + + if (orientation == Qt::Horizontal) + { + switch (section) { + case 0: + return "Field"; + case 1: + return "Percentage"; + default: + break; + } + } + + return QVariant(); +} + +QModelIndex DependencyInfosModel::index(int row, int column, const QModelIndex &parent) const +{ + if (!hasIndex(row, column, parent)) + return QModelIndex(); + + const Node *parentNode; + + if (!parent.isValid()) + parentNode = rootNode.get(); + else + parentNode = static_cast(parent.internalPointer()); + + const Node *node = parentNode->children[row].get(); + + return createIndex(row, column, const_cast(node)); +} + +QModelIndex DependencyInfosModel::parent(const QModelIndex &index) const +{ + if (!index.isValid()) + return QModelIndex(); + + const Node *childNode = static_cast(index.internalPointer()); + const Node *parentNode = childNode->parent; + + if (!parentNode) + return QModelIndex(); + + return createIndex(parentNode->getRow(), 0, const_cast(parentNode)); +} diff --git a/DRAMSys/traceAnalyzer/businessObjects/configmodels.h b/DRAMSys/traceAnalyzer/businessObjects/configmodels.h index f2a77a87..8b6c52e2 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/configmodels.h +++ b/DRAMSys/traceAnalyzer/businessObjects/configmodels.h @@ -37,6 +37,7 @@ #define CONFIGMODELS_H #include "../data/tracedb.h" +#include "phases/dependencyinfos.h" #include #include @@ -122,4 +123,50 @@ private: std::unique_ptr rootNode = std::unique_ptr(new Node); }; +class DependencyInfosModel : public QAbstractItemModel +{ + Q_OBJECT + public: + explicit DependencyInfosModel(TraceDB& traceFile, QObject* parent = nullptr); + ~DependencyInfosModel() {} + + protected: + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int columnCount(const QModelIndex &parent) const override; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + + QModelIndex index(int row, int column, const QModelIndex &parent) const override; + QModelIndex parent(const QModelIndex &index) const override; + + private: + DependencyInfos mDepInfosDepType; + DependencyInfos mDepInfosTimeDep; + DependencyInfos mDepInfosDelPhase; + DependencyInfos mDepInfosDepPhase; + + void parseInfos(); + struct Node + { + using NodeData = std::pair; + + Node() {} + Node(NodeData data, const Node *parent) : data(data), parent(parent) {} + + /** + * Gets the row relative to its parent. + */ + int getRow() const; + int childCount() const { return children.size(); } + + NodeData data; + + const Node *parent = nullptr; + std::vector> children; + }; + + std::unique_ptr rootNode = std::unique_ptr(new Node); +}; + #endif // CONFIGMODELS_H diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.h b/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.h index 7c70ec52..801f4272 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.h +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.h @@ -28,6 +28,7 @@ class DependencyInfos void addInfo(DependencyInfo); const std::vector& getInfos() const { return mInfos; } + size_t size() const { return mInfos.size(); } private: Type mType; diff --git a/DRAMSys/traceAnalyzer/data/tracedb.cpp b/DRAMSys/traceAnalyzer/data/tracedb.cpp index f7f85123..9259c07d 100644 --- a/DRAMSys/traceAnalyzer/data/tracedb.cpp +++ b/DRAMSys/traceAnalyzer/data/tracedb.cpp @@ -158,7 +158,7 @@ void TraceDB::updateDependenciesInTimespan(const Timespan &span) selectDependenciesByTimespan.bindValue(":begin", span.Begin()); selectDependenciesByTimespan.bindValue(":end", span.End()); executeQuery(selectDependenciesByTimespan); - _updateDependenciesFromQuery(selectDependenciesByTimespan); + mUpdateDependenciesFromQuery(selectDependenciesByTimespan); } @@ -491,7 +491,7 @@ vector> TraceDB::parseTransactionsFromQuery( return result; } -void TraceDB::_updateDependenciesFromQuery(QSqlQuery &query) { +void TraceDB::mUpdateDependenciesFromQuery(QSqlQuery &query) { DependencyType type; while(query.next()) { ID delayedID = query.value(0).toInt(); diff --git a/DRAMSys/traceAnalyzer/data/tracedb.h b/DRAMSys/traceAnalyzer/data/tracedb.h index c81599a9..5b8157be 100644 --- a/DRAMSys/traceAnalyzer/data/tracedb.h +++ b/DRAMSys/traceAnalyzer/data/tracedb.h @@ -97,7 +97,6 @@ public: // std::shared_ptr getNextActb(ID currentTransactionId); // std::shared_ptr getNextRefb(ID currentTransactionId); - void _updateDependenciesFromQuery(QSqlQuery &query); std::shared_ptr getTransactionByID(ID id); ID getTransactionIDFromPhaseID(ID phaseID); @@ -107,7 +106,6 @@ public: std::vector getDebugMessagesInTimespan(const Timespan &span, unsigned int limit); - // TODO DependencyInfos getDependencyInfos(DependencyInfos::Type infoType); QSqlDatabase getDatabase() const; @@ -141,6 +139,7 @@ private: bool updateVisiblePhases = false); std::vector parseCommentsFromQuery(QSqlQuery &query); + void mUpdateDependenciesFromQuery(QSqlQuery &query); DependencyInfos parseDependencyInfos(QSqlQuery & query, const DependencyInfos::Type infoType); void executeScriptFile(QString fileName); diff --git a/DRAMSys/traceAnalyzer/tracefiletab.cpp b/DRAMSys/traceAnalyzer/tracefiletab.cpp index e6368c31..f3d3cb34 100644 --- a/DRAMSys/traceAnalyzer/tracefiletab.cpp +++ b/DRAMSys/traceAnalyzer/tracefiletab.cpp @@ -68,7 +68,8 @@ TraceFileTab::TraceFileTab(QWidget *parent, const QString &path) : QWidget(parent), ui(new Ui::TraceFileTab), commentModel(new CommentModel(this)), navigator(new TraceNavigator(path, commentModel, this)), mcConfigModel(new McConfigModel(navigator->TraceFile(), this)), - memSpecModel(new MemSpecModel(navigator->TraceFile(), this)), savingChangesToDB(false) + memSpecModel(new MemSpecModel(navigator->TraceFile(), this)), savingChangesToDB(false), + depInfosView(new DependencyInfosModel(navigator->TraceFile(), this)) { ui->setupUi(this); this->path = path; @@ -88,6 +89,9 @@ TraceFileTab::TraceFileTab(QWidget *parent, const QString &path) ui->memSpecView->setModel(memSpecModel); ui->memSpecView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); + ui->depInfosView->setModel(depInfosView); + ui->depInfosView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); + tracefileChanged(); } diff --git a/DRAMSys/traceAnalyzer/tracefiletab.h b/DRAMSys/traceAnalyzer/tracefiletab.h index fb4c9392..b82a2ba1 100644 --- a/DRAMSys/traceAnalyzer/tracefiletab.h +++ b/DRAMSys/traceAnalyzer/tracefiletab.h @@ -95,6 +95,8 @@ private: QAbstractItemModel *mcConfigModel; QAbstractItemModel *memSpecModel; + QAbstractItemModel *depInfosView; + void setUpQueryEditor(QString path); bool savingChangesToDB; diff --git a/DRAMSys/traceAnalyzer/tracefiletab.ui b/DRAMSys/traceAnalyzer/tracefiletab.ui index 6a8594d2..0f885402 100644 --- a/DRAMSys/traceAnalyzer/tracefiletab.ui +++ b/DRAMSys/traceAnalyzer/tracefiletab.ui @@ -202,6 +202,22 @@ Customize Plot + + + + Dependency Information + + + + + + true + + + + + + Comments From 2314057f7b3dcef421ea1f8ea1d680874b791457 Mon Sep 17 00:00:00 2001 From: Iron Prando da Silva Date: Thu, 11 Nov 2021 09:14:56 +0100 Subject: [PATCH 11/18] Updating dependency metadata only when visualization option is set. --- DRAMSys/traceAnalyzer/mainwindow.cpp | 1 - DRAMSys/traceAnalyzer/presentation/traceplot.cpp | 5 ++++- DRAMSys/traceAnalyzer/presentation/tracescroller.cpp | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/DRAMSys/traceAnalyzer/mainwindow.cpp b/DRAMSys/traceAnalyzer/mainwindow.cpp index 8b68f2c3..2b0ba7bd 100644 --- a/DRAMSys/traceAnalyzer/mainwindow.cpp +++ b/DRAMSys/traceAnalyzer/mainwindow.cpp @@ -57,7 +57,6 @@ MainWindow::MainWindow(QWidget *parent) : traceNavigator->GeneralTraceInfo().TraceSpan()); transactions = db->getTransactionsInTimespan( traceNavigator->GeneralTraceInfo().TraceSpan()); - db->updateDependenciesInTimespan(traceNavigator->GeneralTraceInfo().TraceSpan()); ui->qwtPlot->setAxisScale(QwtPlot::xBottom, traceNavigator->GeneralTraceInfo().TraceSpan().Begin(), diff --git a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp index 9123b5a9..573c766b 100644 --- a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp +++ b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp @@ -508,7 +508,10 @@ void TracePlot::currentTraceTimeChanged() { transactions = navigator->TraceFile().getTransactionsInTimespan( GetCurrentTimespan()); - navigator->TraceFile().updateDependenciesInTimespan(GetCurrentTimespan()); + if (getDrawingProperties().drawDependenciesOption.draw != DependencyOption::Disabled) { + navigator->TraceFile().updateDependenciesInTimespan(GetCurrentTimespan()); + + } setAxisScale(xBottom, GetCurrentTimespan().Begin(), GetCurrentTimespan().End()); replot(); diff --git a/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp b/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp index 4220a9d5..d82d3514 100644 --- a/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp +++ b/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp @@ -197,7 +197,11 @@ void TraceScroller::currentTraceTimeChanged() canvasClip->setInterval(spanOnTracePlot.Begin(), spanOnTracePlot.End()); Timespan span = GetCurrentTimespan(); transactions = navigator->TraceFile().getTransactionsInTimespan(span); - navigator->TraceFile().updateDependenciesInTimespan(span); + + if (drawingProperties.drawDependenciesOption.draw != DependencyOption::Disabled) { + navigator->TraceFile().updateDependenciesInTimespan(span); + + } setAxisScale(xBottom, span.Begin(), span.End()); replot(); From 75933df6f441af61332b0a6fcfc8e1c9672e2d9e Mon Sep 17 00:00:00 2001 From: Iron Prando da Silva Date: Thu, 11 Nov 2021 09:17:20 +0100 Subject: [PATCH 12/18] Minor naming conflict. --- DRAMSys/traceAnalyzer/tracefiletab.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DRAMSys/traceAnalyzer/tracefiletab.ui b/DRAMSys/traceAnalyzer/tracefiletab.ui index 0f885402..22a0a210 100644 --- a/DRAMSys/traceAnalyzer/tracefiletab.ui +++ b/DRAMSys/traceAnalyzer/tracefiletab.ui @@ -207,7 +207,7 @@ Dependency Information - + From 6a260ef86018ac456d3065bbaa15399ddc1faf8f Mon Sep 17 00:00:00 2001 From: Iron Prando da Silva Date: Thu, 11 Nov 2021 10:11:39 +0100 Subject: [PATCH 13/18] Corrected plot update when dependency vis settings are changed. --- DRAMSys/traceAnalyzer/presentation/traceplot.cpp | 8 ++++---- .../traceAnalyzer/presentation/util/colorgenerator.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp index 573c766b..a55b3de5 100644 --- a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp +++ b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp @@ -184,19 +184,19 @@ void TracePlot::setUpActions() [&]() { drawingProperties.drawDependenciesOption.draw = DependencyOption::Disabled; - replot(); + currentTraceTimeChanged(); }); QObject::connect(selectedDependencies, &QAction::triggered, this, [&]() { drawingProperties.drawDependenciesOption.draw = DependencyOption::Selected; - replot(); + currentTraceTimeChanged(); }); QObject::connect(allDependencies, &QAction::triggered, this, [&]() { drawingProperties.drawDependenciesOption.draw = DependencyOption::All; - replot(); + currentTraceTimeChanged(); }); QObject::connect(switchDrawDependencyTextsOption, &QAction::triggered, this, [&]() @@ -210,7 +210,7 @@ void TracePlot::setUpActions() switchDrawDependencyTextsOption->setChecked(false); } - replot(); + currentTraceTimeChanged(); }); QActionGroup *dependenciesGroup = new QActionGroup(this); diff --git a/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.cpp b/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.cpp index 8c903705..703d48f0 100644 --- a/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.cpp +++ b/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.cpp @@ -101,7 +101,7 @@ QColor ColorGenerator::getColor(unsigned int i) result.setAlpha(130); return result; } -#include + QColor ColorGenerator::getAlphaColored(unsigned int i) { static ColorGenerator gen; const int minAlpha = 25; From c895c96b44d1e5e48b6ea80a23e2c793b2518e07 Mon Sep 17 00:00:00 2001 From: Iron Prando da Silva Date: Thu, 11 Nov 2021 10:39:13 +0100 Subject: [PATCH 14/18] Missed some potentially unnecessary database queries of the dependencies. --- DRAMSys/traceAnalyzer/data/tracedb.cpp | 4 ++-- DRAMSys/traceAnalyzer/data/tracedb.h | 2 +- DRAMSys/traceAnalyzer/presentation/traceplot.cpp | 6 ++++-- DRAMSys/traceAnalyzer/presentation/tracescroller.cpp | 6 ++++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/DRAMSys/traceAnalyzer/data/tracedb.cpp b/DRAMSys/traceAnalyzer/data/tracedb.cpp index 9259c07d..e931e936 100644 --- a/DRAMSys/traceAnalyzer/data/tracedb.cpp +++ b/DRAMSys/traceAnalyzer/data/tracedb.cpp @@ -141,12 +141,12 @@ vector> TraceDB::getTransactionsWithCustomQuery( } vector> TraceDB::getTransactionsInTimespan( - const Timespan &span) + const Timespan &span, bool updateVisiblePhases) { selectTransactionsByTimespan.bindValue(":begin", span.Begin()); selectTransactionsByTimespan.bindValue(":end", span.End()); executeQuery(selectTransactionsByTimespan); - return parseTransactionsFromQuery(selectTransactionsByTimespan, true); + return parseTransactionsFromQuery(selectTransactionsByTimespan, updateVisiblePhases); } void TraceDB::updateDependenciesInTimespan(const Timespan &span) diff --git a/DRAMSys/traceAnalyzer/data/tracedb.h b/DRAMSys/traceAnalyzer/data/tracedb.h index 5b8157be..7a4d91d7 100644 --- a/DRAMSys/traceAnalyzer/data/tracedb.h +++ b/DRAMSys/traceAnalyzer/data/tracedb.h @@ -88,7 +88,7 @@ public: std::vector> getTransactionsWithCustomQuery( QString queryText); std::vector> getTransactionsInTimespan( - const Timespan &span); + const Timespan &span, bool updateVisiblePhases = false); std::shared_ptr getNextPrecharge(traceTime time); std::shared_ptr getNextActivate(traceTime time); std::shared_ptr getNextRefresh(traceTime time); diff --git a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp index a55b3de5..f9788235 100644 --- a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp +++ b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp @@ -506,9 +506,11 @@ void TracePlot::setZoomLevel(traceTime newZoomLevel) void TracePlot::currentTraceTimeChanged() { + bool drawDependencies = getDrawingProperties().drawDependenciesOption.draw != DependencyOption::Disabled; + transactions = navigator->TraceFile().getTransactionsInTimespan( - GetCurrentTimespan()); - if (getDrawingProperties().drawDependenciesOption.draw != DependencyOption::Disabled) { + GetCurrentTimespan(), drawDependencies); + if (drawDependencies) { navigator->TraceFile().updateDependenciesInTimespan(GetCurrentTimespan()); } diff --git a/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp b/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp index d82d3514..fdb4cdba 100644 --- a/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp +++ b/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp @@ -193,12 +193,14 @@ void TraceScroller::colorGroupingChanged(ColorGrouping colorGrouping) void TraceScroller::currentTraceTimeChanged() { + bool drawDependencies = drawingProperties.drawDependenciesOption.draw != DependencyOption::Disabled; + Timespan spanOnTracePlot = tracePlot->GetCurrentTimespan(); canvasClip->setInterval(spanOnTracePlot.Begin(), spanOnTracePlot.End()); Timespan span = GetCurrentTimespan(); - transactions = navigator->TraceFile().getTransactionsInTimespan(span); + transactions = navigator->TraceFile().getTransactionsInTimespan(span, drawDependencies); - if (drawingProperties.drawDependenciesOption.draw != DependencyOption::Disabled) { + if (drawDependencies) { navigator->TraceFile().updateDependenciesInTimespan(span); } From 19a0b9d2cec13216f83643d5148a3601fa777ea5 Mon Sep 17 00:00:00 2001 From: Iron Prando da Silva Date: Thu, 11 Nov 2021 13:18:25 +0100 Subject: [PATCH 15/18] Code formatting. --- .../businessObjects/configmodels.cpp | 28 ++-- .../businessObjects/configmodels.h | 31 +++-- .../phases/dependencyinfos.cpp | 11 +- .../businessObjects/phases/dependencyinfos.h | 30 ++-- .../businessObjects/phases/phase.cpp | 73 +++++----- .../businessObjects/phases/phase.h | 16 +-- .../phases/phasedependency.cpp | 57 ++++---- .../businessObjects/phases/phasedependency.h | 32 +++-- .../businessObjects/transaction.h | 10 +- DRAMSys/traceAnalyzer/data/QueryTexts.h | 130 +++++++++--------- DRAMSys/traceAnalyzer/data/tracedb.cpp | 119 ++++++++-------- DRAMSys/traceAnalyzer/data/tracedb.h | 32 ++--- .../presentation/tracedrawingproperties.h | 20 ++- .../traceAnalyzer/presentation/traceplot.cpp | 72 +++++----- .../presentation/tracescroller.cpp | 6 +- .../presentation/util/colorgenerator.cpp | 7 +- DRAMSys/traceAnalyzer/tracefiletab.cpp | 2 +- 17 files changed, 357 insertions(+), 319 deletions(-) diff --git a/DRAMSys/traceAnalyzer/businessObjects/configmodels.cpp b/DRAMSys/traceAnalyzer/businessObjects/configmodels.cpp index 7a1e893c..52612acf 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/configmodels.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/configmodels.cpp @@ -283,8 +283,7 @@ QModelIndex MemSpecModel::parent(const QModelIndex &index) const return createIndex(parentNode->getRow(), 0, const_cast(parentNode)); } -DependencyInfosModel::DependencyInfosModel(TraceDB &traceFile, QObject *parent) - : QAbstractItemModel(parent) +DependencyInfosModel::DependencyInfosModel(TraceDB &traceFile, QObject *parent) : QAbstractItemModel(parent) { mDepInfosDepType = traceFile.getDependencyInfos(DependencyInfos::Type::DependencyType); mDepInfosTimeDep = traceFile.getDependencyInfos(DependencyInfos::Type::TimeDependency); @@ -300,9 +299,8 @@ int DependencyInfosModel::Node::getRow() const return 0; const auto &siblings = parent->children; - const auto siblingsIt = std::find_if(siblings.begin(), siblings.end(), [this](const std::unique_ptr &node){ - return node.get() == this; - }); + const auto siblingsIt = std::find_if(siblings.begin(), siblings.end(), + [this](const std::unique_ptr &node) { return node.get() == this; }); Q_ASSERT(siblingsIt != siblings.end()); @@ -311,25 +309,22 @@ int DependencyInfosModel::Node::getRow() const void DependencyInfosModel::parseInfos() { - std::vector> infos = { - {"Dependency Granularity", mDepInfosDepType}, - {"Time Dependencies", mDepInfosTimeDep}, - {"Delayed Phases", mDepInfosDelPhase}, - {"Dependency Phases", mDepInfosDepPhase} - }; + std::vector> infos = {{"Dependency Granularity", mDepInfosDepType}, + {"Time Dependencies", mDepInfosTimeDep}, + {"Delayed Phases", mDepInfosDelPhase}, + {"Dependency Phases", mDepInfosDepPhase}}; for (auto pair : infos) { std::unique_ptr node = std::unique_ptr(new Node({pair.first, ""}, rootNode.get())); - - for (auto v : pair.second.getInfos()) { + + for (auto v : pair.second.getInfos()) + { QString value = QString::number(v.value) + " %"; node->children.push_back(std::move(std::unique_ptr(new Node({v.id, value}, node.get())))); - } rootNode->children.push_back(std::move(node)); - } } @@ -378,7 +373,8 @@ QVariant DependencyInfosModel::headerData(int section, Qt::Orientation orientati if (orientation == Qt::Horizontal) { - switch (section) { + switch (section) + { case 0: return "Field"; case 1: diff --git a/DRAMSys/traceAnalyzer/businessObjects/configmodels.h b/DRAMSys/traceAnalyzer/businessObjects/configmodels.h index 8b6c52e2..99260f74 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/configmodels.h +++ b/DRAMSys/traceAnalyzer/businessObjects/configmodels.h @@ -126,11 +126,13 @@ private: class DependencyInfosModel : public QAbstractItemModel { Q_OBJECT - public: - explicit DependencyInfosModel(TraceDB& traceFile, QObject* parent = nullptr); - ~DependencyInfosModel() {} - - protected: +public: + explicit DependencyInfosModel(TraceDB &traceFile, QObject *parent = nullptr); + ~DependencyInfosModel() + { + } + +protected: int rowCount(const QModelIndex &parent = QModelIndex()) const override; int columnCount(const QModelIndex &parent) const override; @@ -140,10 +142,10 @@ class DependencyInfosModel : public QAbstractItemModel QModelIndex index(int row, int column, const QModelIndex &parent) const override; QModelIndex parent(const QModelIndex &index) const override; - private: - DependencyInfos mDepInfosDepType; +private: + DependencyInfos mDepInfosDepType; DependencyInfos mDepInfosTimeDep; - DependencyInfos mDepInfosDelPhase; + DependencyInfos mDepInfosDelPhase; DependencyInfos mDepInfosDepPhase; void parseInfos(); @@ -151,14 +153,21 @@ class DependencyInfosModel : public QAbstractItemModel { using NodeData = std::pair; - Node() {} - Node(NodeData data, const Node *parent) : data(data), parent(parent) {} + Node() + { + } + Node(NodeData data, const Node *parent) : data(data), parent(parent) + { + } /** * Gets the row relative to its parent. */ int getRow() const; - int childCount() const { return children.size(); } + int childCount() const + { + return children.size(); + } NodeData data; diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.cpp b/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.cpp index 1b5c2e54..1cf80fe8 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.cpp @@ -1,17 +1,18 @@ #include "dependencyinfos.h" -DependencyInfos::DependencyInfos(Type type) - : mType(type) -{} +DependencyInfos::DependencyInfos(Type type) : mType(type) +{ +} DependencyInfos::DependencyInfos() { mType = DependencyType; } -DependencyInfos::~DependencyInfos() -{} +DependencyInfos::~DependencyInfos() +{ +} void DependencyInfos::addInfo(DependencyInfo info) { diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.h b/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.h index 801f4272..4cca6df3 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.h +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.h @@ -4,34 +4,44 @@ #include -struct DependencyInfo { +struct DependencyInfo +{ QString id; float value; }; -class DependencyInfos +class DependencyInfos { - public: - enum Type { +public: + enum Type + { DependencyType, TimeDependency, DelayedPhase, DependencyPhase }; - public: +public: DependencyInfos(Type); DependencyInfos(); ~DependencyInfos(); - void setType(Type type) { mType = type; } + void setType(Type type) + { + mType = type; + } void addInfo(DependencyInfo); - const std::vector& getInfos() const { return mInfos; } - size_t size() const { return mInfos.size(); } + const std::vector &getInfos() const + { + return mInfos; + } + size_t size() const + { + return mInfos.size(); + } - private: +private: Type mType; std::vector mInfos; - }; diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp index 488a6287..9cbd5836 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp @@ -67,17 +67,20 @@ void Phase::draw(QPainter *painter, const QwtScaleMap &xMap, for (auto line : getTracePlotLines(drawingProperties)) { - if (!line->isCollapsed()) { + if (!line->isCollapsed()) + { drawPhaseSymbol(span.Begin(), span.End(), line->getYVal(), drawingProperties.drawText, getPhaseSymbol(), painter, xMap, yMap); - - if (getGranularity() == Granularity::Bankwise) { + + if (getGranularity() == Granularity::Bankwise) + { DependencyOptions drawDependenciesOptions = drawingProperties.drawDependenciesOption; if (drawDependenciesOptions.draw == DependencyOption::All || (drawDependenciesOptions.draw == DependencyOption::Selected && highlight)) { - drawPhaseDependencies(span.Begin(), span.End(), line->getYVal(), drawingProperties, painter, xMap, yMap); + drawPhaseDependencies(span.Begin(), span.End(), line->getYVal(), drawingProperties, painter, xMap, + yMap); } } } @@ -127,9 +130,9 @@ void Phase::drawPhaseSymbol(traceTime begin, traceTime end, double y, static_cast(yVal + symbolHeight / 2)), TextPositioning::bottomRight); } -void Phase::drawPhaseDependencies(traceTime begin, traceTime end, double y, const TraceDrawingProperties &drawingProperties, - QPainter *painter, const QwtScaleMap &xMap, - const QwtScaleMap &yMap) const +void Phase::drawPhaseDependencies(traceTime begin, traceTime end, double y, + const TraceDrawingProperties &drawingProperties, QPainter *painter, + const QwtScaleMap &xMap, const QwtScaleMap &yMap) const { QPen pen; pen.setWidth(2); @@ -140,28 +143,33 @@ void Phase::drawPhaseDependencies(traceTime begin, traceTime end, double y, cons double yVal = yMap.transform(y); double symbolHeight = yMap.transform(0) - yMap.transform(hexagonHeight); - + traceTime offset = (begin == end) ? static_cast(0.05 * clk) : 0; size_t invisibleDeps = 0; - QPoint depLineTo(static_cast(xMap.transform(begin/* + (end + offset - begin)/4*/)), static_cast(yVal)); - - for (auto dep : mDependencies) { + QPoint depLineTo(static_cast(xMap.transform(begin /* + (end + offset - begin)/4*/)), static_cast(yVal)); + + for (auto dep : mDependencies) + { bool visible = false; - if (dep->isVisible()) { - if (!dep->draw(depLineTo, drawingProperties, painter, xMap, yMap) ) { + if (dep->isVisible()) + { + if (!dep->draw(depLineTo, drawingProperties, painter, xMap, yMap)) + { invisibleDeps += 1; } - - } else { + } + else + { invisibleDeps += 1; - } } - if (invisibleDeps > 0) { - QPoint invisibleDepsPoint(static_cast(xMap.transform(begin + (end + offset - begin)/2)), static_cast(yVal + 0.1*symbolHeight)); + if (invisibleDeps > 0) + { + QPoint invisibleDepsPoint(static_cast(xMap.transform(begin + (end + offset - begin) / 2)), + static_cast(yVal + 0.1 * symbolHeight)); drawText(painter, QString::number(invisibleDeps), invisibleDepsPoint, TextPositioning::centerCenter); } @@ -171,22 +179,20 @@ void Phase::drawPhaseDependencies(traceTime begin, traceTime end, double y, cons QColor Phase::getColor(const TraceDrawingProperties &drawingProperties) const { switch (drawingProperties.colorGrouping) { - case ColorGrouping::PhaseType: - return getPhaseColor(); - break; - case ColorGrouping::Thread: - return ColorGenerator::getColor(static_cast - (transaction.lock()->thread)); - break; - case ColorGrouping::AlphaTransaction: - return ColorGenerator::getAlphaColored(transaction.lock()->id); + case ColorGrouping::PhaseType: + return getPhaseColor(); + break; + case ColorGrouping::Thread: + return ColorGenerator::getColor(static_cast(transaction.lock()->thread)); + break; + case ColorGrouping::AlphaTransaction: + return ColorGenerator::getAlphaColored(transaction.lock()->id); - break; - case ColorGrouping::Transaction: - default: - return ColorGenerator::getColor(transaction.lock()->id); + break; + case ColorGrouping::Transaction: + default: + return ColorGenerator::getColor(transaction.lock()->id); } - } Qt::BrushStyle Phase::getBrushStyle() const @@ -255,6 +261,7 @@ std::vector> Phase::getTracePlotLines(const Trace } } -void Phase::addDependency(std::shared_ptr dependency) { +void Phase::addDependency(std::shared_ptr dependency) +{ mDependencies.push_back(dependency); } diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.h b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.h index fb590845..148d1cea 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.h +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.h @@ -38,15 +38,15 @@ #ifndef BANKPHASE_H #define BANKPHASE_H -#include "presentation/util/colorgenerator.h" -#include "presentation/tracedrawingproperties.h" -#include "businessObjects/timespan.h" #include "businessObjects/phases/phasedependency.h" -#include +#include "businessObjects/timespan.h" +#include "presentation/tracedrawingproperties.h" +#include "presentation/util/colorgenerator.h" #include +#include +#include #include #include -#include typedef unsigned int ID; //enum TextPositioning; @@ -100,10 +100,8 @@ protected: bool drawtext, PhaseSymbol symbol, QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap) const; virtual void drawPhaseDependencies(traceTime begin, traceTime end, double y, - const TraceDrawingProperties &drawingProperties, - QPainter *painter, const QwtScaleMap &xMap, - const QwtScaleMap &yMap) const; - + const TraceDrawingProperties &drawingProperties, QPainter *painter, + const QwtScaleMap &xMap, const QwtScaleMap &yMap) const; virtual std::vector> getTracePlotLines(const TraceDrawingProperties &drawingProperties) const; diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp index df7fcb6b..9b439957 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp @@ -5,48 +5,49 @@ PhaseDependency::PhaseDependency(DependencyType type, QString timeDependency, std::shared_ptr dependency) { mType = type; - mTimeDependency = timeDependency; + mTimeDependency = timeDependency; mDependency = dependency; } PhaseDependency::PhaseDependency(DependencyType type, QString timeDependency) { mType = type; - mTimeDependency = timeDependency; + mTimeDependency = timeDependency; mDependency = nullptr; mIsInvisible = true; } PhaseDependency::~PhaseDependency() { - } -bool PhaseDependency::draw(QPoint& end, const TraceDrawingProperties &drawingProperties, - QPainter *painter, const QwtScaleMap &xMap, - const QwtScaleMap &yMap) +bool PhaseDependency::draw(QPoint &end, const TraceDrawingProperties &drawingProperties, QPainter *painter, + const QwtScaleMap &xMap, const QwtScaleMap &yMap) { - if (mIsInvisible) return false; + if (mIsInvisible) + return false; traceTime depBegin = mDependency->span.Begin(); traceTime depEnd = mDependency->span.End(); - if (xMap.transform(depEnd) < 0) return false; + if (xMap.transform(depEnd) < 0) + return false; bool drawn = false; - for (auto line : mDependency->getTracePlotLines(drawingProperties)) { - if (!line->isCollapsed()) { + for (auto line : mDependency->getTracePlotLines(drawingProperties)) + { + if (!line->isCollapsed()) + { mDraw(end, line->getYVal(), drawingProperties, painter, xMap, yMap); drawn = true; } } - + return drawn; } -void PhaseDependency::mDraw(QPoint& end, double depY, const TraceDrawingProperties &drawingProperties, - QPainter *painter, const QwtScaleMap &xMap, - const QwtScaleMap &yMap) +void PhaseDependency::mDraw(QPoint &end, double depY, const TraceDrawingProperties &drawingProperties, + QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap) { traceTime depBegin = mDependency->span.Begin(); traceTime depEnd = mDependency->span.End(); @@ -55,14 +56,16 @@ void PhaseDependency::mDraw(QPoint& end, double depY, const TraceDrawingProperti double depYVal = yMap.transform(depY); double depSymbolHeight = yMap.transform(0) - yMap.transform(mDependency->hexagonHeight); - QPoint depLineFrom(static_cast(xMap.transform(depBegin/* + (depEnd + depOffset - depBegin)/4*/)), static_cast(depYVal)); + QPoint depLineFrom(static_cast(xMap.transform(depBegin /* + (depEnd + depOffset - depBegin)/4*/)), + static_cast(depYVal)); QLineF line(depLineFrom, end); double angle = std::atan2(-line.dy(), line.dx()); qreal arrowSize = 10; QPointF arrowP1 = line.p2() - QPointF(sin(angle + M_PI / 3) * arrowSize, cos(angle + M_PI / 3) * arrowSize); - QPointF arrowP2 = line.p2() - QPointF(sin(angle + M_PI - M_PI / 3) * arrowSize, cos(angle + M_PI - M_PI / 3) * arrowSize); + QPointF arrowP2 = + line.p2() - QPointF(sin(angle + M_PI - M_PI / 3) * arrowSize, cos(angle + M_PI - M_PI / 3) * arrowSize); QPolygonF arrowHead; arrowHead << line.p2() << arrowP1 << arrowP2; @@ -72,25 +75,23 @@ void PhaseDependency::mDraw(QPoint& end, double depY, const TraceDrawingProperti painter->drawLine(line); painter->drawPolygon(arrowHead); - if (drawingProperties.drawDependenciesOption.text == DependencyTextOption::Enabled) { + if (drawingProperties.drawDependenciesOption.text == DependencyTextOption::Enabled) + { QPoint textPosition(line.x1() + (line.x2() - line.x1()) / 2, line.y1() + (line.y2() - line.y1()) / 2); auto alignment = TextPositioning::topRight; - if (textPosition.y() == line.y1()) { + if (textPosition.y() == line.y1()) + { alignment = TextPositioning::topCenter; - - } else if (textPosition.x() == line.x1()) { - if (line.y1() > line.y2()) { + } + else if (textPosition.x() == line.x1()) + { + if (line.y1() > line.y2()) + { alignment = TextPositioning::bottomRight; } } - drawText( - painter, - mTimeDependency, - textPosition, - alignment - ); - + drawText(painter, mTimeDependency, textPosition, alignment); } } \ No newline at end of file diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.h b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.h index 05aa23c2..1f4c1de8 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.h +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.h @@ -1,41 +1,45 @@ #pragma once -#include "presentation/tracedrawingproperties.h" #include "businessObjects/timespan.h" +#include "presentation/tracedrawingproperties.h" -#include -#include -#include #include +#include +#include +#include #include class Phase; -enum DependencyType { - Bank, Rank, InterRank +enum DependencyType +{ + Bank, + Rank, + InterRank }; class PhaseDependency { - public: +public: PhaseDependency(DependencyType type, QString timeDependency, std::shared_ptr dependency); PhaseDependency(DependencyType type, QString timeDependency); ~PhaseDependency(); - bool isVisible() { return !mIsInvisible; } + bool isVisible() + { + return !mIsInvisible; + } - bool draw(QPoint& end, const TraceDrawingProperties &drawingProperties, - QPainter *painter, const QwtScaleMap &xMap, + bool draw(QPoint &end, const TraceDrawingProperties &drawingProperties, QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap); - protected: +protected: DependencyType mType; QString mTimeDependency; std::shared_ptr mDependency; bool mIsInvisible = false; - void mDraw(QPoint& end, double depY, const TraceDrawingProperties &drawingProperties, - QPainter *painter, const QwtScaleMap &xMap, - const QwtScaleMap &yMap); + void mDraw(QPoint &end, double depY, const TraceDrawingProperties &drawingProperties, QPainter *painter, + const QwtScaleMap &xMap, const QwtScaleMap &yMap); }; diff --git a/DRAMSys/traceAnalyzer/businessObjects/transaction.h b/DRAMSys/traceAnalyzer/businessObjects/transaction.h index fce35c05..200692e6 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/transaction.h +++ b/DRAMSys/traceAnalyzer/businessObjects/transaction.h @@ -76,8 +76,14 @@ public: } public: - static void setNumTransactions(const unsigned int numTransactions) { mSNumTransactions = numTransactions; } - static unsigned int getNumTransactions(const unsigned int numTransactions) { return mSNumTransactions; } + static void setNumTransactions(const unsigned int numTransactions) + { + mSNumTransactions = numTransactions; + } + static unsigned int getNumTransactions(const unsigned int numTransactions) + { + return mSNumTransactions; + } private: static unsigned int mSNumTransactions; diff --git a/DRAMSys/traceAnalyzer/data/QueryTexts.h b/DRAMSys/traceAnalyzer/data/QueryTexts.h index dda28293..91aefdbd 100644 --- a/DRAMSys/traceAnalyzer/data/QueryTexts.h +++ b/DRAMSys/traceAnalyzer/data/QueryTexts.h @@ -43,7 +43,8 @@ struct TransactionQueryTexts { QString queryHead; QString selectTransactionsByTimespan, selectTransactionById; QString checkDependenciesExist, selectDependenciesByTimespan; - QString selectDependencyTypePercentages, selectTimeDependencyPercentages, selectDelayedPhasePercentages, selectDependencyPhasePercentages; + QString selectDependencyTypePercentages, selectTimeDependencyPercentages, selectDelayedPhasePercentages, + selectDependencyPhasePercentages; TransactionQueryTexts() { @@ -55,69 +56,74 @@ struct TransactionQueryTexts { " WHERE Ranges.end >= :begin AND Ranges.begin <= :end"; selectTransactionById = queryHead + " WHERE Transactions.ID = :id"; - checkDependenciesExist = "SELECT CASE WHEN 0 < (SELECT count(*) FROM sqlite_master WHERE type = 'table' AND name = 'DirectDependencies') THEN 1 ELSE 0 END AS result"; - selectDependenciesByTimespan = "WITH timespanTransactions AS (" + selectTransactionsByTimespan + - ") SELECT * from DirectDependencies WHERE DelayedPhaseID IN (" - " SELECT DirectDependencies.DelayedPhaseID FROM DirectDependencies JOIN timespanTransactions " - " ON DirectDependencies.DelayedPhaseID = timespanTransactions.PhaseID )"; - + checkDependenciesExist = "SELECT CASE WHEN 0 < (SELECT count(*) FROM sqlite_master WHERE type = 'table' AND " + "name = 'DirectDependencies') THEN 1 ELSE 0 END AS result"; + selectDependenciesByTimespan = + "WITH timespanTransactions AS (" + selectTransactionsByTimespan + + ") SELECT * from DirectDependencies WHERE DelayedPhaseID IN (" + " SELECT DirectDependencies.DelayedPhaseID FROM DirectDependencies JOIN timespanTransactions " + " ON DirectDependencies.DelayedPhaseID = timespanTransactions.PhaseID )"; // For some reason I could not use a parameter for these below - selectDependencyTypePercentages = "WITH TotalDeps (total) AS ( " - "SELECT COUNT(*) FROM DirectDependencies " - "), " - "DependencyTypeDeps (param, ndeps) AS ( " - "SELECT " - "DependencyType, " - "COUNT(*) " - "FROM DirectDependencies " - "GROUP BY \"DependencyType\" " - ") " - "SELECT param, ROUND(ndeps*100.0 / (SELECT total FROM TotalDeps), 3) as percentage " - "FROM DependencyTypeDeps " - "ORDER BY percentage DESC "; - - selectTimeDependencyPercentages = "WITH TotalDeps (total) AS ( " - "SELECT COUNT(*) FROM DirectDependencies " - "), " - "DependencyTypeDeps (param, ndeps) AS ( " - "SELECT " - "TimeDependency, " - "COUNT(*) " - "FROM DirectDependencies " - "GROUP BY \"TimeDependency\" " - ") " - "SELECT param, ROUND(ndeps*100.0 / (SELECT total FROM TotalDeps), 3) as percentage " - "FROM DependencyTypeDeps " - "ORDER BY percentage DESC "; - - selectDelayedPhasePercentages = "WITH TotalDeps (total) AS ( " - "SELECT COUNT(*) FROM DirectDependencies " - "), " - "DependencyTypeDeps (param, ndeps) AS ( " - "SELECT " - "DelayedPhaseName, " - "COUNT(*) " - "FROM DirectDependencies " - "GROUP BY \"DelayedPhaseName\" " - ") " - "SELECT param, ROUND(ndeps*100.0 / (SELECT total FROM TotalDeps), 3) as percentage " - "FROM DependencyTypeDeps " - "ORDER BY percentage DESC "; - - selectDependencyPhasePercentages = "WITH TotalDeps (total) AS ( " - "SELECT COUNT(*) FROM DirectDependencies " - "), " - "DependencyTypeDeps (param, ndeps) AS ( " - "SELECT " - "DependencyPhaseName, " - "COUNT(*) " - "FROM DirectDependencies " - "GROUP BY \"DependencyPhaseName\" " - ") " - "SELECT param, ROUND(ndeps*100.0 / (SELECT total FROM TotalDeps), 3) as percentage " - "FROM DependencyTypeDeps " - "ORDER BY percentage DESC "; + selectDependencyTypePercentages = + "WITH TotalDeps (total) AS ( " + "SELECT COUNT(*) FROM DirectDependencies " + "), " + "DependencyTypeDeps (param, ndeps) AS ( " + "SELECT " + "DependencyType, " + "COUNT(*) " + "FROM DirectDependencies " + "GROUP BY \"DependencyType\" " + ") " + "SELECT param, ROUND(ndeps*100.0 / (SELECT total FROM TotalDeps), 3) as percentage " + "FROM DependencyTypeDeps " + "ORDER BY percentage DESC "; + + selectTimeDependencyPercentages = + "WITH TotalDeps (total) AS ( " + "SELECT COUNT(*) FROM DirectDependencies " + "), " + "DependencyTypeDeps (param, ndeps) AS ( " + "SELECT " + "TimeDependency, " + "COUNT(*) " + "FROM DirectDependencies " + "GROUP BY \"TimeDependency\" " + ") " + "SELECT param, ROUND(ndeps*100.0 / (SELECT total FROM TotalDeps), 3) as percentage " + "FROM DependencyTypeDeps " + "ORDER BY percentage DESC "; + + selectDelayedPhasePercentages = + "WITH TotalDeps (total) AS ( " + "SELECT COUNT(*) FROM DirectDependencies " + "), " + "DependencyTypeDeps (param, ndeps) AS ( " + "SELECT " + "DelayedPhaseName, " + "COUNT(*) " + "FROM DirectDependencies " + "GROUP BY \"DelayedPhaseName\" " + ") " + "SELECT param, ROUND(ndeps*100.0 / (SELECT total FROM TotalDeps), 3) as percentage " + "FROM DependencyTypeDeps " + "ORDER BY percentage DESC "; + + selectDependencyPhasePercentages = + "WITH TotalDeps (total) AS ( " + "SELECT COUNT(*) FROM DirectDependencies " + "), " + "DependencyTypeDeps (param, ndeps) AS ( " + "SELECT " + "DependencyPhaseName, " + "COUNT(*) " + "FROM DirectDependencies " + "GROUP BY \"DependencyPhaseName\" " + ") " + "SELECT param, ROUND(ndeps*100.0 / (SELECT total FROM TotalDeps), 3) as percentage " + "FROM DependencyTypeDeps " + "ORDER BY percentage DESC "; } }; diff --git a/DRAMSys/traceAnalyzer/data/tracedb.cpp b/DRAMSys/traceAnalyzer/data/tracedb.cpp index e931e936..ceb9c242 100644 --- a/DRAMSys/traceAnalyzer/data/tracedb.cpp +++ b/DRAMSys/traceAnalyzer/data/tracedb.cpp @@ -140,8 +140,7 @@ vector> TraceDB::getTransactionsWithCustomQuery( return parseTransactionsFromQuery(query); } -vector> TraceDB::getTransactionsInTimespan( - const Timespan &span, bool updateVisiblePhases) +vector> TraceDB::getTransactionsInTimespan(const Timespan &span, bool updateVisiblePhases) { selectTransactionsByTimespan.bindValue(":begin", span.Begin()); selectTransactionsByTimespan.bindValue(":end", span.End()); @@ -152,18 +151,17 @@ vector> TraceDB::getTransactionsInTimespan( void TraceDB::updateDependenciesInTimespan(const Timespan &span) { executeQuery(checkDependenciesExist); - if (checkDependenciesExist.next()) { - - if (checkDependenciesExist.value(0).toInt() == 1) { + if (checkDependenciesExist.next()) + { + + if (checkDependenciesExist.value(0).toInt() == 1) + { selectDependenciesByTimespan.bindValue(":begin", span.Begin()); selectDependenciesByTimespan.bindValue(":end", span.End()); executeQuery(selectDependenciesByTimespan); mUpdateDependenciesFromQuery(selectDependenciesByTimespan); - } - } - } //TODO Remove exception @@ -388,31 +386,32 @@ vector TraceDB::getDebugMessagesInTimespan(const Timespan return parseCommentsFromQuery(selectDebugMessagesByTimespanWithLimit); } -DependencyInfos TraceDB::getDependencyInfos(DependencyInfos::Type infoType) +DependencyInfos TraceDB::getDependencyInfos(DependencyInfos::Type infoType) { DependencyInfos dummy; executeQuery(checkDependenciesExist); - if (!checkDependenciesExist.next() || checkDependenciesExist.value(0).toInt() != 1) { + if (!checkDependenciesExist.next() || checkDependenciesExist.value(0).toInt() != 1) + { return dummy; } - switch(infoType) { - case DependencyInfos::Type::DependencyType: - executeQuery(selectDependencyTypePercentages); - return parseDependencyInfos(selectDependencyTypePercentages, infoType); + switch (infoType) + { + case DependencyInfos::Type::DependencyType: + executeQuery(selectDependencyTypePercentages); + return parseDependencyInfos(selectDependencyTypePercentages, infoType); - case DependencyInfos::Type::TimeDependency: - executeQuery(selectTimeDependencyPercentages); - return parseDependencyInfos(selectTimeDependencyPercentages, infoType); + case DependencyInfos::Type::TimeDependency: + executeQuery(selectTimeDependencyPercentages); + return parseDependencyInfos(selectTimeDependencyPercentages, infoType); - case DependencyInfos::Type::DelayedPhase: - executeQuery(selectDelayedPhasePercentages); - return parseDependencyInfos(selectDelayedPhasePercentages, infoType); - - case DependencyInfos::Type::DependencyPhase: - executeQuery(selectDependencyPhasePercentages); - return parseDependencyInfos(selectDependencyPhasePercentages, infoType); + case DependencyInfos::Type::DelayedPhase: + executeQuery(selectDelayedPhasePercentages); + return parseDependencyInfos(selectDelayedPhasePercentages, infoType); + case DependencyInfos::Type::DependencyPhase: + executeQuery(selectDependencyPhasePercentages); + return parseDependencyInfos(selectDependencyPhasePercentages, infoType); } return dummy; @@ -439,11 +438,10 @@ shared_ptr TraceDB::parseTransactionFromQuery(QSqlQuery &query) return shared_ptr(); } -vector> TraceDB::parseTransactionsFromQuery( - QSqlQuery &query, - bool updateVisiblePhases) +vector> TraceDB::parseTransactionsFromQuery(QSqlQuery &query, bool updateVisiblePhases) { - if (updateVisiblePhases) { + if (updateVisiblePhases) + { _visiblePhases.clear(); } @@ -483,62 +481,58 @@ vector> TraceDB::parseTransactionsFromQuery( auto phase = PhaseFactory::CreatePhase(phaseID, phaseName, span, result.at(result.size() - 1), *this); result.at(result.size() - 1)->addPhase(phase); - if (updateVisiblePhases) { + if (updateVisiblePhases) + { _visiblePhases[phaseID] = phase; } - } return result; } -void TraceDB::mUpdateDependenciesFromQuery(QSqlQuery &query) { +void TraceDB::mUpdateDependenciesFromQuery(QSqlQuery &query) +{ DependencyType type; - while(query.next()) { + while (query.next()) + { ID delayedID = query.value(0).toInt(); ID dependencyID = query.value(4).toInt(); QString dependencyTypeStr = query.value(2).toString(); - if (dependencyTypeStr == "bank") { + if (dependencyTypeStr == "bank") + { type = DependencyType::Bank; - } else if (dependencyTypeStr == "rank") { + } + else if (dependencyTypeStr == "rank") + { type = DependencyType::Rank; - } else if (dependencyTypeStr == "interRank") { + } + else if (dependencyTypeStr == "interRank") + { type = DependencyType::InterRank; } QString timeDependencyStr = query.value(3).toString(); - if (_visiblePhases.count(delayedID) > 0) { + if (_visiblePhases.count(delayedID) > 0) + { - if (_visiblePhases.count(dependencyID) > 0) { - - _visiblePhases[delayedID]->addDependency( - std::shared_ptr( - new PhaseDependency( - type, - timeDependencyStr, - _visiblePhases[dependencyID] - ) - ) - ); - - } else { - - _visiblePhases[delayedID]->addDependency( - std::shared_ptr( - new PhaseDependency( - type, - timeDependencyStr - ) - ) - ); + if (_visiblePhases.count(dependencyID) > 0) + { + _visiblePhases[delayedID]->addDependency(std::shared_ptr( + new PhaseDependency(type, timeDependencyStr, _visiblePhases[dependencyID]))); } + else + { - } else { + _visiblePhases[delayedID]->addDependency( + std::shared_ptr(new PhaseDependency(type, timeDependencyStr))); + } + } + else + { // TODO delayed phase not visible? } - } } @@ -552,11 +546,12 @@ vector TraceDB::parseCommentsFromQuery(QSqlQuery &query) return result; } -DependencyInfos TraceDB::parseDependencyInfos(QSqlQuery & query, const DependencyInfos::Type infoType) +DependencyInfos TraceDB::parseDependencyInfos(QSqlQuery &query, const DependencyInfos::Type infoType) { DependencyInfos infos(infoType); - while(query.next()) { + while (query.next()) + { infos.addInfo({query.value(0).toString(), query.value(1).toFloat()}); } diff --git a/DRAMSys/traceAnalyzer/data/tracedb.h b/DRAMSys/traceAnalyzer/data/tracedb.h index 7a4d91d7..bc93bd60 100644 --- a/DRAMSys/traceAnalyzer/data/tracedb.h +++ b/DRAMSys/traceAnalyzer/data/tracedb.h @@ -39,21 +39,20 @@ #ifndef TRACEDB_H #define TRACEDB_H -#include -#include -#include +#include "QueryTexts.h" +#include "businessObjects/commandlengths.h" +#include "businessObjects/commentmodel.h" +#include "businessObjects/generalinfo.h" +#include "businessObjects/phases/dependencyinfos.h" +#include "businessObjects/phases/phasefactory.h" +#include "businessObjects/transaction.h" #include #include #include -#include +#include +#include #include -#include "businessObjects/transaction.h" -#include "businessObjects/generalinfo.h" -#include "businessObjects/commandlengths.h" -#include "businessObjects/phases/phasefactory.h" -#include "businessObjects/phases/dependencyinfos.h" -#include "businessObjects/commentmodel.h" -#include "QueryTexts.h" +#include /* TraceDB handles the connection to a SQLLite database containing trace data. * A TraceDB object always holds an open connection to a valid database. @@ -87,8 +86,8 @@ public: std::vector> getTransactionsWithCustomQuery( QString queryText); - std::vector> getTransactionsInTimespan( - const Timespan &span, bool updateVisiblePhases = false); + std::vector> getTransactionsInTimespan(const Timespan &span, + bool updateVisiblePhases = false); std::shared_ptr getNextPrecharge(traceTime time); std::shared_ptr getNextActivate(traceTime time); std::shared_ptr getNextRefresh(traceTime time); @@ -134,13 +133,12 @@ private: void executeQuery(QSqlQuery query); QString queryToString(QSqlQuery query); std::shared_ptr parseTransactionFromQuery(QSqlQuery &query); - std::vector> parseTransactionsFromQuery( - QSqlQuery &query, - bool updateVisiblePhases = false); + std::vector> parseTransactionsFromQuery(QSqlQuery &query, + bool updateVisiblePhases = false); std::vector parseCommentsFromQuery(QSqlQuery &query); void mUpdateDependenciesFromQuery(QSqlQuery &query); - DependencyInfos parseDependencyInfos(QSqlQuery & query, const DependencyInfos::Type infoType); + DependencyInfos parseDependencyInfos(QSqlQuery &query, const DependencyInfos::Type infoType); void executeScriptFile(QString fileName); void dropAndCreateTables(); diff --git a/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h b/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h index 1ae4c238..4d0b8753 100644 --- a/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h +++ b/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h @@ -51,7 +51,13 @@ #include "util/togglecollapsedaction.h" #include "traceselector.h" -enum class ColorGrouping {PhaseType, Transaction, Thread, AlphaTransaction}; +enum class ColorGrouping +{ + PhaseType, + Transaction, + Thread, + AlphaTransaction +}; class TracePlot; class TracePlotLineCache; @@ -64,9 +70,14 @@ enum class DependencyOption Selected, All }; -enum class DependencyTextOption {Enabled, Disabled}; +enum class DependencyTextOption +{ + Enabled, + Disabled +}; -struct DependencyOptions { +struct DependencyOptions +{ DependencyOption draw; DependencyTextOption text; }; @@ -89,7 +100,8 @@ public: unsigned int banksPerGroup; TraceDrawingProperties(bool drawText = true, bool drawBorder = true, - DependencyOptions drawDependenciesOption = {DependencyOption::Disabled, DependencyTextOption::Enabled}, + DependencyOptions drawDependenciesOption = {DependencyOption::Disabled, + DependencyTextOption::Enabled}, ColorGrouping colorGrouping = ColorGrouping::PhaseType); ~TraceDrawingProperties(); diff --git a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp index f9788235..2d0fcf21 100644 --- a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp +++ b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp @@ -155,7 +155,7 @@ void TracePlot::setUpActions() addAction(setColorGroupingThread); QObject::connect(setColorGroupingThread, SIGNAL(triggered()), this, SLOT(on_colorGroupingThread())); - + exportToPdf = new QAction("Export to SVG", this); addAction(exportToPdf); QObject::connect(exportToPdf, SIGNAL(triggered()), this, @@ -180,38 +180,31 @@ void TracePlot::setUpActions() switchDrawDependencyTextsOption->setChecked(true); disabledDependencies->setChecked(true); - QObject::connect(disabledDependencies, &QAction::triggered, this, - [&]() - { - drawingProperties.drawDependenciesOption.draw = DependencyOption::Disabled; - currentTraceTimeChanged(); - }); - QObject::connect(selectedDependencies, &QAction::triggered, this, - [&]() - { - drawingProperties.drawDependenciesOption.draw = DependencyOption::Selected; - currentTraceTimeChanged(); - }); - QObject::connect(allDependencies, &QAction::triggered, this, - [&]() - { - drawingProperties.drawDependenciesOption.draw = DependencyOption::All; - currentTraceTimeChanged(); - }); - QObject::connect(switchDrawDependencyTextsOption, &QAction::triggered, this, - [&]() - { - if (drawingProperties.drawDependenciesOption.text == DependencyTextOption::Disabled) { - drawingProperties.drawDependenciesOption.text = DependencyTextOption::Enabled; - switchDrawDependencyTextsOption->setChecked(true); - - } else { - drawingProperties.drawDependenciesOption.text = DependencyTextOption::Disabled; - switchDrawDependencyTextsOption->setChecked(false); - - } - currentTraceTimeChanged(); - }); + QObject::connect(disabledDependencies, &QAction::triggered, this, [&]() { + drawingProperties.drawDependenciesOption.draw = DependencyOption::Disabled; + currentTraceTimeChanged(); + }); + QObject::connect(selectedDependencies, &QAction::triggered, this, [&]() { + drawingProperties.drawDependenciesOption.draw = DependencyOption::Selected; + currentTraceTimeChanged(); + }); + QObject::connect(allDependencies, &QAction::triggered, this, [&]() { + drawingProperties.drawDependenciesOption.draw = DependencyOption::All; + currentTraceTimeChanged(); + }); + QObject::connect(switchDrawDependencyTextsOption, &QAction::triggered, this, [&]() { + if (drawingProperties.drawDependenciesOption.text == DependencyTextOption::Disabled) + { + drawingProperties.drawDependenciesOption.text = DependencyTextOption::Enabled; + switchDrawDependencyTextsOption->setChecked(true); + } + else + { + drawingProperties.drawDependenciesOption.text = DependencyTextOption::Disabled; + switchDrawDependencyTextsOption->setChecked(false); + } + currentTraceTimeChanged(); + }); QActionGroup *dependenciesGroup = new QActionGroup(this); dependenciesGroup->addAction(disabledDependencies); @@ -227,11 +220,13 @@ void TracePlot::setUpContextMenu() contextMenu->addActions({deselectAll}); QMenu *colorGroupingSubMenu = new QMenu("Group by", contextMenu); - colorGroupingSubMenu->addActions({setColorGroupingPhase, setColorGroupingTransaction, setColorGroupingThread, setColorGroupingAlphaTransaction}); + colorGroupingSubMenu->addActions( + {setColorGroupingPhase, setColorGroupingTransaction, setColorGroupingThread, setColorGroupingAlphaTransaction}); contextMenu->addMenu(colorGroupingSubMenu); QMenu *dependenciesSubMenu = new QMenu("Show dependencies", contextMenu); - dependenciesSubMenu->addActions({disabledDependencies, selectedDependencies, allDependencies, switchDrawDependencyTextsOption}); + dependenciesSubMenu->addActions( + {disabledDependencies, selectedDependencies, allDependencies, switchDrawDependencyTextsOption}); contextMenu->addMenu(dependenciesSubMenu); QMenu *goToSubMenu = new QMenu("Go to", contextMenu); @@ -508,11 +503,10 @@ void TracePlot::currentTraceTimeChanged() { bool drawDependencies = getDrawingProperties().drawDependenciesOption.draw != DependencyOption::Disabled; - transactions = navigator->TraceFile().getTransactionsInTimespan( - GetCurrentTimespan(), drawDependencies); - if (drawDependencies) { + transactions = navigator->TraceFile().getTransactionsInTimespan(GetCurrentTimespan(), drawDependencies); + if (drawDependencies) + { navigator->TraceFile().updateDependenciesInTimespan(GetCurrentTimespan()); - } setAxisScale(xBottom, GetCurrentTimespan().Begin(), GetCurrentTimespan().End()); diff --git a/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp b/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp index fdb4cdba..50d5dbd6 100644 --- a/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp +++ b/DRAMSys/traceAnalyzer/presentation/tracescroller.cpp @@ -45,7 +45,7 @@ TraceScroller::TraceScroller(QWidget *parent) : QwtPlot(parent), isInitialized(false), - drawingProperties(false, false, {DependencyOption::Disabled, DependencyTextOption::Disabled}, + drawingProperties(false, false, {DependencyOption::Disabled, DependencyTextOption::Disabled}, ColorGrouping::PhaseType) { setAxisScaleDraw(xBottom, new EngineeringScaleDraw); @@ -200,9 +200,9 @@ void TraceScroller::currentTraceTimeChanged() Timespan span = GetCurrentTimespan(); transactions = navigator->TraceFile().getTransactionsInTimespan(span, drawDependencies); - if (drawDependencies) { + if (drawDependencies) + { navigator->TraceFile().updateDependenciesInTimespan(span); - } setAxisScale(xBottom, span.Begin(), span.End()); diff --git a/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.cpp b/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.cpp index 703d48f0..7ee01e94 100644 --- a/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.cpp +++ b/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.cpp @@ -102,11 +102,12 @@ QColor ColorGenerator::getColor(unsigned int i) return result; } -QColor ColorGenerator::getAlphaColored(unsigned int i) { +QColor ColorGenerator::getAlphaColored(unsigned int i) +{ static ColorGenerator gen; const int minAlpha = 25; - const int alphaLevels = 40 - 255/minAlpha; - int alpha = minAlpha + (int) (((255.-minAlpha)/alphaLevels) * (i % alphaLevels)); + const int alphaLevels = 40 - 255 / minAlpha; + int alpha = minAlpha + (int)(((255. - minAlpha) / alphaLevels) * (i % alphaLevels)); i = (i / alphaLevels) % 16; QColor result(gen.r[i], gen.g[i], gen.b[i]); result.setAlpha(alpha); diff --git a/DRAMSys/traceAnalyzer/tracefiletab.cpp b/DRAMSys/traceAnalyzer/tracefiletab.cpp index f3d3cb34..cc85396e 100644 --- a/DRAMSys/traceAnalyzer/tracefiletab.cpp +++ b/DRAMSys/traceAnalyzer/tracefiletab.cpp @@ -91,7 +91,7 @@ TraceFileTab::TraceFileTab(QWidget *parent, const QString &path) ui->depInfosView->setModel(depInfosView); ui->depInfosView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); - + tracefileChanged(); } From eea5dd80f7dd2cd9d30f384408c5f9a769aa827e Mon Sep 17 00:00:00 2001 From: Iron Prando da Silva Date: Mon, 15 Nov 2021 11:28:21 +0100 Subject: [PATCH 16/18] Added graying out of the dependency submenu. --- DRAMSys/traceAnalyzer/data/tracedb.cpp | 24 +++++++++++-------- DRAMSys/traceAnalyzer/data/tracedb.h | 1 + .../traceAnalyzer/presentation/traceplot.cpp | 4 +++- .../traceAnalyzer/presentation/traceplot.h | 4 +++- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/DRAMSys/traceAnalyzer/data/tracedb.cpp b/DRAMSys/traceAnalyzer/data/tracedb.cpp index ceb9c242..eb6fd547 100644 --- a/DRAMSys/traceAnalyzer/data/tracedb.cpp +++ b/DRAMSys/traceAnalyzer/data/tracedb.cpp @@ -148,19 +148,23 @@ vector> TraceDB::getTransactionsInTimespan(const Timespa return parseTransactionsFromQuery(selectTransactionsByTimespan, updateVisiblePhases); } -void TraceDB::updateDependenciesInTimespan(const Timespan &span) +bool TraceDB::checkDependencyTableExists() { executeQuery(checkDependenciesExist); - if (checkDependenciesExist.next()) - { + if (checkDependenciesExist.next() && checkDependenciesExist.value(0).toInt() == 1) + return true; - if (checkDependenciesExist.value(0).toInt() == 1) - { - selectDependenciesByTimespan.bindValue(":begin", span.Begin()); - selectDependenciesByTimespan.bindValue(":end", span.End()); - executeQuery(selectDependenciesByTimespan); - mUpdateDependenciesFromQuery(selectDependenciesByTimespan); - } + return false; +} + +void TraceDB::updateDependenciesInTimespan(const Timespan &span) +{ + if (checkDependencyTableExists()) + { + selectDependenciesByTimespan.bindValue(":begin", span.Begin()); + selectDependenciesByTimespan.bindValue(":end", span.End()); + executeQuery(selectDependenciesByTimespan); + mUpdateDependenciesFromQuery(selectDependenciesByTimespan); } } diff --git a/DRAMSys/traceAnalyzer/data/tracedb.h b/DRAMSys/traceAnalyzer/data/tracedb.h index bc93bd60..a07f087d 100644 --- a/DRAMSys/traceAnalyzer/data/tracedb.h +++ b/DRAMSys/traceAnalyzer/data/tracedb.h @@ -105,6 +105,7 @@ public: std::vector getDebugMessagesInTimespan(const Timespan &span, unsigned int limit); + bool checkDependencyTableExists(); DependencyInfos getDependencyInfos(DependencyInfos::Type infoType); QSqlDatabase getDatabase() const; diff --git a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp index 2d0fcf21..43721a31 100644 --- a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp +++ b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp @@ -224,7 +224,7 @@ void TracePlot::setUpContextMenu() {setColorGroupingPhase, setColorGroupingTransaction, setColorGroupingThread, setColorGroupingAlphaTransaction}); contextMenu->addMenu(colorGroupingSubMenu); - QMenu *dependenciesSubMenu = new QMenu("Show dependencies", contextMenu); + dependenciesSubMenu = new QMenu("Show dependencies", contextMenu); dependenciesSubMenu->addActions( {disabledDependencies, selectedDependencies, allDependencies, switchDrawDependencyTextsOption}); contextMenu->addMenu(dependenciesSubMenu); @@ -274,6 +274,8 @@ void TracePlot::init(TraceNavigator *navigator, QScrollBar *scrollBar, CommentMo updateScrollbar(); + dependenciesSubMenu->setEnabled(navigator->TraceFile().checkDependencyTableExists()); + replot(); } diff --git a/DRAMSys/traceAnalyzer/presentation/traceplot.h b/DRAMSys/traceAnalyzer/presentation/traceplot.h index 911b1692..10376d51 100644 --- a/DRAMSys/traceAnalyzer/presentation/traceplot.h +++ b/DRAMSys/traceAnalyzer/presentation/traceplot.h @@ -182,11 +182,13 @@ private: QAction *setColorGroupingThread; QAction *setColorGroupingAlphaTransaction; QAction *exportToPdf; + ToggleCollapsedAction *toggleCollapsedState; + + QMenu *dependenciesSubMenu; QAction *disabledDependencies; QAction *selectedDependencies; QAction *allDependencies; QAction *switchDrawDependencyTextsOption; - ToggleCollapsedAction *toggleCollapsedState; TracePlotMouseLabel *mouseLabel; From 82fb529f534b36ba5f29fb2911a0146fda588e3e Mon Sep 17 00:00:00 2001 From: Iron Prando da Silva Date: Mon, 15 Nov 2021 11:41:59 +0100 Subject: [PATCH 17/18] Adding disclaimers and signing. --- DRAMSys/traceAnalyzer/CMakeLists.txt | 1 + .../businessObjects/configmodels.cpp | 1 + .../businessObjects/configmodels.h | 1 + .../phases/dependencyinfos.cpp | 34 ++++++++++++++++++ .../businessObjects/phases/dependencyinfos.h | 35 +++++++++++++++++++ .../businessObjects/phases/phase.cpp | 1 + .../businessObjects/phases/phase.h | 1 + .../phases/phasedependency.cpp | 35 +++++++++++++++++++ .../businessObjects/phases/phasedependency.h | 35 +++++++++++++++++++ .../businessObjects/transaction.cpp | 1 + .../businessObjects/transaction.h | 1 + DRAMSys/traceAnalyzer/data/QueryTexts.h | 1 + DRAMSys/traceAnalyzer/data/tracedb.cpp | 1 + DRAMSys/traceAnalyzer/data/tracedb.h | 1 + .../presentation/tracedrawingproperties.cpp | 1 + .../presentation/tracedrawingproperties.h | 1 + .../presentation/tracenavigator.cpp | 1 + .../traceAnalyzer/presentation/traceplot.cpp | 1 + .../traceAnalyzer/presentation/traceplot.h | 1 + .../presentation/tracescroller.h | 1 + .../presentation/util/colorgenerator.cpp | 1 + .../presentation/util/colorgenerator.h | 1 + DRAMSys/traceAnalyzer/tracefiletab.cpp | 1 + DRAMSys/traceAnalyzer/tracefiletab.h | 1 + 24 files changed, 159 insertions(+) diff --git a/DRAMSys/traceAnalyzer/CMakeLists.txt b/DRAMSys/traceAnalyzer/CMakeLists.txt index 38de4eea..355a8c90 100644 --- a/DRAMSys/traceAnalyzer/CMakeLists.txt +++ b/DRAMSys/traceAnalyzer/CMakeLists.txt @@ -32,6 +32,7 @@ # Matthias Jung # Lukas Steiner # Derek Christ +# Iron Prando da Silva cmake_minimum_required(VERSION 3.12) diff --git a/DRAMSys/traceAnalyzer/businessObjects/configmodels.cpp b/DRAMSys/traceAnalyzer/businessObjects/configmodels.cpp index 52612acf..efa0de4a 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/configmodels.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/configmodels.cpp @@ -31,6 +31,7 @@ * * Authors: * Derek Christ + * Iron Prando da Silva */ #include "configmodels.h" diff --git a/DRAMSys/traceAnalyzer/businessObjects/configmodels.h b/DRAMSys/traceAnalyzer/businessObjects/configmodels.h index 99260f74..7408db5c 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/configmodels.h +++ b/DRAMSys/traceAnalyzer/businessObjects/configmodels.h @@ -31,6 +31,7 @@ * * Authors: * Derek Christ + * Iron Prando da Silva */ #ifndef CONFIGMODELS_H diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.cpp b/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.cpp index 1cf80fe8..04eb74bd 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.cpp @@ -1,3 +1,37 @@ +/* + * Copyright (c) 2021, Technische Universität Kaiserslautern + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: + * Iron Prando da Silva + */ #include "dependencyinfos.h" diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.h b/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.h index 4cca6df3..2fda0e83 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.h +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/dependencyinfos.h @@ -1,3 +1,38 @@ +/* + * Copyright (c) 2021, Technische Universität Kaiserslautern + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: + * Iron Prando da Silva + */ + #pragma once #include diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp index 9cbd5836..15ec782a 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.cpp @@ -34,6 +34,7 @@ * Robert Gernhardt * Matthias Jung * Derek Christ + * Iron Prando da Silva */ #include "phase.h" diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.h b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.h index 148d1cea..feb7b99a 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phase.h +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phase.h @@ -34,6 +34,7 @@ * Robert Gernhardt * Matthias Jung * Derek Christ + * Iron Prando da Silva */ #ifndef BANKPHASE_H diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp index 9b439957..e76d0f8e 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.cpp @@ -1,3 +1,38 @@ +/* + * Copyright (c) 2021, Technische Universität Kaiserslautern + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: + * Iron Prando da Silva + */ + #include "phasedependency.h" #include "phase.h" #include diff --git a/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.h b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.h index 1f4c1de8..41be1c1e 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.h +++ b/DRAMSys/traceAnalyzer/businessObjects/phases/phasedependency.h @@ -1,3 +1,38 @@ +/* + * Copyright (c) 2021, Technische Universität Kaiserslautern + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: + * Iron Prando da Silva + */ + #pragma once #include "businessObjects/timespan.h" diff --git a/DRAMSys/traceAnalyzer/businessObjects/transaction.cpp b/DRAMSys/traceAnalyzer/businessObjects/transaction.cpp index cc2753dd..11f188f7 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/transaction.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/transaction.cpp @@ -33,6 +33,7 @@ * Janik Schlemminger * Robert Gernhardt * Matthias Jung + * Iron Prando da Silva */ #include "transaction.h" diff --git a/DRAMSys/traceAnalyzer/businessObjects/transaction.h b/DRAMSys/traceAnalyzer/businessObjects/transaction.h index 200692e6..d2c97990 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/transaction.h +++ b/DRAMSys/traceAnalyzer/businessObjects/transaction.h @@ -33,6 +33,7 @@ * Janik Schlemminger * Robert Gernhardt * Matthias Jung + * Iron Prando da Silva */ #ifndef TRANSACTION_H diff --git a/DRAMSys/traceAnalyzer/data/QueryTexts.h b/DRAMSys/traceAnalyzer/data/QueryTexts.h index 91aefdbd..361ec855 100644 --- a/DRAMSys/traceAnalyzer/data/QueryTexts.h +++ b/DRAMSys/traceAnalyzer/data/QueryTexts.h @@ -33,6 +33,7 @@ * Janik Schlemminger * Robert Gernhardt * Matthias Jung + * Iron Prando da Silva */ #ifndef QUERYTEXTS_H diff --git a/DRAMSys/traceAnalyzer/data/tracedb.cpp b/DRAMSys/traceAnalyzer/data/tracedb.cpp index eb6fd547..98fa0978 100644 --- a/DRAMSys/traceAnalyzer/data/tracedb.cpp +++ b/DRAMSys/traceAnalyzer/data/tracedb.cpp @@ -34,6 +34,7 @@ * Robert Gernhardt * Matthias Jung * Derek Christ + * Iron Prando da Silva */ #include diff --git a/DRAMSys/traceAnalyzer/data/tracedb.h b/DRAMSys/traceAnalyzer/data/tracedb.h index a07f087d..525824b8 100644 --- a/DRAMSys/traceAnalyzer/data/tracedb.h +++ b/DRAMSys/traceAnalyzer/data/tracedb.h @@ -34,6 +34,7 @@ * Robert Gernhardt * Matthias Jung * Derek Christ + * Iron Prando da Silva */ #ifndef TRACEDB_H diff --git a/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.cpp b/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.cpp index f693034b..8a1971d4 100644 --- a/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.cpp +++ b/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.cpp @@ -31,6 +31,7 @@ * * Author: * Derek Christ + * Iron Prando da Silva */ #include "tracedrawingproperties.h" diff --git a/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h b/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h index 4d0b8753..2573606e 100644 --- a/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h +++ b/DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.h @@ -34,6 +34,7 @@ * Robert Gernhardt * Matthias Jung * Derek Christ + * Iron Prando da Silva */ #ifndef TRACECOLLECTIONDRAWINGPROPERTIES_H diff --git a/DRAMSys/traceAnalyzer/presentation/tracenavigator.cpp b/DRAMSys/traceAnalyzer/presentation/tracenavigator.cpp index f3e4df78..ae236ad2 100644 --- a/DRAMSys/traceAnalyzer/presentation/tracenavigator.cpp +++ b/DRAMSys/traceAnalyzer/presentation/tracenavigator.cpp @@ -34,6 +34,7 @@ * Robert Gernhardt * Matthias Jung * Derek Christ + * Iron Prando da Silva */ #include "tracenavigator.h" diff --git a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp index 43721a31..7c93d29d 100644 --- a/DRAMSys/traceAnalyzer/presentation/traceplot.cpp +++ b/DRAMSys/traceAnalyzer/presentation/traceplot.cpp @@ -34,6 +34,7 @@ * Robert Gernhardt * Matthias Jung * Derek Christ + * Iron Prando da Silva */ #include diff --git a/DRAMSys/traceAnalyzer/presentation/traceplot.h b/DRAMSys/traceAnalyzer/presentation/traceplot.h index 10376d51..c3ec388c 100644 --- a/DRAMSys/traceAnalyzer/presentation/traceplot.h +++ b/DRAMSys/traceAnalyzer/presentation/traceplot.h @@ -34,6 +34,7 @@ * Robert Gernhardt * Matthias Jung * Derek Christ + * Iron Prando da Silva */ #ifndef TRACEPLOT_H diff --git a/DRAMSys/traceAnalyzer/presentation/tracescroller.h b/DRAMSys/traceAnalyzer/presentation/tracescroller.h index 310d46d1..ad7b01eb 100644 --- a/DRAMSys/traceAnalyzer/presentation/tracescroller.h +++ b/DRAMSys/traceAnalyzer/presentation/tracescroller.h @@ -34,6 +34,7 @@ * Robert Gernhardt * Matthias Jung * Derek Christ + * Iron Prando da Silva */ #ifndef TRACESCROLLER_H diff --git a/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.cpp b/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.cpp index 7ee01e94..ae3070a6 100644 --- a/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.cpp +++ b/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.cpp @@ -33,6 +33,7 @@ * Janik Schlemminger * Robert Gernhardt * Matthias Jung + * Iron Prando da Silva */ #include "colorgenerator.h" diff --git a/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.h b/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.h index 024203ac..35941474 100644 --- a/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.h +++ b/DRAMSys/traceAnalyzer/presentation/util/colorgenerator.h @@ -33,6 +33,7 @@ * Janik Schlemminger * Robert Gernhardt * Matthias Jung + * Iron Prando da Silva */ #ifndef COLORGENERATOR_H diff --git a/DRAMSys/traceAnalyzer/tracefiletab.cpp b/DRAMSys/traceAnalyzer/tracefiletab.cpp index cc85396e..8135e0f8 100644 --- a/DRAMSys/traceAnalyzer/tracefiletab.cpp +++ b/DRAMSys/traceAnalyzer/tracefiletab.cpp @@ -34,6 +34,7 @@ * Robert Gernhardt * Matthias Jung * Derek Christ + * Iron Prando da Silva */ #include "tracefiletab.h" diff --git a/DRAMSys/traceAnalyzer/tracefiletab.h b/DRAMSys/traceAnalyzer/tracefiletab.h index b82a2ba1..a3dd8d43 100644 --- a/DRAMSys/traceAnalyzer/tracefiletab.h +++ b/DRAMSys/traceAnalyzer/tracefiletab.h @@ -34,6 +34,7 @@ * Robert Gernhardt * Matthias Jung * Derek Christ + * Iron Prando da Silva */ #ifndef TRACEFILETAB_H From 90aae753a6b2243c1eb999fd83437577ce0e4882 Mon Sep 17 00:00:00 2001 From: Iron Prando da Silva Date: Mon, 15 Nov 2021 11:47:27 +0100 Subject: [PATCH 18/18] Dependency infos tab will remain empty if dependencies table is not available. --- DRAMSys/traceAnalyzer/businessObjects/configmodels.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/DRAMSys/traceAnalyzer/businessObjects/configmodels.cpp b/DRAMSys/traceAnalyzer/businessObjects/configmodels.cpp index efa0de4a..149ccf8d 100644 --- a/DRAMSys/traceAnalyzer/businessObjects/configmodels.cpp +++ b/DRAMSys/traceAnalyzer/businessObjects/configmodels.cpp @@ -291,7 +291,10 @@ DependencyInfosModel::DependencyInfosModel(TraceDB &traceFile, QObject *parent) mDepInfosDelPhase = traceFile.getDependencyInfos(DependencyInfos::Type::DelayedPhase); mDepInfosDepPhase = traceFile.getDependencyInfos(DependencyInfos::Type::DependencyPhase); - parseInfos(); + if (traceFile.checkDependencyTableExists()) + { + parseInfos(); + } } int DependencyInfosModel::Node::getRow() const @@ -310,6 +313,7 @@ int DependencyInfosModel::Node::getRow() const void DependencyInfosModel::parseInfos() { + std::vector> infos = {{"Dependency Granularity", mDepInfosDepType}, {"Time Dependencies", mDepInfosTimeDep}, {"Delayed Phases", mDepInfosDelPhase},