Added Power Analysis in Trace Analyzer
This commit is contained in:
@@ -45,6 +45,12 @@
|
||||
#include <QString>
|
||||
#include <QItemDelegate>
|
||||
#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 <math.h>
|
||||
|
||||
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<QPointF>* samples=new QVector<QPointF>;
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabSelectedTrans">
|
||||
<attribute name="title">
|
||||
@@ -171,7 +171,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<widget class="QWidget" name="tabLatencyAnalysis">
|
||||
<attribute name="title">
|
||||
<string>Latency Analysis</string>
|
||||
</attribute>
|
||||
@@ -213,6 +213,66 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabPowerAnalysis">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>467</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string/>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>Power and Bandwidth Analysis</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="1" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="powerBox">
|
||||
<property name="title">
|
||||
<string>Power:</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QwtPlot" name="powerPlot"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="bandwidthBox">
|
||||
<property name="title">
|
||||
<string>Bandwidth:</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QwtPlot" name="bandwidthPlot"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="startPowerAnalysis">
|
||||
<property name="text">
|
||||
<string>Start Analysis</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
Reference in New Issue
Block a user