Added alpha colored transaction sequences. Removed dependency texts submenu.
This commit is contained in:
@@ -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<unsigned int>
|
||||
(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<unsigned int>
|
||||
(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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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<TracePlotLineCache>(getTracePlotLines(), GeneralTraceInfo().numberOfRanks,
|
||||
GeneralTraceInfo().groupsPerRank, GeneralTraceInfo().banksPerGroup);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -101,4 +101,14 @@ QColor ColorGenerator::getColor(unsigned int i)
|
||||
result.setAlpha(130);
|
||||
return result;
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ private:
|
||||
|
||||
public:
|
||||
static QColor getColor(unsigned int i);
|
||||
static QColor getAlphaColored(unsigned int i);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user