Format all files
This commit is contained in:
@@ -70,21 +70,26 @@
|
||||
#include <fstream>
|
||||
#include <pybind11/pybind11.h>
|
||||
|
||||
TraceFileTab::TraceFileTab(std::string_view traceFilePath, PythonCaller &pythonCaller, QWidget *parent)
|
||||
: QWidget(parent), ui(new Ui::TraceFileTab), commentModel(new CommentModel(this)),
|
||||
navigator(new TraceNavigator(traceFilePath.data(), commentModel, this)),
|
||||
mcConfigModel(new McConfigModel(navigator->TraceFile(), this)),
|
||||
memSpecModel(new MemSpecModel(navigator->TraceFile(), this)),
|
||||
availableRowsModel(new AvailableTracePlotLineModel(navigator->GeneralTraceInfo(), this)),
|
||||
selectedRowsModel(new SelectedTracePlotLineModel(navigator->GeneralTraceInfo(), this)),
|
||||
tracePlotLineDataSource(new TracePlotLineDataSource(selectedRowsModel, this)),
|
||||
depInfosView(new DependencyInfosModel(navigator->TraceFile(), this)), savingChangesToDB(false),
|
||||
pythonCaller(pythonCaller), traceFilePath(traceFilePath)
|
||||
TraceFileTab::TraceFileTab(std::string_view traceFilePath,
|
||||
PythonCaller& pythonCaller,
|
||||
QWidget* parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::TraceFileTab),
|
||||
commentModel(new CommentModel(this)),
|
||||
navigator(new TraceNavigator(traceFilePath.data(), commentModel, this)),
|
||||
mcConfigModel(new McConfigModel(navigator->TraceFile(), this)),
|
||||
memSpecModel(new MemSpecModel(navigator->TraceFile(), this)),
|
||||
availableRowsModel(new AvailableTracePlotLineModel(navigator->GeneralTraceInfo(), this)),
|
||||
selectedRowsModel(new SelectedTracePlotLineModel(navigator->GeneralTraceInfo(), this)),
|
||||
tracePlotLineDataSource(new TracePlotLineDataSource(selectedRowsModel, this)),
|
||||
depInfosView(new DependencyInfosModel(navigator->TraceFile(), this)),
|
||||
savingChangesToDB(false),
|
||||
pythonCaller(pythonCaller),
|
||||
traceFilePath(traceFilePath)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
std::cout << "Opening new tab for \"" << traceFilePath << "\"" <<
|
||||
std::endl;
|
||||
std::cout << "Opening new tab for \"" << traceFilePath << "\"" << std::endl;
|
||||
|
||||
ui->mcConfigView->setModel(mcConfigModel);
|
||||
ui->mcConfigView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
@@ -119,10 +124,11 @@ void TraceFileTab::commitChangesToDB()
|
||||
|
||||
void TraceFileTab::exportAsVCD()
|
||||
{
|
||||
std::string filename = QFileDialog::getSaveFileName(this, "Export to VCD", "", "VCD files (*.vcd)").toStdString();
|
||||
std::string filename =
|
||||
QFileDialog::getSaveFileName(this, "Export to VCD", "", "VCD files (*.vcd)").toStdString();
|
||||
|
||||
auto dump = PythonCaller::dumpVcd(traceFilePath);
|
||||
|
||||
|
||||
std::ofstream file(filename);
|
||||
file << dump;
|
||||
|
||||
@@ -139,26 +145,40 @@ void TraceFileTab::setUpTraceSelector()
|
||||
ui->selectedTreeView->setSelectionModel(selectedRowsModel->selectionModel());
|
||||
ui->selectedTreeView->installEventFilter(selectedRowsModel);
|
||||
|
||||
connect(availableRowsModel, &AvailableTracePlotLineModel::returnPressed, selectedRowsModel,
|
||||
connect(availableRowsModel,
|
||||
&AvailableTracePlotLineModel::returnPressed,
|
||||
selectedRowsModel,
|
||||
&SelectedTracePlotLineModel::addIndexesFromAvailableModel);
|
||||
|
||||
connect(ui->availableTreeView, &QAbstractItemView::doubleClicked, availableRowsModel,
|
||||
connect(ui->availableTreeView,
|
||||
&QAbstractItemView::doubleClicked,
|
||||
availableRowsModel,
|
||||
&AvailableTracePlotLineModel::itemsDoubleClicked);
|
||||
connect(ui->selectedTreeView, &QAbstractItemView::doubleClicked, selectedRowsModel,
|
||||
connect(ui->selectedTreeView,
|
||||
&QAbstractItemView::doubleClicked,
|
||||
selectedRowsModel,
|
||||
&SelectedTracePlotLineModel::itemsDoubleClicked);
|
||||
|
||||
connect(selectedRowsModel, &QAbstractItemModel::dataChanged, tracePlotLineDataSource,
|
||||
connect(selectedRowsModel,
|
||||
&QAbstractItemModel::dataChanged,
|
||||
tracePlotLineDataSource,
|
||||
&TracePlotLineDataSource::updateModel);
|
||||
connect(selectedRowsModel, &QAbstractItemModel::rowsInserted, tracePlotLineDataSource,
|
||||
connect(selectedRowsModel,
|
||||
&QAbstractItemModel::rowsInserted,
|
||||
tracePlotLineDataSource,
|
||||
&TracePlotLineDataSource::updateModel);
|
||||
connect(selectedRowsModel, &QAbstractItemModel::rowsRemoved, tracePlotLineDataSource,
|
||||
connect(selectedRowsModel,
|
||||
&QAbstractItemModel::rowsRemoved,
|
||||
tracePlotLineDataSource,
|
||||
&TracePlotLineDataSource::updateModel);
|
||||
}
|
||||
|
||||
void TraceFileTab::setUpTraceplotScrollbar()
|
||||
{
|
||||
QObject::connect(ui->traceplotScrollbar, SIGNAL(valueChanged(int)),
|
||||
ui->traceplot, SLOT(verticalScrollbarChanged(int)));
|
||||
QObject::connect(ui->traceplotScrollbar,
|
||||
SIGNAL(valueChanged(int)),
|
||||
ui->traceplot,
|
||||
SLOT(verticalScrollbarChanged(int)));
|
||||
}
|
||||
|
||||
void TraceFileTab::initNavigatorAndItsDependentWidgets(QString path)
|
||||
@@ -166,11 +186,13 @@ void TraceFileTab::initNavigatorAndItsDependentWidgets(QString path)
|
||||
ui->traceplot->init(navigator, ui->traceplotScrollbar, tracePlotLineDataSource, commentModel);
|
||||
|
||||
ui->traceScroller->init(navigator, ui->traceplot, tracePlotLineDataSource);
|
||||
connect(this, SIGNAL(colorGroupingChanged(ColorGrouping)),
|
||||
ui->traceScroller, SLOT(colorGroupingChanged(ColorGrouping)));
|
||||
connect(this,
|
||||
SIGNAL(colorGroupingChanged(ColorGrouping)),
|
||||
ui->traceScroller,
|
||||
SLOT(colorGroupingChanged(ColorGrouping)));
|
||||
|
||||
ui->selectedTransactionTree->init(navigator);
|
||||
//ui->debugMessages->init(navigator,ui->traceplot);
|
||||
// ui->debugMessages->init(navigator,ui->traceplot);
|
||||
|
||||
ui->bandwidthPlot->canvas()->installEventFilter(this);
|
||||
ui->powerPlot->canvas()->installEventFilter(this);
|
||||
@@ -180,8 +202,7 @@ void TraceFileTab::initNavigatorAndItsDependentWidgets(QString path)
|
||||
void TraceFileTab::setUpFileWatcher(QString path)
|
||||
{
|
||||
fileWatcher = new QFileSystemWatcher(QStringList(path), this);
|
||||
QObject::connect(fileWatcher, SIGNAL(fileChanged(QString)), this,
|
||||
SLOT(tracefileChanged()));
|
||||
QObject::connect(fileWatcher, SIGNAL(fileChanged(QString)), this, SLOT(tracefileChanged()));
|
||||
}
|
||||
|
||||
void TraceFileTab::setUpCommentView()
|
||||
@@ -191,41 +212,50 @@ void TraceFileTab::setUpCommentView()
|
||||
ui->commentView->installEventFilter(commentModel);
|
||||
ui->commentView->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
QObject::connect(ui->commentView, &QTableView::customContextMenuRequested,
|
||||
commentModel, &CommentModel::openContextMenu);
|
||||
QObject::connect(ui->commentView,
|
||||
&QTableView::customContextMenuRequested,
|
||||
commentModel,
|
||||
&CommentModel::openContextMenu);
|
||||
|
||||
QObject::connect(commentModel, &CommentModel::editTriggered, ui->commentView,
|
||||
[=](const QModelIndex &index)
|
||||
QObject::connect(commentModel,
|
||||
&CommentModel::editTriggered,
|
||||
ui->commentView,
|
||||
[=](const QModelIndex& index)
|
||||
{
|
||||
ui->tabWidget->setCurrentWidget(ui->tabComments);
|
||||
ui->commentView->edit(index);
|
||||
ui->commentView->scrollTo(index);
|
||||
});
|
||||
|
||||
QObject::connect(ui->commentView, &QTableView::doubleClicked,
|
||||
commentModel, &CommentModel::rowDoubleClicked);
|
||||
QObject::connect(
|
||||
ui->commentView, &QTableView::doubleClicked, commentModel, &CommentModel::rowDoubleClicked);
|
||||
}
|
||||
|
||||
void TraceFileTab::setUpPossiblePhases() {
|
||||
void TraceFileTab::setUpPossiblePhases()
|
||||
{
|
||||
const auto possiblePhases = ConfigurationFactory::possiblePhases(navigator->TraceFile());
|
||||
for (auto p : possiblePhases) {
|
||||
for (auto p : possiblePhases)
|
||||
{
|
||||
auto item = new QListWidgetItem(p, ui->depTabPossiblePhases);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable); // set checkable flag
|
||||
item->setCheckState(Qt::Unchecked); // AND initialize check state
|
||||
|
||||
item->setCheckState(Qt::Unchecked); // AND initialize check state
|
||||
}
|
||||
|
||||
ui->calculateDependencies->setEnabled(ConfigurationFactory::deviceSupported(navigator->TraceFile()));
|
||||
ui->calculateDependencies->setEnabled(
|
||||
ConfigurationFactory::deviceSupported(navigator->TraceFile()));
|
||||
}
|
||||
|
||||
void TraceFileTab::tracefileChanged()
|
||||
{
|
||||
if (savingChangesToDB == true) {
|
||||
if (savingChangesToDB == true)
|
||||
{
|
||||
// Database has changed due to user action (e.g., saving comments).
|
||||
// No need to disable the "Save changes to DB" menu.
|
||||
savingChangesToDB = false;
|
||||
Q_EMIT statusChanged(QString("Changes saved "));
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// External event changed the database file (e.g., the database file
|
||||
// was overwritten when running a new test).
|
||||
// The "Save changes to DB" menu must be disabled to avoid saving
|
||||
@@ -235,15 +265,17 @@ void TraceFileTab::tracefileChanged()
|
||||
navigator->refreshData();
|
||||
}
|
||||
|
||||
void TraceFileTab::closeEvent(QCloseEvent *event)
|
||||
void TraceFileTab::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
if (navigator->existChangesToCommit())
|
||||
{
|
||||
QMessageBox saveDialog;
|
||||
saveDialog.setWindowTitle(QFileInfo(traceFilePath.data()).baseName());
|
||||
saveDialog.setText("The trace file has been modified.");
|
||||
saveDialog.setInformativeText("Do you want to save your changes?<br><b>Unsaved changes will be lost.</b>");
|
||||
saveDialog.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
||||
saveDialog.setInformativeText(
|
||||
"Do you want to save your changes?<br><b>Unsaved changes will be lost.</b>");
|
||||
saveDialog.setStandardButtons(QMessageBox::Save | QMessageBox::Discard |
|
||||
QMessageBox::Cancel);
|
||||
saveDialog.setDefaultButton(QMessageBox::Save);
|
||||
saveDialog.setIcon(QMessageBox::Warning);
|
||||
int returnCode = saveDialog.exec();
|
||||
@@ -278,14 +310,14 @@ void TraceFileTab::navigateToTime(traceTime time)
|
||||
|
||||
traceTime TraceFileTab::getZoomLevel() const
|
||||
{
|
||||
TracePlot *traceplot = static_cast<TracePlot *>(ui->traceplot);
|
||||
TracePlot* traceplot = static_cast<TracePlot*>(ui->traceplot);
|
||||
return traceplot->ZoomLevel();
|
||||
}
|
||||
|
||||
void TraceFileTab::setZoomLevel(traceTime zoomLevel)
|
||||
{
|
||||
TracePlot *traceplot = static_cast<TracePlot *>(ui->traceplot);
|
||||
TraceScroller *tracescroller = static_cast<TraceScroller *>(ui->traceScroller);
|
||||
TracePlot* traceplot = static_cast<TracePlot*>(ui->traceplot);
|
||||
TraceScroller* tracescroller = static_cast<TraceScroller*>(ui->traceScroller);
|
||||
traceplot->setZoomLevel(zoomLevel);
|
||||
tracescroller->tracePlotZoomChanged();
|
||||
}
|
||||
@@ -295,59 +327,64 @@ std::shared_ptr<AbstractTracePlotLineModel::Node> TraceFileTab::saveTraceSelecto
|
||||
return selectedRowsModel->getClonedRootNode();
|
||||
}
|
||||
|
||||
void TraceFileTab::restoreTraceSelectorState(std::shared_ptr<AbstractTracePlotLineModel::Node> rootNode)
|
||||
void TraceFileTab::restoreTraceSelectorState(
|
||||
std::shared_ptr<AbstractTracePlotLineModel::Node> rootNode)
|
||||
{
|
||||
selectedRowsModel->setRootNode(std::move(rootNode));
|
||||
}
|
||||
|
||||
class ItemDelegate: public QItemDelegate
|
||||
class ItemDelegate : public QItemDelegate
|
||||
{
|
||||
public:
|
||||
ItemDelegate(QObject* parent = nullptr): QItemDelegate(parent)
|
||||
{
|
||||
}
|
||||
ItemDelegate(QObject* parent = nullptr) : QItemDelegate(parent) {}
|
||||
|
||||
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
||||
void
|
||||
paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
||||
{
|
||||
if (index.column() == 1) {
|
||||
if (index.column() == 1)
|
||||
{
|
||||
double progress = index.data().toDouble();
|
||||
QStyleOptionProgressBar opt;
|
||||
opt.rect = option.rect;
|
||||
opt.minimum = 0;
|
||||
opt.maximum = 100;
|
||||
opt.progress = static_cast<int>(floor(progress));
|
||||
opt.text = QString::number(progress, 'f', 2)+" %";
|
||||
opt.text = QString::number(progress, 'f', 2) + " %";
|
||||
opt.textVisible = true;
|
||||
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &opt, painter, nullptr);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
QItemDelegate::paint(painter, option, index);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void TraceFileTab::on_latencyTreeView_doubleClicked(const QModelIndex &index)
|
||||
void TraceFileTab::on_latencyTreeView_doubleClicked(const QModelIndex& index)
|
||||
{
|
||||
// Get onlye the leaf:
|
||||
if(index.column() == 0 && index.model()->hasChildren(index) == false) {
|
||||
if (index.column() == 0 && index.model()->hasChildren(index) == false)
|
||||
{
|
||||
unsigned int id = index.data().toUInt();
|
||||
if(id!=0) {
|
||||
if (id != 0)
|
||||
{
|
||||
navigator->selectTransaction(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool TraceFileTab::eventFilter(QObject *object, QEvent *event)
|
||||
bool TraceFileTab::eventFilter(QObject* object, QEvent* event)
|
||||
{
|
||||
if (auto canvas = qobject_cast<QwtPlotCanvas *>(object))
|
||||
if (auto canvas = qobject_cast<QwtPlotCanvas*>(object))
|
||||
{
|
||||
if (event->type() == QEvent::MouseButtonDblClick)
|
||||
{
|
||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
|
||||
|
||||
if (mouseEvent->button() != Qt::LeftButton)
|
||||
return false;
|
||||
|
||||
QwtPlot *plot = canvas->plot();
|
||||
QwtPlot* plot = canvas->plot();
|
||||
|
||||
double realTime = plot->invTransform(QwtPlot::xBottom, mouseEvent->x());
|
||||
|
||||
@@ -362,20 +399,21 @@ bool TraceFileTab::eventFilter(QObject *object, QEvent *event)
|
||||
return QWidget::eventFilter(object, event);
|
||||
}
|
||||
|
||||
void TraceFileTab::on_calculateDependencies_clicked() {
|
||||
void TraceFileTab::on_calculateDependencies_clicked()
|
||||
{
|
||||
std::vector<QString> dependencyFilter;
|
||||
for (int row = 0; row < ui->depTabPossiblePhases->count(); row++) {
|
||||
for (int row = 0; row < ui->depTabPossiblePhases->count(); row++)
|
||||
{
|
||||
auto item = ui->depTabPossiblePhases->item(row);
|
||||
if (item->checkState() == Qt::Checked)
|
||||
dependencyFilter.push_back(item->text());
|
||||
}
|
||||
|
||||
|
||||
savingChangesToDB = true;
|
||||
PhaseDependenciesTracker::calculateDependencies(navigator->TraceFile(), dependencyFilter);
|
||||
depInfosView = new DependencyInfosModel(navigator->TraceFile(), this);
|
||||
ui->depInfosView->setModel(depInfosView);
|
||||
ui->depInfosView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
|
||||
}
|
||||
|
||||
void TraceFileTab::on_startLatencyAnalysis_clicked()
|
||||
@@ -406,45 +444,48 @@ void TraceFileTab::on_startLatencyAnalysis_clicked()
|
||||
int currentLatency = 0;
|
||||
QStandardItem* currentLatencyItem = nullptr;
|
||||
int counter = 0;
|
||||
while (query.next()) {
|
||||
if(query.value(0) != currentLatency) {
|
||||
currentLatencyItem = new QStandardItem(QString::number(query.value(0).toInt())+" ns");
|
||||
while (query.next())
|
||||
{
|
||||
if (query.value(0) != currentLatency)
|
||||
{
|
||||
currentLatencyItem = new QStandardItem(QString::number(query.value(0).toInt()) + " ns");
|
||||
currentLatency = query.value(0).toInt();
|
||||
QList<QStandardItem *> row;
|
||||
QList<QStandardItem*> row;
|
||||
row.append(currentLatencyItem);
|
||||
row.append(new QStandardItem());
|
||||
model->appendRow(row);
|
||||
}
|
||||
QStandardItem * id = new QStandardItem(query.value(1).toString());
|
||||
QStandardItem* id = new QStandardItem(query.value(1).toString());
|
||||
currentLatencyItem->appendRow(id);
|
||||
counter++;
|
||||
|
||||
int percentage = int(ceil((double(counter))/(double(maxTransactions))*100.0));
|
||||
int percentage = int(ceil((double(counter)) / (double(maxTransactions)) * 100.0));
|
||||
ui->latencyAnalysisProgressBar->setValue(percentage);
|
||||
}
|
||||
QStringList header = {"Latency","Occurences"};
|
||||
QStringList header = {"Latency", "Occurences"};
|
||||
model->setHorizontalHeaderLabels(header);
|
||||
|
||||
// Generate Histrogram and Tree:
|
||||
QwtPlotHistogram *hist = new QwtPlotHistogram;
|
||||
QVector<QwtIntervalSample> *intervals = new QVector<QwtIntervalSample>;
|
||||
for(int i = 0; i < model->rowCount(); i++) {
|
||||
double latency = model->item(i,0)->text().replace(" ns","").toDouble();
|
||||
QwtPlotHistogram* hist = new QwtPlotHistogram;
|
||||
QVector<QwtIntervalSample>* intervals = new QVector<QwtIntervalSample>;
|
||||
for (int i = 0; i < model->rowCount(); i++)
|
||||
{
|
||||
double latency = model->item(i, 0)->text().replace(" ns", "").toDouble();
|
||||
int numberOfChilds = model->item(i)->rowCount();
|
||||
double percentage = 100*((double(numberOfChilds))/(double(counter)));
|
||||
model->item(i,1)->setText(QString::number(percentage));
|
||||
intervals->append(QwtIntervalSample(percentage, latency, latency+1));
|
||||
double percentage = 100 * ((double(numberOfChilds)) / (double(counter)));
|
||||
model->item(i, 1)->setText(QString::number(percentage));
|
||||
intervals->append(QwtIntervalSample(percentage, latency, latency + 1));
|
||||
}
|
||||
ui->latencyTreeView->setItemDelegate(new ItemDelegate(ui->latencyTreeView));
|
||||
ui->latencyTreeView->setModel(model);
|
||||
hist->setSamples(*intervals);
|
||||
hist->attach(ui->latencyPlot);
|
||||
hist->setPen(QPen(QColor(255,0,0,100)));
|
||||
hist->setBrush(QBrush(QColor(255,0,0,255)));
|
||||
ui->latencyPlot->setAxisTitle(0,"Occurences [%]");
|
||||
QwtText axisTitle( "Latency [ns]" );
|
||||
axisTitle.setFont( ui->latencyPlot->axisTitle( QwtPlot::xBottom ).font() );
|
||||
ui->latencyPlot->setAxisTitle( QwtPlot::xBottom, axisTitle );
|
||||
hist->setPen(QPen(QColor(255, 0, 0, 100)));
|
||||
hist->setBrush(QBrush(QColor(255, 0, 0, 255)));
|
||||
ui->latencyPlot->setAxisTitle(0, "Occurences [%]");
|
||||
QwtText axisTitle("Latency [ns]");
|
||||
axisTitle.setFont(ui->latencyPlot->axisTitle(QwtPlot::xBottom).font());
|
||||
ui->latencyPlot->setAxisTitle(QwtPlot::xBottom, axisTitle);
|
||||
ui->latencyPlot->replot();
|
||||
}
|
||||
|
||||
@@ -458,31 +499,32 @@ void TraceFileTab::on_startPowerAnalysis_clicked()
|
||||
|
||||
query.exec(sql);
|
||||
|
||||
QwtPointSeriesData * data = new QwtPointSeriesData;
|
||||
QwtPlotCurve * cur = new QwtPlotCurve("Speed");
|
||||
QVector<QPointF>* samples=new QVector<QPointF>;
|
||||
QwtPointSeriesData* data = new QwtPointSeriesData;
|
||||
QwtPlotCurve* cur = new QwtPlotCurve("Speed");
|
||||
QVector<QPointF>* samples = new QVector<QPointF>;
|
||||
|
||||
while (query.next()) {
|
||||
while (query.next())
|
||||
{
|
||||
double time = query.value(0).toDouble();
|
||||
double power = query.value(1).toDouble();
|
||||
samples->push_back(QPointF(time,power));
|
||||
samples->push_back(QPointF(time, power));
|
||||
}
|
||||
|
||||
//ui->powerPlot->setAxisTitle(QwtPlot::xBottom,"Time");
|
||||
//ui->powerPlot->setAxisLabelRotation(QwtPlot::xBottom,-50.0);
|
||||
//ui->powerPlot->setAxisLabelAlignment(QwtPlot::xBottom,Qt::AlignLeft|Qt::AlignBottom);
|
||||
//ui->powerPlot->setAxisTitle(QwtPlot::yLeft,"Power");
|
||||
// ui->powerPlot->setAxisTitle(QwtPlot::xBottom,"Time");
|
||||
// ui->powerPlot->setAxisLabelRotation(QwtPlot::xBottom,-50.0);
|
||||
// ui->powerPlot->setAxisLabelAlignment(QwtPlot::xBottom,Qt::AlignLeft|Qt::AlignBottom);
|
||||
// ui->powerPlot->setAxisTitle(QwtPlot::yLeft,"Power");
|
||||
|
||||
data->setSamples(*samples);
|
||||
cur->setData(data);
|
||||
cur->attach(ui->powerPlot);
|
||||
cur->setPen(QPen(QColor(255,0,0)));
|
||||
cur->setPen(QPen(QColor(255, 0, 0)));
|
||||
|
||||
QwtPlotMagnifier *mag1 = new QwtPlotMagnifier(ui->powerPlot->canvas());
|
||||
QwtPlotMagnifier* mag1 = new QwtPlotMagnifier(ui->powerPlot->canvas());
|
||||
mag1->setAxisEnabled(QwtPlot::xBottom, true);
|
||||
mag1->setAxisEnabled(QwtPlot::yLeft, false);
|
||||
mag1->setWheelFactor(5);
|
||||
QwtPlotPanner *pan1 = new QwtPlotPanner(ui->powerPlot->canvas());
|
||||
QwtPlotPanner* pan1 = new QwtPlotPanner(ui->powerPlot->canvas());
|
||||
pan1->setAxisEnabled(QwtPlot::xBottom, true);
|
||||
pan1->setAxisEnabled(QwtPlot::yLeft, false);
|
||||
|
||||
@@ -492,11 +534,12 @@ void TraceFileTab::on_startPowerAnalysis_clicked()
|
||||
sql = "SELECT time, AverageBandwidth FROM Bandwidth;";
|
||||
query.exec(sql);
|
||||
|
||||
QwtPointSeriesData * data2 = new QwtPointSeriesData;
|
||||
QwtPlotCurve * cur2 = new QwtPlotCurve("Speed");
|
||||
QVector<QPointF>* samples2=new QVector<QPointF>;
|
||||
QwtPointSeriesData* data2 = new QwtPointSeriesData;
|
||||
QwtPlotCurve* cur2 = new QwtPlotCurve("Speed");
|
||||
QVector<QPointF>* samples2 = new QVector<QPointF>;
|
||||
|
||||
while (query.next()) {
|
||||
while (query.next())
|
||||
{
|
||||
double time = query.value(0).toDouble();
|
||||
double percentage = query.value(1).toDouble() * 100.0;
|
||||
samples2->push_back(QPointF(time, percentage));
|
||||
@@ -505,19 +548,19 @@ void TraceFileTab::on_startPowerAnalysis_clicked()
|
||||
data2->setSamples(*samples2);
|
||||
cur2->setData(data2);
|
||||
cur2->attach(ui->bandwidthPlot);
|
||||
cur2->setPen(QPen(QColor(255,0,0)));
|
||||
cur2->setPen(QPen(QColor(255, 0, 0)));
|
||||
|
||||
ui->bandwidthPlot->setAxisTitle(0,"Bandwidth [%]");
|
||||
ui->bandwidthPlot->setAxisScale(0,0.0,100.0);
|
||||
QwtText axisTitle2( "Time [s]" );
|
||||
axisTitle2.setFont( ui->bandwidthPlot->axisTitle( QwtPlot::xBottom ).font() );
|
||||
ui->bandwidthPlot->setAxisTitle( QwtPlot::xBottom, axisTitle2 );
|
||||
ui->bandwidthPlot->setAxisTitle(0, "Bandwidth [%]");
|
||||
ui->bandwidthPlot->setAxisScale(0, 0.0, 100.0);
|
||||
QwtText axisTitle2("Time [s]");
|
||||
axisTitle2.setFont(ui->bandwidthPlot->axisTitle(QwtPlot::xBottom).font());
|
||||
ui->bandwidthPlot->setAxisTitle(QwtPlot::xBottom, axisTitle2);
|
||||
|
||||
QwtPlotMagnifier *mag2 = new QwtPlotMagnifier(ui->bandwidthPlot->canvas());
|
||||
QwtPlotMagnifier* mag2 = new QwtPlotMagnifier(ui->bandwidthPlot->canvas());
|
||||
mag2->setAxisEnabled(QwtPlot::xBottom, true);
|
||||
mag2->setAxisEnabled(QwtPlot::yLeft, false);
|
||||
mag2->setWheelFactor(5);
|
||||
QwtPlotPanner *pan2 = new QwtPlotPanner(ui->bandwidthPlot->canvas());
|
||||
QwtPlotPanner* pan2 = new QwtPlotPanner(ui->bandwidthPlot->canvas());
|
||||
pan2->setAxisEnabled(QwtPlot::xBottom, true);
|
||||
pan2->setAxisEnabled(QwtPlot::yLeft, false);
|
||||
|
||||
@@ -537,11 +580,12 @@ void TraceFileTab::on_startPowerAnalysis_clicked()
|
||||
sql = "select Time, AverageBufferDepth from BufferDepth where BufferNumber = 0"; // TODO
|
||||
query.exec(sql);
|
||||
|
||||
QwtPointSeriesData * data3 = new QwtPointSeriesData;
|
||||
QwtPlotCurve * cur3 = new QwtPlotCurve("Speed");
|
||||
QwtPointSeriesData* data3 = new QwtPointSeriesData;
|
||||
QwtPlotCurve* cur3 = new QwtPlotCurve("Speed");
|
||||
QVector<QPointF>* samples3 = new QVector<QPointF>;
|
||||
|
||||
while (query.next()) {
|
||||
while (query.next())
|
||||
{
|
||||
double time = query.value(0).toDouble();
|
||||
double queue = query.value(1).toDouble();
|
||||
samples3->push_back(QPointF(time, queue));
|
||||
@@ -550,19 +594,19 @@ void TraceFileTab::on_startPowerAnalysis_clicked()
|
||||
data3->setSamples(*samples3);
|
||||
cur3->setData(data3);
|
||||
cur3->attach(ui->bufferPlot);
|
||||
cur3->setPen(QPen(QColor(255,0,0)));
|
||||
cur3->setPen(QPen(QColor(255, 0, 0)));
|
||||
|
||||
ui->bufferPlot->setAxisTitle(0,"Buffer Utilization");
|
||||
ui->bufferPlot->setAxisScale(0,0.0, maxBufferDepth);
|
||||
QwtText axisTitle3( "Time [s]" );
|
||||
axisTitle3.setFont( ui->bufferPlot->axisTitle( QwtPlot::xBottom ).font() );
|
||||
ui->bufferPlot->setAxisTitle( QwtPlot::xBottom, axisTitle3 );
|
||||
ui->bufferPlot->setAxisTitle(0, "Buffer Utilization");
|
||||
ui->bufferPlot->setAxisScale(0, 0.0, maxBufferDepth);
|
||||
QwtText axisTitle3("Time [s]");
|
||||
axisTitle3.setFont(ui->bufferPlot->axisTitle(QwtPlot::xBottom).font());
|
||||
ui->bufferPlot->setAxisTitle(QwtPlot::xBottom, axisTitle3);
|
||||
|
||||
QwtPlotMagnifier *mag3 = new QwtPlotMagnifier(ui->bufferPlot->canvas());
|
||||
QwtPlotMagnifier* mag3 = new QwtPlotMagnifier(ui->bufferPlot->canvas());
|
||||
mag3->setAxisEnabled(QwtPlot::xBottom, true);
|
||||
mag3->setAxisEnabled(QwtPlot::yLeft, false);
|
||||
mag3->setWheelFactor(5);
|
||||
QwtPlotPanner *pan3 = new QwtPlotPanner(ui->bufferPlot->canvas());
|
||||
QwtPlotPanner* pan3 = new QwtPlotPanner(ui->bufferPlot->canvas());
|
||||
pan3->setAxisEnabled(QwtPlot::xBottom, true);
|
||||
pan3->setAxisEnabled(QwtPlot::yLeft, false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user