Some changes in analyzer

This commit is contained in:
Matthias Jung
2020-11-23 14:41:21 +01:00
parent 981637188f
commit e7b7653029
3 changed files with 110 additions and 12 deletions

View File

@@ -101,7 +101,7 @@ def plot(function):
return function
@plot
#@plot
def memory_utilisation_window(connection, tracePath, steps):
# This function determines the average memory bandwidth over time in
# percentage and in Gbit/s. The average bandwidth over time is done
@@ -246,7 +246,7 @@ def queue_window(connection, tracePath, steps):
return outputFile
@plot
#@plot
def power_window(connection, tracePath, steps):
windowSize = getWindowSize(connection)
@@ -340,7 +340,7 @@ def latency_analysis(connection, tracePath, steps):
return "none\n"
@plot
#@plot
def latency_histogram(connection, tracePath, steps):
# This function plots an histogram with access latencys

View File

@@ -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();
}

View File

@@ -66,7 +66,7 @@
</size>
</property>
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<widget class="QWidget" name="tabSelectedTrans">
<attribute name="title">
@@ -236,6 +236,13 @@
<string>Power and Bandwidth Analysis</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QPushButton" name="startPowerAnalysis">
<property name="text">
<string>Start Analysis</string>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
@@ -262,15 +269,20 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="bufferBox">
<property name="title">
<string>Buffer Analysis:</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QwtPlot" name="bufferPlot"/>
</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>