Some changes in analyzer
This commit is contained in:
@@ -50,6 +50,8 @@
|
||||
#include "qwt_scale_draw.h"
|
||||
#include "qwt_scale_widget.h"
|
||||
#include "qwt_legend.h"
|
||||
#include "qwt_plot_magnifier.h"
|
||||
#include "qwt_plot_panner.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@@ -258,8 +260,92 @@ void TraceFileTab::on_startPowerAnalysis_clicked()
|
||||
data->setSamples(*samples);
|
||||
cur->setData(data);
|
||||
cur->attach(ui->powerPlot);
|
||||
|
||||
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());
|
||||
pan1->setAxisEnabled(QwtPlot::xBottom, true);
|
||||
pan1->setAxisEnabled(QwtPlot::yLeft, false);
|
||||
|
||||
ui->powerPlot->replot();
|
||||
|
||||
// Bandwidth analysis:
|
||||
// TODO
|
||||
sql = "SELECT time, AverageBandwidth FROM Bandwidth;";
|
||||
query.exec(sql);
|
||||
|
||||
QwtPointSeriesData * data2 = new QwtPointSeriesData;
|
||||
QwtPlotCurve * cur2 = new QwtPlotCurve("Speed");
|
||||
QVector<QPointF>* samples2=new QVector<QPointF>;
|
||||
|
||||
while (query.next()) {
|
||||
double time = query.value(0).toDouble();
|
||||
double percentage = query.value(1).toDouble() * 100.0;
|
||||
samples2->push_back(QPointF(time, percentage));
|
||||
}
|
||||
|
||||
data2->setSamples(*samples2);
|
||||
cur2->setData(data2);
|
||||
cur2->attach(ui->bandwidthPlot);
|
||||
|
||||
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());
|
||||
mag2->setAxisEnabled(QwtPlot::xBottom, true);
|
||||
mag2->setAxisEnabled(QwtPlot::yLeft, false);
|
||||
mag2->setWheelFactor(5);
|
||||
QwtPlotPanner *pan2 = new QwtPlotPanner(ui->bandwidthPlot->canvas());
|
||||
pan2->setAxisEnabled(QwtPlot::xBottom, true);
|
||||
pan2->setAxisEnabled(QwtPlot::yLeft, false);
|
||||
|
||||
ui->bandwidthPlot->replot();
|
||||
|
||||
// Buffer analysis:
|
||||
sql = "select max(BufferNumber) from BufferDepth;";
|
||||
query.exec(sql);
|
||||
query.next();
|
||||
unsigned int numberOfBuffers = query.value(0).toUInt();
|
||||
|
||||
sql = "select MaxBufferDepth from GeneralInfo;";
|
||||
query.exec(sql);
|
||||
query.next();
|
||||
unsigned int maxBufferDepth = query.value(0).toUInt();
|
||||
|
||||
sql = "select Time, AverageBufferDepth from BufferDepth where BufferNumber = 0"; // TODO
|
||||
query.exec(sql);
|
||||
|
||||
QwtPointSeriesData * data3 = new QwtPointSeriesData;
|
||||
QwtPlotCurve * cur3 = new QwtPlotCurve("Speed");
|
||||
QVector<QPointF>* samples3 = new QVector<QPointF>;
|
||||
|
||||
while (query.next()) {
|
||||
double time = query.value(0).toDouble();
|
||||
double queue = query.value(1).toDouble();
|
||||
samples3->push_back(QPointF(time, queue));
|
||||
}
|
||||
|
||||
data3->setSamples(*samples3);
|
||||
cur3->setData(data3);
|
||||
cur3->attach(ui->bufferPlot);
|
||||
|
||||
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());
|
||||
mag3->setAxisEnabled(QwtPlot::xBottom, true);
|
||||
mag3->setAxisEnabled(QwtPlot::yLeft, false);
|
||||
mag3->setWheelFactor(5);
|
||||
QwtPlotPanner *pan3 = new QwtPlotPanner(ui->bufferPlot->canvas());
|
||||
pan3->setAxisEnabled(QwtPlot::xBottom, true);
|
||||
pan3->setAxisEnabled(QwtPlot::yLeft, false);
|
||||
|
||||
ui->bufferPlot->replot();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user