Make ranks collapsible in TraceAnalyzer
All individual ranks in the TraceAnalyzer are now collapsible, making it easier to display simulation results with many ranks.
This commit is contained in:
@@ -89,6 +89,9 @@ add_executable(TraceAnalyzer
|
||||
businessObjects/tracetestresults.cpp
|
||||
presentation/tracemetrictreewidget.cpp
|
||||
businessObjects/phases/phase.cpp
|
||||
presentation/tracedrawingproperties.cpp
|
||||
presentation/traceplotline.cpp
|
||||
presentation/util/customlabelscaledraw.cpp
|
||||
|
||||
selectmetrics.ui
|
||||
preferences.ui
|
||||
|
||||
@@ -63,21 +63,24 @@ void Phase::draw(QPainter *painter, const QwtScaleMap &xMap,
|
||||
painter->setPen(pen);
|
||||
}
|
||||
|
||||
if (getGranularity() == Granularity::Rankwise)
|
||||
if (!isCollapsed(drawingProperties))
|
||||
{
|
||||
for (int i = getYVal(drawingProperties); i < (int)(getYVal(drawingProperties) + drawingProperties.banksPerRank); i++)
|
||||
drawPhaseSymbol(span.Begin(), span.End(), i, drawingProperties.drawText,
|
||||
getPhaseSymbol(), painter, xMap, yMap);
|
||||
if (getGranularity() == Granularity::Rankwise)
|
||||
{
|
||||
for (int i = getYVal(drawingProperties); i < (int)(getYVal(drawingProperties) + drawingProperties.banksPerRank); i++)
|
||||
drawPhaseSymbol(span.Begin(), span.End(), i, drawingProperties.drawText,
|
||||
getPhaseSymbol(), painter, xMap, yMap);
|
||||
}
|
||||
else if (getGranularity() == Granularity::Groupwise)
|
||||
{
|
||||
for (int i = getYVal(drawingProperties); i < (int)(getYVal(drawingProperties) + drawingProperties.banksPerRank); i += drawingProperties.banksPerGroup)
|
||||
drawPhaseSymbol(span.Begin(), span.End(), i, drawingProperties.drawText,
|
||||
getPhaseSymbol(), painter, xMap, yMap);
|
||||
}
|
||||
else // if (getGranularity() == Granularity::Bankwise)
|
||||
drawPhaseSymbol(span.Begin(), span.End(), getYVal(drawingProperties),
|
||||
drawingProperties.drawText, getPhaseSymbol(), painter, xMap, yMap);
|
||||
}
|
||||
else if (getGranularity() == Granularity::Groupwise)
|
||||
{
|
||||
for (int i = getYVal(drawingProperties); i < (int)(getYVal(drawingProperties) + drawingProperties.banksPerRank); i += drawingProperties.banksPerGroup)
|
||||
drawPhaseSymbol(span.Begin(), span.End(), i, drawingProperties.drawText,
|
||||
getPhaseSymbol(), painter, xMap, yMap);
|
||||
}
|
||||
else // if (getGranularity() == Granularity::Bankwise)
|
||||
drawPhaseSymbol(span.Begin(), span.End(), getYVal(drawingProperties),
|
||||
drawingProperties.drawText, getPhaseSymbol(), painter, xMap, yMap);
|
||||
|
||||
for (Timespan span : spansOnCommandBus)
|
||||
{
|
||||
@@ -136,12 +139,11 @@ QColor Phase::getColor(const TraceDrawingProperties &drawingProperties) const
|
||||
int Phase::getYVal(const TraceDrawingProperties &drawingProperties) const
|
||||
{
|
||||
if (getGranularity() == Granularity::Bankwise)
|
||||
return transaction->bank;
|
||||
return drawingProperties.getYValOfBank(transaction->bank);
|
||||
else if (getGranularity() == Granularity::Groupwise)
|
||||
return transaction->rank * drawingProperties.banksPerRank
|
||||
+ transaction->bank % drawingProperties.banksPerGroup;
|
||||
return drawingProperties.getYValOfBankGroup(transaction->rank, transaction->bank);
|
||||
else // if (getGranularity() == Granularity::Rankwise)
|
||||
return transaction->rank * drawingProperties.banksPerRank;
|
||||
return drawingProperties.getYValOfRank(transaction->rank);
|
||||
}
|
||||
|
||||
Qt::BrushStyle Phase::getBrushStyle() const
|
||||
@@ -196,3 +198,12 @@ Phase::PhaseSymbol Phase::getPhaseSymbol() const
|
||||
{
|
||||
return PhaseSymbol::Hexagon;
|
||||
}
|
||||
|
||||
bool Phase::isCollapsed(const TraceDrawingProperties &drawingProperties) const
|
||||
{
|
||||
// Never discard REQ and RESP phases
|
||||
if (dynamic_cast<const REQ *>(this) != nullptr || dynamic_cast<const RESP *>(this) != nullptr)
|
||||
return false;
|
||||
|
||||
return drawingProperties.getRankCollapsedState(transaction->rank);
|
||||
}
|
||||
|
||||
@@ -101,6 +101,8 @@ protected:
|
||||
{
|
||||
return Granularity::Bankwise;
|
||||
}
|
||||
|
||||
bool isCollapsed(const TraceDrawingProperties &drawingProperties) const;
|
||||
};
|
||||
|
||||
class REQ : public Phase
|
||||
|
||||
202
DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.cpp
Normal file
202
DRAMSys/traceAnalyzer/presentation/tracedrawingproperties.cpp
Normal file
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Author:
|
||||
* Derek Christ
|
||||
*/
|
||||
|
||||
#include "tracedrawingproperties.h"
|
||||
|
||||
TraceDrawingProperties::TraceDrawingProperties() :
|
||||
drawText(true),
|
||||
drawBorder(true),
|
||||
colorGrouping(ColorGrouping::PhaseType)
|
||||
{
|
||||
}
|
||||
|
||||
TraceDrawingProperties::TraceDrawingProperties(bool drawText, bool drawBorder,
|
||||
ColorGrouping colorGrouping) :
|
||||
drawText(drawText),
|
||||
drawBorder(drawBorder),
|
||||
colorGrouping(colorGrouping)
|
||||
{
|
||||
}
|
||||
|
||||
void TraceDrawingProperties::setUpTracePlotLines()
|
||||
{
|
||||
tracePlotLines.push_back(std::make_shared<TracePlotRequestLine>("REQ", collapsedRanks));
|
||||
tracePlotLines.push_back(std::make_shared<TracePlotResponseLine>("RESP", collapsedRanks));
|
||||
|
||||
for (unsigned int rank = numberOfRanks; rank--;)
|
||||
{
|
||||
for (unsigned int group = groupsPerRank; group--;)
|
||||
{
|
||||
for (unsigned int bank = banksPerGroup; bank--;)
|
||||
{
|
||||
QString rankLabel = QString("RA") + QString::number(rank);
|
||||
QString bankGroupLabel = QString("BG") + QString::number(group);
|
||||
QString bankLabel = QString("BA") + QString::number(bank);
|
||||
|
||||
QString label = rankLabel + QString(" ") + bankGroupLabel + QString(" ") + bankLabel;
|
||||
|
||||
std::shared_ptr<TracePlotLine> line;
|
||||
|
||||
if (bank == banksPerGroup - 1 && group == groupsPerRank - 1)
|
||||
line = std::make_shared<TracePlotFirstRankLine>(label, rankLabel, rank, collapsedRanks);
|
||||
else
|
||||
line = std::make_shared<TracePlotBankLine>(label, rank, collapsedRanks);
|
||||
|
||||
tracePlotLines.push_back(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tracePlotLines.push_back(std::make_shared<TracePlotCommandBusLine>("Command Bus", collapsedRanks));
|
||||
tracePlotLines.push_back(std::make_shared<TracePlotDataBusLine>("Data Bus", collapsedRanks));
|
||||
|
||||
// Collapse all ranks except the first one by default.
|
||||
for (int i = 0; i < numberOfRanks; i++)
|
||||
if (i == 0)
|
||||
setRankCollapsedState(i, false);
|
||||
else
|
||||
setRankCollapsedState(i, true);
|
||||
}
|
||||
|
||||
void TraceDrawingProperties::updateLabels()
|
||||
{
|
||||
// Clear hash table, because otherwise not all old values will be overwritten.
|
||||
labels->clear();
|
||||
|
||||
// The data bus is defined to start at -4.
|
||||
int i = -4;
|
||||
|
||||
for (auto it = tracePlotLines.rbegin(); it != tracePlotLines.rend(); it++)
|
||||
{
|
||||
// Don't add collapsed ranks, but always add the first rank line.
|
||||
auto bankLine = std::dynamic_pointer_cast<TracePlotBankLine>(*it);
|
||||
auto firstRankLine = std::dynamic_pointer_cast<TracePlotFirstRankLine>(*it);
|
||||
if (!firstRankLine && bankLine && (*collapsedRanks)[bankLine->rank])
|
||||
continue;
|
||||
|
||||
(*labels)[i] = (*it)->getLabel();
|
||||
|
||||
(*it)->setYVal(i);
|
||||
|
||||
if (std::dynamic_pointer_cast<TracePlotRequestLine>(*it))
|
||||
yValRequest = i;
|
||||
|
||||
if (std::dynamic_pointer_cast<TracePlotResponseLine>(*it))
|
||||
yValResponse = i;
|
||||
|
||||
if (std::dynamic_pointer_cast<TracePlotDataBusLine>(*it))
|
||||
yValDataBus = i;
|
||||
|
||||
if (std::dynamic_pointer_cast<TracePlotCommandBusLine>(*it)) {
|
||||
yValCommandBus = i;
|
||||
|
||||
// Add two spaces.
|
||||
i += 2;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
const std::shared_ptr<QHash<int, QString>> TraceDrawingProperties::getLabels() const
|
||||
{
|
||||
return labels;
|
||||
}
|
||||
|
||||
const std::vector<std::shared_ptr<TracePlotLine>> & TraceDrawingProperties::getTracePlotLines() const
|
||||
{
|
||||
return tracePlotLines;
|
||||
}
|
||||
|
||||
const std::shared_ptr<TracePlotFirstRankLine> TraceDrawingProperties::getFirstRankLine(unsigned int rank) const
|
||||
{
|
||||
// TODO: Maybe cache results?
|
||||
Q_ASSERT(rank <= numberOfRanks - 1);
|
||||
|
||||
std::shared_ptr<TracePlotFirstRankLine> firstRankLine;
|
||||
|
||||
for (auto &line : tracePlotLines)
|
||||
{
|
||||
firstRankLine = std::dynamic_pointer_cast<TracePlotFirstRankLine>(line);
|
||||
if (firstRankLine && firstRankLine->rank == rank)
|
||||
break;
|
||||
}
|
||||
|
||||
return firstRankLine;
|
||||
}
|
||||
|
||||
void TraceDrawingProperties::setRankCollapsedState(unsigned int rank, bool collapse)
|
||||
{
|
||||
Q_ASSERT(rank <= numberOfRanks - 1);
|
||||
|
||||
(*collapsedRanks)[rank] = collapse;
|
||||
|
||||
updateLabels();
|
||||
}
|
||||
|
||||
bool TraceDrawingProperties::getRankCollapsedState(unsigned int rank) const
|
||||
{
|
||||
return (*collapsedRanks)[rank];
|
||||
}
|
||||
|
||||
unsigned int TraceDrawingProperties::getNumberOfDisplayedLines() const
|
||||
{
|
||||
return yValRequest + 6;
|
||||
}
|
||||
|
||||
unsigned int TraceDrawingProperties::getYValOfBank(unsigned int bank) const
|
||||
{
|
||||
unsigned int rank = bank / banksPerRank;
|
||||
|
||||
return getYValOfRank(rank) + bank % banksPerRank;
|
||||
}
|
||||
|
||||
unsigned int TraceDrawingProperties::getYValOfBankGroup(unsigned int rank, unsigned int bank) const
|
||||
{
|
||||
return getYValOfRank(rank) + bank % banksPerGroup;
|
||||
}
|
||||
|
||||
unsigned int TraceDrawingProperties::getYValOfRank(unsigned int rank) const
|
||||
{
|
||||
unsigned int i = 0;
|
||||
|
||||
for (unsigned int j = 0; j < rank; j++)
|
||||
if ((*collapsedRanks)[j])
|
||||
i += 1;
|
||||
else
|
||||
i += banksPerRank;
|
||||
|
||||
return i;
|
||||
}
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <map>
|
||||
#include <QHash>
|
||||
#include "tracedrawing.h"
|
||||
#include "traceplotline.h"
|
||||
|
||||
enum class ColorGrouping {PhaseType, Transaction, Thread};
|
||||
|
||||
@@ -61,36 +62,30 @@ struct TraceDrawingProperties {
|
||||
unsigned int groupsPerRank;
|
||||
unsigned int banksPerGroup;
|
||||
|
||||
TraceDrawingProperties() : drawText(true), drawBorder(true),
|
||||
colorGrouping(ColorGrouping::PhaseType) {}
|
||||
TraceDrawingProperties(bool drawText, bool drawBorder,
|
||||
ColorGrouping colorGrouping) : drawText(drawText), drawBorder(drawBorder),
|
||||
colorGrouping(colorGrouping) {}
|
||||
TraceDrawingProperties();
|
||||
TraceDrawingProperties(bool drawText, bool drawBorder, ColorGrouping colorGrouping);
|
||||
void setUpTracePlotLines();
|
||||
|
||||
QHash<int, QString> getLabels() const
|
||||
{
|
||||
QHash<int, QString> result;
|
||||
void setRankCollapsedState(unsigned int rank, bool collapse);
|
||||
bool getRankCollapsedState(unsigned int rank) const;
|
||||
|
||||
unsigned i = 0;
|
||||
for (unsigned rank = 0; rank < numberOfRanks; rank++)
|
||||
{
|
||||
for (unsigned group = 0; group < groupsPerRank; group++)
|
||||
{
|
||||
for (unsigned bank = 0; bank < banksPerGroup; bank++)
|
||||
{
|
||||
result[i++] = QString("RA") + QString::number(rank)
|
||||
+ QString(" BG") + QString::number(group)
|
||||
+ QString(" BA") + QString::number(bank);
|
||||
}
|
||||
}
|
||||
}
|
||||
unsigned int getNumberOfDisplayedLines() const;
|
||||
|
||||
result[yValCommandBus] = "Command Bus";
|
||||
result[yValResponse] = "RESP";
|
||||
result[yValRequest] = "REQ";
|
||||
result[yValDataBus] = "Data Bus";
|
||||
return result;
|
||||
}
|
||||
unsigned int getYValOfBank(unsigned int bank) const;
|
||||
unsigned int getYValOfBankGroup(unsigned int rank, unsigned int bank) const;
|
||||
unsigned int getYValOfRank(unsigned int rank) const;
|
||||
|
||||
|
||||
const std::vector<std::shared_ptr<TracePlotLine>> & getTracePlotLines() const;
|
||||
const std::shared_ptr<TracePlotFirstRankLine> getFirstRankLine(unsigned int rank) const;
|
||||
|
||||
void updateLabels();
|
||||
const std::shared_ptr<QHash<int, QString>> getLabels() const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<QHash<int, QString>> labels = std::make_shared<QHash<int, QString>>();
|
||||
std::shared_ptr<QHash<int, bool>> collapsedRanks = std::make_shared<QHash<int, bool>>();
|
||||
std::vector<std::shared_ptr<TracePlotLine>> tracePlotLines;
|
||||
};
|
||||
|
||||
#endif // TRACECOLLECTIONDRAWINGPROPERTIES_H
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <QInputDialog>
|
||||
#include <QKeySequence>
|
||||
#include <QFileInfo>
|
||||
#include <QPushButton>
|
||||
#include <qfiledialog.h>
|
||||
#include <iostream>
|
||||
#include <qwt_plot_renderer.h>
|
||||
@@ -213,12 +214,9 @@ void TracePlot::setUpDrawingProperties()
|
||||
drawingProperties.banksPerRank = drawingProperties.numberOfBanks / drawingProperties.numberOfRanks;
|
||||
drawingProperties.groupsPerRank = drawingProperties.numberOfBankgroups / drawingProperties.numberOfRanks;
|
||||
drawingProperties.banksPerGroup = drawingProperties.numberOfBanks / drawingProperties.numberOfBankgroups;
|
||||
drawingProperties.yValResponse = drawingProperties.numberOfBanks;
|
||||
drawingProperties.yValRequest = drawingProperties.numberOfBanks + 1;
|
||||
drawingProperties.yValCommandBus = -3;
|
||||
drawingProperties.yValDataBus = -4;
|
||||
}
|
||||
|
||||
drawingProperties.setUpTracePlotLines();
|
||||
}
|
||||
|
||||
void TracePlot::setUpQueryEditor()
|
||||
{
|
||||
@@ -256,20 +254,35 @@ void TracePlot::setUpZoom()
|
||||
zoomZone->setVisible(false);
|
||||
}
|
||||
|
||||
void TracePlot::updateScrollbar()
|
||||
{
|
||||
const unsigned int pageStep = scrollBar->pageStep();
|
||||
|
||||
const int maximum = drawingProperties.getNumberOfDisplayedLines() - pageStep;
|
||||
|
||||
if (maximum >= 0)
|
||||
{
|
||||
scrollBar->setMaximum(drawingProperties.getNumberOfDisplayedLines() - pageStep);
|
||||
scrollBar->show();
|
||||
}
|
||||
else
|
||||
scrollBar->hide();
|
||||
}
|
||||
|
||||
void TracePlot::verticalScrollbarChanged(int value)
|
||||
{
|
||||
int numberOfBanks = drawingProperties.numberOfBanks;
|
||||
const int yValRequest = drawingProperties.yValRequest;
|
||||
|
||||
// The maximum number of displayed rows determined by the pageStep of the scroll bar.
|
||||
const int maxDisplayedRows = scrollBar->pageStep();
|
||||
// The maximum number of displayed lines determined by the pageStep of the scroll bar.
|
||||
const int maxDisplayedLines = scrollBar->pageStep();
|
||||
|
||||
if (numberOfBanks + 5 + 2 <= maxDisplayedRows)
|
||||
if (drawingProperties.getNumberOfDisplayedLines() <= maxDisplayedLines)
|
||||
{
|
||||
setAxisScale(yLeft, -5, numberOfBanks + 2, 1.0);
|
||||
setAxisScale(yLeft, -5, yValRequest + 1, 1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
setAxisScale(yLeft, numberOfBanks - maxDisplayedRows + 2 - value, numberOfBanks + 2 - value, 1.0);
|
||||
setAxisScale(yLeft, yValRequest - maxDisplayedLines + 1 - value, yValRequest + 1 - value, 1.0);
|
||||
}
|
||||
|
||||
replot();
|
||||
@@ -277,14 +290,61 @@ void TracePlot::verticalScrollbarChanged(int value)
|
||||
|
||||
void TracePlot::setUpAxis()
|
||||
{
|
||||
// Set up y axis.
|
||||
verticalScrollbarChanged(scrollBar->value());
|
||||
|
||||
CustomLabelScaleDraw *customLabelScaleDraw = new CustomLabelScaleDraw(drawingProperties.getLabels());
|
||||
customLabelScaleDraw->setMinimumExtent(135.0);
|
||||
|
||||
auto positionButton = [&](const TracePlotFirstRankLine &firstRankLine, RankButton &rankButton) {
|
||||
QPointF point = this->axisScaleDraw(yLeft)->labelPosition(firstRankLine.getYVal());
|
||||
rankButton.setGeometry(point.x(), point.y() - 4, 25, 25);
|
||||
};
|
||||
|
||||
QObject::connect(customLabelScaleDraw, &CustomLabelScaleDraw::scaleRedraw, this, [=]() {
|
||||
for (auto rankButton : rankCollapseButtons)
|
||||
{
|
||||
auto firstRankLine = drawingProperties.getFirstRankLine(rankButton->rank);
|
||||
positionButton(*firstRankLine, *rankButton);
|
||||
}
|
||||
});
|
||||
|
||||
updateScrollbar();
|
||||
|
||||
// Set up y axis.
|
||||
verticalScrollbarChanged(scrollBar->value());
|
||||
setAxisScaleDraw(yLeft, customLabelScaleDraw);
|
||||
|
||||
// Add push buttons
|
||||
for (auto line : drawingProperties.getTracePlotLines())
|
||||
{
|
||||
auto firstRankLine = std::dynamic_pointer_cast<TracePlotFirstRankLine>(line);
|
||||
if (firstRankLine)
|
||||
{
|
||||
auto button = new RankButton(firstRankLine->rank, this);
|
||||
if (drawingProperties.getRankCollapsedState(firstRankLine->rank))
|
||||
button->setText("+");
|
||||
else
|
||||
button->setText("-");
|
||||
|
||||
positionButton(*firstRankLine, *button);
|
||||
|
||||
QObject::connect(button, &QPushButton::pressed, this, [=]() {
|
||||
bool wasCollapsed = drawingProperties.getRankCollapsedState(button->rank);
|
||||
drawingProperties.setRankCollapsedState(button->rank, !wasCollapsed);
|
||||
|
||||
if (wasCollapsed)
|
||||
button->setText("-");
|
||||
else
|
||||
button->setText("+");
|
||||
|
||||
updateScrollbar();
|
||||
|
||||
emit scrollBar->valueChanged(scrollBar->value());
|
||||
});
|
||||
|
||||
rankCollapseButtons.push_back(button);
|
||||
}
|
||||
}
|
||||
|
||||
// Set up x axis.
|
||||
setAxisTitle(xBottom, "Time in ns");
|
||||
setAxisScaleDraw(xBottom, new EngineeringScaleDraw);
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <qwt_plot_marker.h>
|
||||
#include <QAction>
|
||||
#include <QScrollBar>
|
||||
#include <QPushButton>
|
||||
#include <qwt_plot_zoneitem.h>
|
||||
#include "traceplotitem.h"
|
||||
#include "tracenavigator.h"
|
||||
@@ -60,6 +61,14 @@
|
||||
|
||||
class TracePlotMouseLabel;
|
||||
|
||||
class RankButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RankButton(unsigned int rank, QWidget *parent = nullptr) : QPushButton(parent), rank(rank) {}
|
||||
const unsigned int rank;
|
||||
};
|
||||
|
||||
class TracePlot : public QwtPlot
|
||||
{
|
||||
|
||||
@@ -127,6 +136,8 @@ private:
|
||||
|
||||
void getAndDrawComments();
|
||||
|
||||
void updateScrollbar();
|
||||
|
||||
|
||||
/* zooming
|
||||
*
|
||||
@@ -193,6 +204,8 @@ private:
|
||||
|
||||
MouseDownData mouseDownData;
|
||||
KeyPressData keyPressData;
|
||||
|
||||
std::vector<RankButton *> rankCollapseButtons;
|
||||
};
|
||||
|
||||
|
||||
|
||||
95
DRAMSys/traceAnalyzer/presentation/traceplotline.cpp
Normal file
95
DRAMSys/traceAnalyzer/presentation/traceplotline.cpp
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Author:
|
||||
* Derek Christ
|
||||
*/
|
||||
|
||||
#include "traceplotline.h"
|
||||
|
||||
|
||||
TracePlotLine::TracePlotLine(const QString &label, const std::shared_ptr<QHash<int, bool>> collapsedRanks) :
|
||||
label(label),
|
||||
collapsedRanks(collapsedRanks)
|
||||
{
|
||||
}
|
||||
|
||||
TracePlotLine::~TracePlotLine() {}
|
||||
|
||||
const QString & TracePlotLine::getLabel() const
|
||||
{
|
||||
return label;
|
||||
}
|
||||
|
||||
bool TracePlotLine::isCollapsed() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void TracePlotLine::setYVal (int yVal)
|
||||
{
|
||||
this->yVal = yVal;
|
||||
}
|
||||
|
||||
|
||||
int TracePlotLine::getYVal() const
|
||||
{
|
||||
return yVal;
|
||||
}
|
||||
|
||||
|
||||
TracePlotBankLine::TracePlotBankLine(const QString &label, unsigned int rank,
|
||||
const std::shared_ptr<QHash<int, bool>> collapsedRanks) :
|
||||
TracePlotLine(label, collapsedRanks),
|
||||
rank(rank)
|
||||
{
|
||||
}
|
||||
|
||||
bool TracePlotBankLine::isCollapsed() const
|
||||
{
|
||||
return (*collapsedRanks)[rank];
|
||||
}
|
||||
|
||||
|
||||
TracePlotFirstRankLine::TracePlotFirstRankLine(const QString &label, const QString &collapsedLabel,
|
||||
unsigned int rank, const std::shared_ptr<QHash<int, bool>> collapsedRanks) :
|
||||
TracePlotBankLine(label, rank, collapsedRanks),
|
||||
collapsedLabel(collapsedLabel)
|
||||
{
|
||||
}
|
||||
|
||||
const QString & TracePlotFirstRankLine::getLabel() const
|
||||
{
|
||||
if (isCollapsed())
|
||||
return collapsedLabel;
|
||||
else
|
||||
return TracePlotLine::getLabel();
|
||||
}
|
||||
117
DRAMSys/traceAnalyzer/presentation/traceplotline.h
Normal file
117
DRAMSys/traceAnalyzer/presentation/traceplotline.h
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Author:
|
||||
* Derek Christ
|
||||
*/
|
||||
|
||||
#ifndef TRACELOTLINE_H
|
||||
#define TRACELOTLINE_H
|
||||
|
||||
#include <QString>
|
||||
#include <QHash>
|
||||
#include <memory>
|
||||
|
||||
class TracePlotLine
|
||||
{
|
||||
public:
|
||||
TracePlotLine(const QString &label, const std::shared_ptr<QHash<int, bool>> collapsedRanks);
|
||||
virtual ~TracePlotLine() = 0;
|
||||
|
||||
virtual const QString & getLabel() const;
|
||||
virtual bool isCollapsed() const;
|
||||
|
||||
void setYVal(int yVal);
|
||||
int getYVal() const;
|
||||
|
||||
protected:
|
||||
QString label;
|
||||
int yVal;
|
||||
const std::shared_ptr<QHash<int, bool>> collapsedRanks;
|
||||
};
|
||||
|
||||
|
||||
class TracePlotBankLine : public TracePlotLine
|
||||
{
|
||||
public:
|
||||
TracePlotBankLine(const QString &label, unsigned int rank, const std::shared_ptr<QHash<int, bool>> collapsedRanks);
|
||||
~TracePlotBankLine() = default;
|
||||
void setCollapsed(bool value);
|
||||
bool isCollapsed() const override;
|
||||
|
||||
const unsigned int rank;
|
||||
};
|
||||
|
||||
|
||||
class TracePlotFirstRankLine final : public TracePlotBankLine
|
||||
{
|
||||
public:
|
||||
TracePlotFirstRankLine(const QString &label, const QString &collapsedLabel,
|
||||
unsigned int rank, const std::shared_ptr<QHash<int, bool>> collapsedRanks);
|
||||
|
||||
~TracePlotFirstRankLine() = default;
|
||||
|
||||
const QString & getLabel() const override;
|
||||
|
||||
private:
|
||||
QString collapsedLabel;
|
||||
};
|
||||
|
||||
|
||||
class TracePlotRequestLine final : public TracePlotLine
|
||||
{
|
||||
public:
|
||||
using TracePlotLine::TracePlotLine;
|
||||
~TracePlotRequestLine() = default;
|
||||
};
|
||||
|
||||
class TracePlotResponseLine final : public TracePlotLine
|
||||
{
|
||||
public:
|
||||
using TracePlotLine::TracePlotLine;
|
||||
~TracePlotResponseLine() = default;
|
||||
};
|
||||
|
||||
class TracePlotDataBusLine final : public TracePlotLine
|
||||
{
|
||||
public:
|
||||
using TracePlotLine::TracePlotLine;
|
||||
~TracePlotDataBusLine() = default;
|
||||
};
|
||||
|
||||
class TracePlotCommandBusLine final : public TracePlotLine
|
||||
{
|
||||
public:
|
||||
using TracePlotLine::TracePlotLine;
|
||||
~TracePlotCommandBusLine() = default;
|
||||
};
|
||||
|
||||
#endif // TRACELOTLINE_H
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Author:
|
||||
* Derek Christ
|
||||
*/
|
||||
|
||||
#include "customlabelscaledraw.h"
|
||||
|
||||
CustomLabelScaleDraw::CustomLabelScaleDraw(std::shared_ptr<QHash<int, QString>> labels) : labels(labels), QObject(nullptr) {}
|
||||
|
||||
QwtText CustomLabelScaleDraw::label(double v) const
|
||||
{
|
||||
return QwtText((*labels)[static_cast<int>(v)]);
|
||||
}
|
||||
|
||||
void CustomLabelScaleDraw::drawLabel(QPainter *painter, double value) const
|
||||
{
|
||||
emit scaleRedraw();
|
||||
QwtScaleDraw::drawLabel(painter, value);
|
||||
}
|
||||
@@ -40,18 +40,25 @@
|
||||
#include <qwt_text.h>
|
||||
#include <qwt_scale_draw.h>
|
||||
#include <QHash>
|
||||
#include <memory>
|
||||
|
||||
class CustomLabelScaleDraw : public QwtScaleDraw
|
||||
class CustomLabelScaleDraw : public QObject, public QwtScaleDraw
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
QHash<int, QString> labels;
|
||||
const std::shared_ptr<QHash<int, QString>> labels;
|
||||
|
||||
public:
|
||||
CustomLabelScaleDraw(QHash<int, QString> labels): labels(labels) {}
|
||||
virtual QwtText label(double v) const
|
||||
{
|
||||
return QwtText(labels[static_cast<int>(v)]);
|
||||
}
|
||||
CustomLabelScaleDraw(std::shared_ptr<QHash<int, QString>> labels);
|
||||
~CustomLabelScaleDraw() = default;
|
||||
|
||||
virtual QwtText label(double v) const override;
|
||||
|
||||
void drawLabel(QPainter *painter, double value) const override;
|
||||
|
||||
Q_SIGNALS:
|
||||
void scaleRedraw() const;
|
||||
};
|
||||
|
||||
#endif // CUSTOMLABELSCALEDRAW_H
|
||||
|
||||
@@ -87,13 +87,6 @@ void TraceFileTab::commitChangesToDB()
|
||||
|
||||
void TraceFileTab::setUpTraceplotScrollbar()
|
||||
{
|
||||
unsigned int numberOfBanks = navigator->GeneralTraceInfo().numberOfBanks;
|
||||
unsigned int pageStep = ui->traceplotScrollbar->pageStep();
|
||||
ui->traceplotScrollbar->setMaximum(numberOfBanks + 7 - pageStep);
|
||||
|
||||
if (ui->traceplotScrollbar->maximum() <= 0)
|
||||
ui->traceplotScrollbar->hide();
|
||||
|
||||
QObject::connect(ui->traceplotScrollbar, SIGNAL(valueChanged(int)),
|
||||
ui->traceplot, SLOT(verticalScrollbarChanged(int)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user