Code formatting.
This commit is contained in:
@@ -283,8 +283,7 @@ QModelIndex MemSpecModel::parent(const QModelIndex &index) const
|
||||
return createIndex(parentNode->getRow(), 0, const_cast<Node *>(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> &node){
|
||||
return node.get() == this;
|
||||
});
|
||||
const auto siblingsIt = std::find_if(siblings.begin(), siblings.end(),
|
||||
[this](const std::unique_ptr<Node> &node) { return node.get() == this; });
|
||||
|
||||
Q_ASSERT(siblingsIt != siblings.end());
|
||||
|
||||
@@ -311,25 +309,22 @@ int DependencyInfosModel::Node::getRow() const
|
||||
|
||||
void DependencyInfosModel::parseInfos()
|
||||
{
|
||||
std::vector<std::pair<QString, DependencyInfos&>> infos = {
|
||||
{"Dependency Granularity", mDepInfosDepType},
|
||||
{"Time Dependencies", mDepInfosTimeDep},
|
||||
{"Delayed Phases", mDepInfosDelPhase},
|
||||
{"Dependency Phases", mDepInfosDepPhase}
|
||||
};
|
||||
std::vector<std::pair<QString, DependencyInfos &>> infos = {{"Dependency Granularity", mDepInfosDepType},
|
||||
{"Time Dependencies", mDepInfosTimeDep},
|
||||
{"Delayed Phases", mDepInfosDelPhase},
|
||||
{"Dependency Phases", mDepInfosDepPhase}};
|
||||
|
||||
for (auto pair : infos)
|
||||
{
|
||||
std::unique_ptr<Node> node = std::unique_ptr<Node>(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<Node>(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:
|
||||
|
||||
@@ -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<QString, QString>;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -4,34 +4,44 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
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<DependencyInfo>& getInfos() const { return mInfos; }
|
||||
size_t size() const { return mInfos.size(); }
|
||||
const std::vector<DependencyInfo> &getInfos() const
|
||||
{
|
||||
return mInfos;
|
||||
}
|
||||
size_t size() const
|
||||
{
|
||||
return mInfos.size();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
Type mType;
|
||||
std::vector<DependencyInfo> mInfos;
|
||||
|
||||
};
|
||||
|
||||
@@ -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<int>(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<traceTime>(0.05 * clk) : 0;
|
||||
|
||||
size_t invisibleDeps = 0;
|
||||
|
||||
QPoint depLineTo(static_cast<int>(xMap.transform(begin/* + (end + offset - begin)/4*/)), static_cast<int>(yVal));
|
||||
|
||||
for (auto dep : mDependencies) {
|
||||
QPoint depLineTo(static_cast<int>(xMap.transform(begin /* + (end + offset - begin)/4*/)), static_cast<int>(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<int>(xMap.transform(begin + (end + offset - begin)/2)), static_cast<int>(yVal + 0.1*symbolHeight));
|
||||
if (invisibleDeps > 0)
|
||||
{
|
||||
QPoint invisibleDepsPoint(static_cast<int>(xMap.transform(begin + (end + offset - begin) / 2)),
|
||||
static_cast<int>(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<unsigned int>
|
||||
(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<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);
|
||||
break;
|
||||
case ColorGrouping::Transaction:
|
||||
default:
|
||||
return ColorGenerator::getColor(transaction.lock()->id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Qt::BrushStyle Phase::getBrushStyle() const
|
||||
@@ -255,6 +261,7 @@ std::vector<std::shared_ptr<TracePlotLine>> Phase::getTracePlotLines(const Trace
|
||||
}
|
||||
}
|
||||
|
||||
void Phase::addDependency(std::shared_ptr<PhaseDependency> dependency) {
|
||||
void Phase::addDependency(std::shared_ptr<PhaseDependency> dependency)
|
||||
{
|
||||
mDependencies.push_back(dependency);
|
||||
}
|
||||
|
||||
@@ -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 <QString>
|
||||
#include "businessObjects/timespan.h"
|
||||
#include "presentation/tracedrawingproperties.h"
|
||||
#include "presentation/util/colorgenerator.h"
|
||||
#include <QPainter>
|
||||
#include <QString>
|
||||
#include <memory>
|
||||
#include <qwt_scale_map.h>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
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<std::shared_ptr<TracePlotLine>> getTracePlotLines(const TraceDrawingProperties &drawingProperties) const;
|
||||
|
||||
|
||||
@@ -5,48 +5,49 @@
|
||||
PhaseDependency::PhaseDependency(DependencyType type, QString timeDependency, std::shared_ptr<Phase> 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<int>(xMap.transform(depBegin/* + (depEnd + depOffset - depBegin)/4*/)), static_cast<int>(depYVal));
|
||||
QPoint depLineFrom(static_cast<int>(xMap.transform(depBegin /* + (depEnd + depOffset - depBegin)/4*/)),
|
||||
static_cast<int>(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);
|
||||
}
|
||||
}
|
||||
@@ -1,41 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#include "presentation/tracedrawingproperties.h"
|
||||
#include "businessObjects/timespan.h"
|
||||
#include "presentation/tracedrawingproperties.h"
|
||||
|
||||
#include <memory>
|
||||
#include <QStringList>
|
||||
#include <QString>
|
||||
#include <QPainter>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <memory>
|
||||
#include <qwt_scale_map.h>
|
||||
|
||||
class Phase;
|
||||
|
||||
enum DependencyType {
|
||||
Bank, Rank, InterRank
|
||||
enum DependencyType
|
||||
{
|
||||
Bank,
|
||||
Rank,
|
||||
InterRank
|
||||
};
|
||||
|
||||
class PhaseDependency
|
||||
{
|
||||
public:
|
||||
public:
|
||||
PhaseDependency(DependencyType type, QString timeDependency, std::shared_ptr<Phase> 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<Phase> 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);
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 ";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -140,8 +140,7 @@ vector<shared_ptr<Transaction>> TraceDB::getTransactionsWithCustomQuery(
|
||||
return parseTransactionsFromQuery(query);
|
||||
}
|
||||
|
||||
vector<shared_ptr<Transaction>> TraceDB::getTransactionsInTimespan(
|
||||
const Timespan &span, bool updateVisiblePhases)
|
||||
vector<shared_ptr<Transaction>> TraceDB::getTransactionsInTimespan(const Timespan &span, bool updateVisiblePhases)
|
||||
{
|
||||
selectTransactionsByTimespan.bindValue(":begin", span.Begin());
|
||||
selectTransactionsByTimespan.bindValue(":end", span.End());
|
||||
@@ -152,18 +151,17 @@ vector<shared_ptr<Transaction>> 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<CommentModel::Comment> 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<Transaction> TraceDB::parseTransactionFromQuery(QSqlQuery &query)
|
||||
return shared_ptr<Transaction>();
|
||||
}
|
||||
|
||||
vector<shared_ptr<Transaction>> TraceDB::parseTransactionsFromQuery(
|
||||
QSqlQuery &query,
|
||||
bool updateVisiblePhases)
|
||||
vector<shared_ptr<Transaction>> TraceDB::parseTransactionsFromQuery(QSqlQuery &query, bool updateVisiblePhases)
|
||||
{
|
||||
if (updateVisiblePhases) {
|
||||
if (updateVisiblePhases)
|
||||
{
|
||||
_visiblePhases.clear();
|
||||
}
|
||||
|
||||
@@ -483,62 +481,58 @@ vector<shared_ptr<Transaction>> 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<PhaseDependency>(
|
||||
new PhaseDependency(
|
||||
type,
|
||||
timeDependencyStr,
|
||||
_visiblePhases[dependencyID]
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
} else {
|
||||
|
||||
_visiblePhases[delayedID]->addDependency(
|
||||
std::shared_ptr<PhaseDependency>(
|
||||
new PhaseDependency(
|
||||
type,
|
||||
timeDependencyStr
|
||||
)
|
||||
)
|
||||
);
|
||||
if (_visiblePhases.count(dependencyID) > 0)
|
||||
{
|
||||
|
||||
_visiblePhases[delayedID]->addDependency(std::shared_ptr<PhaseDependency>(
|
||||
new PhaseDependency(type, timeDependencyStr, _visiblePhases[dependencyID])));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
} else {
|
||||
_visiblePhases[delayedID]->addDependency(
|
||||
std::shared_ptr<PhaseDependency>(new PhaseDependency(type, timeDependencyStr)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO delayed phase not visible?
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,11 +546,12 @@ vector<CommentModel::Comment> 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()});
|
||||
}
|
||||
|
||||
|
||||
@@ -39,21 +39,20 @@
|
||||
#ifndef TRACEDB_H
|
||||
#define TRACEDB_H
|
||||
|
||||
#include <string>
|
||||
#include <exception>
|
||||
#include <QString>
|
||||
#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 <QSqlDatabase>
|
||||
#include <QSqlQuery>
|
||||
#include <QSqlTableModel>
|
||||
#include <vector>
|
||||
#include <QString>
|
||||
#include <exception>
|
||||
#include <string>
|
||||
#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 <vector>
|
||||
|
||||
/* 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<std::shared_ptr<Transaction>> getTransactionsWithCustomQuery(
|
||||
QString queryText);
|
||||
std::vector<std::shared_ptr<Transaction>> getTransactionsInTimespan(
|
||||
const Timespan &span, bool updateVisiblePhases = false);
|
||||
std::vector<std::shared_ptr<Transaction>> getTransactionsInTimespan(const Timespan &span,
|
||||
bool updateVisiblePhases = false);
|
||||
std::shared_ptr<Transaction> getNextPrecharge(traceTime time);
|
||||
std::shared_ptr<Transaction> getNextActivate(traceTime time);
|
||||
std::shared_ptr<Transaction> getNextRefresh(traceTime time);
|
||||
@@ -134,13 +133,12 @@ private:
|
||||
void executeQuery(QSqlQuery query);
|
||||
QString queryToString(QSqlQuery query);
|
||||
std::shared_ptr<Transaction> parseTransactionFromQuery(QSqlQuery &query);
|
||||
std::vector<std::shared_ptr<Transaction>> parseTransactionsFromQuery(
|
||||
QSqlQuery &query,
|
||||
bool updateVisiblePhases = false);
|
||||
std::vector<std::shared_ptr<Transaction>> parseTransactionsFromQuery(QSqlQuery &query,
|
||||
bool updateVisiblePhases = false);
|
||||
std::vector<CommentModel::Comment> 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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -91,7 +91,7 @@ TraceFileTab::TraceFileTab(QWidget *parent, const QString &path)
|
||||
|
||||
ui->depInfosView->setModel(depInfosView);
|
||||
ui->depInfosView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
|
||||
|
||||
tracefileChanged();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user