From 981637188f97d2b42d5d687cc1e42760c0190716 Mon Sep 17 00:00:00 2001 From: Matthias Jung Date: Wed, 11 Nov 2020 10:06:01 +0100 Subject: [PATCH] Added Power Analysis in Trace Analyzer --- DRAMSys/traceAnalyzer/tracefiletab.cpp | 40 ++++++++++++++++ DRAMSys/traceAnalyzer/tracefiletab.h | 1 + DRAMSys/traceAnalyzer/tracefiletab.ui | 64 +++++++++++++++++++++++++- 3 files changed, 103 insertions(+), 2 deletions(-) diff --git a/DRAMSys/traceAnalyzer/tracefiletab.cpp b/DRAMSys/traceAnalyzer/tracefiletab.cpp index b67004b7..6acea07c 100644 --- a/DRAMSys/traceAnalyzer/tracefiletab.cpp +++ b/DRAMSys/traceAnalyzer/tracefiletab.cpp @@ -45,6 +45,12 @@ #include #include #include "qwt_plot_histogram.h" +#include "qwt_plot_curve.h" +#include "qwt_plot_layout.h" +#include "qwt_scale_draw.h" +#include "qwt_scale_widget.h" +#include "qwt_legend.h" + #include TraceFileTab::TraceFileTab(QWidget *parent, const QString &path) : @@ -223,3 +229,37 @@ void TraceFileTab::on_startLatencyAnalysis_clicked() ui->latencyPlot->setAxisTitle( QwtPlot::xBottom, axisTitle ); ui->latencyPlot->replot(); } + +void TraceFileTab::on_startPowerAnalysis_clicked() +{ + qDebug() << "Power Analysis"; + QSqlDatabase db = navigator->TraceFile().getDatabase(); + QSqlQuery query(db); + + QString sql = "SELECT time, AveragePower FROM Power;"; + + query.exec(sql); + + QwtPointSeriesData * data = new QwtPointSeriesData; + QwtPlotCurve * cur = new QwtPlotCurve("Speed"); + QVector* samples=new QVector; + + while (query.next()) { + double time = query.value(0).toDouble(); + double power = query.value(1).toDouble(); + 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"); + + data->setSamples(*samples); + cur->setData(data); + cur->attach(ui->powerPlot); + ui->powerPlot->replot(); + + // Bandwidth analysis: + // TODO +} diff --git a/DRAMSys/traceAnalyzer/tracefiletab.h b/DRAMSys/traceAnalyzer/tracefiletab.h index 6ec1cec5..6a7890a4 100644 --- a/DRAMSys/traceAnalyzer/tracefiletab.h +++ b/DRAMSys/traceAnalyzer/tracefiletab.h @@ -83,6 +83,7 @@ private Q_SLOTS: void on_tabWidget_currentChanged(int index); void on_latencyTreeView_doubleClicked(const QModelIndex &index); void on_startLatencyAnalysis_clicked(); + void on_startPowerAnalysis_clicked(); }; #endif // TRACEFILETAB_H diff --git a/DRAMSys/traceAnalyzer/tracefiletab.ui b/DRAMSys/traceAnalyzer/tracefiletab.ui index 726f36c8..b658ece7 100644 --- a/DRAMSys/traceAnalyzer/tracefiletab.ui +++ b/DRAMSys/traceAnalyzer/tracefiletab.ui @@ -66,7 +66,7 @@ - 0 + 2 @@ -171,7 +171,7 @@ - + Latency Analysis @@ -213,6 +213,66 @@ + + + true + + + + 0 + 0 + + + + + 467 + 0 + + + + + + + Power and Bandwidth Analysis + + + + + + + + Power: + + + + + + + + + + + + Bandwidth: + + + + + + + + + + + + + + Start Analysis + + + + +