MReadWrite *mrw = new MReadWrite(this);
if (!mrw
->openRead
(QDir::currentPath() + "/Log_RAM_10.log")) {
QMessageBox::warning(this,
"Erro",
"Falha ao abrir grafico.");
SAFEDELETE(mrw);
return;
}
else
{
QVector<double> xPoints, data_emuso, data_disponivel, data_servidor, data_central, data_mysql, data_http1, data_http2;
double xCounter = 0.0;
int linhaCounter = 0, ultimoTracejado = 0;
// Header localizer
while (!mrw->isAtEnd())
{
linhaCounter++;
const QString linha
= mrw
->readLine
();
if (linha.contains("------------------------------------------------"))
ultimoTracejado = linhaCounter;
}
mrw->goToLine(ultimoTracejado + 2);
while (!mrw->isAtEnd())
{
const QString linha
= mrw
->readLine
();
data_emuso.append(linha.section("\t",2,2).toDouble());
data_disponivel.append(linha.section("\t",3,3).toDouble());
data_servidor.append(linha.section("\t",5,5).toDouble());
data_central.append(linha.section("\t",6,6).toDouble());
data_mysql.append(linha.section("\t",7,7).toDouble());
data_http1.append(linha.section("\t",8,8).toDouble());
data_http2.append(linha.section("\t",9,9).toDouble());
xPoints.append(xCounter++);
}
mrw->closeFile();
SAFEDELETE(mrw);
if (!data_emuso.isEmpty() && !data_disponivel.isEmpty() && !data_servidor.isEmpty() && !data_central.isEmpty()
&& !data_mysql.isEmpty() && !data_http1.isEmpty() && !data_http2.isEmpty())
{
graphWindow->setFixedSize(800,400);
graphWindow->setWindowTitle("Gráfico (base: 10 min)");
graphWidget->resize(graphWindow->size());
plot->resize(plot->parentWidget()->size());
plot
->setAxisScale
(QwtPlot::xBottom,
0.0,xPoints.
last());
plot
->setAxisTitle
(QwtPlot::xBottom,
"Amostras");
plot
->setAxisTitle
(QwtPlot::yLeft,
"Valor (MByte)");
plot
->setAxisScale
(QwtPlot::yLeft,
0.0,
4096.0);
plot
->setCanvasBackground
(QBrush(Qt
::white));
curva_emuso->attach(plot);
curva_emuso
->setPen
(QPen(Qt
::red,
2.0));
curva_emuso->setSamples(xPoints,data_emuso);
curva_emuso
->setRenderHint
(QwtPlotCurve::RenderAntialiased,
true);
curva_emuso->show();
curva_disponivel->attach(plot);
curva_disponivel
->setPen
(QPen(Qt
::gray,
2.0));
curva_disponivel->setSamples(xPoints,data_disponivel);
curva_emuso
->setRenderHint
(QwtPlotCurve::RenderAntialiased,
true);
curva_disponivel->show();
curva_servidor->attach(plot);
curva_servidor
->setPen
(QPen(Qt
::blue,
2.0));
curva_servidor->setSamples(xPoints,data_servidor);
curva_emuso
->setRenderHint
(QwtPlotCurve::RenderAntialiased,
true);
curva_servidor->show();
curva_central->attach(plot);
curva_central
->setPen
(QPen(Qt
::green,
2.0));
curva_central->setSamples(xPoints,data_central);
curva_emuso
->setRenderHint
(QwtPlotCurve::RenderAntialiased,
true);
curva_central->show();
curva_mysql->attach(plot);
curva_mysql
->setPen
(QPen(Qt
::cyan,
2.0));
curva_mysql->setSamples(xPoints,data_mysql);
curva_emuso
->setRenderHint
(QwtPlotCurve::RenderAntialiased,
true);
curva_mysql->show();
curva_http1->attach(plot);
curva_http1
->setPen
(QPen(Qt
::yellow,
2.0));
curva_http1->setSamples(xPoints,data_http1);
curva_emuso
->setRenderHint
(QwtPlotCurve::RenderAntialiased,
true);
curva_http1->show();
curva_http2->attach(plot);
curva_http2
->setPen
(QPen(Qt
::darkYellow,
2.0));
curva_http2->setSamples(xPoints,data_http2);
curva_emuso
->setRenderHint
(QwtPlotCurve::RenderAntialiased,
true);
curva_http2->show();
plot->replot();
plot->show();
graphWindow->exec();
SAFEDELETE(curva_emuso);
SAFEDELETE(curva_disponivel);
SAFEDELETE(plot);
SAFEDELETE(graphWindow);
}
}
MReadWrite *mrw = new MReadWrite(this);
if (!mrw->openRead(QDir::currentPath() + "/Log_RAM_10.log"))
{
QMessageBox::warning(this,"Erro","Falha ao abrir grafico.");
SAFEDELETE(mrw);
return;
}
else
{
QVector<double> xPoints, data_emuso, data_disponivel, data_servidor, data_central, data_mysql, data_http1, data_http2;
double xCounter = 0.0;
int linhaCounter = 0, ultimoTracejado = 0;
// Header localizer
while (!mrw->isAtEnd())
{
linhaCounter++;
const QString linha = mrw->readLine();
if (linha.contains("------------------------------------------------"))
ultimoTracejado = linhaCounter;
}
mrw->goToLine(ultimoTracejado + 2);
while (!mrw->isAtEnd())
{
const QString linha = mrw->readLine();
data_emuso.append(linha.section("\t",2,2).toDouble());
data_disponivel.append(linha.section("\t",3,3).toDouble());
data_servidor.append(linha.section("\t",5,5).toDouble());
data_central.append(linha.section("\t",6,6).toDouble());
data_mysql.append(linha.section("\t",7,7).toDouble());
data_http1.append(linha.section("\t",8,8).toDouble());
data_http2.append(linha.section("\t",9,9).toDouble());
xPoints.append(xCounter++);
}
mrw->closeFile();
SAFEDELETE(mrw);
if (!data_emuso.isEmpty() && !data_disponivel.isEmpty() && !data_servidor.isEmpty() && !data_central.isEmpty()
&& !data_mysql.isEmpty() && !data_http1.isEmpty() && !data_http2.isEmpty())
{
QDialog *graphWindow = new QDialog(this);
graphWindow->setFixedSize(800,400);
graphWindow->setWindowTitle("Gráfico (base: 10 min)");
QWidget *graphWidget = new QWidget(graphWindow);
graphWidget->resize(graphWindow->size());
QwtPlot *plot = new QwtPlot(graphWidget);
plot->resize(plot->parentWidget()->size());
plot->setAxisScale(QwtPlot::xBottom,0.0,xPoints.last());
plot->setAxisTitle(QwtPlot::xBottom,"Amostras");
plot->setAxisTitle(QwtPlot::yLeft,"Valor (MByte)");
plot->setAxisScale(QwtPlot::yLeft,0.0,4096.0);
plot->setCanvasBackground(QBrush(Qt::white));
QwtPlotCurve *curva_emuso = new QwtPlotCurve("curva_emuso");
curva_emuso->attach(plot);
curva_emuso->setPen(QPen(Qt::red,2.0));
curva_emuso->setSamples(xPoints,data_emuso);
curva_emuso->setRenderHint(QwtPlotCurve::RenderAntialiased,true);
curva_emuso->show();
QwtPlotCurve *curva_disponivel = new QwtPlotCurve("curva_disponivel");
curva_disponivel->attach(plot);
curva_disponivel->setPen(QPen(Qt::gray,2.0));
curva_disponivel->setSamples(xPoints,data_disponivel);
curva_emuso->setRenderHint(QwtPlotCurve::RenderAntialiased,true);
curva_disponivel->show();
QwtPlotCurve *curva_servidor = new QwtPlotCurve("curva_servidor");
curva_servidor->attach(plot);
curva_servidor->setPen(QPen(Qt::blue,2.0));
curva_servidor->setSamples(xPoints,data_servidor);
curva_emuso->setRenderHint(QwtPlotCurve::RenderAntialiased,true);
curva_servidor->show();
QwtPlotCurve *curva_central = new QwtPlotCurve("curva_central");
curva_central->attach(plot);
curva_central->setPen(QPen(Qt::green,2.0));
curva_central->setSamples(xPoints,data_central);
curva_emuso->setRenderHint(QwtPlotCurve::RenderAntialiased,true);
curva_central->show();
QwtPlotCurve *curva_mysql = new QwtPlotCurve("curva_mysql");
curva_mysql->attach(plot);
curva_mysql->setPen(QPen(Qt::cyan,2.0));
curva_mysql->setSamples(xPoints,data_mysql);
curva_emuso->setRenderHint(QwtPlotCurve::RenderAntialiased,true);
curva_mysql->show();
QwtPlotCurve *curva_http1 = new QwtPlotCurve("curva_http1");
curva_http1->attach(plot);
curva_http1->setPen(QPen(Qt::yellow,2.0));
curva_http1->setSamples(xPoints,data_http1);
curva_emuso->setRenderHint(QwtPlotCurve::RenderAntialiased,true);
curva_http1->show();
QwtPlotCurve *curva_http2 = new QwtPlotCurve("curva_http2");
curva_http2->attach(plot);
curva_http2->setPen(QPen(Qt::darkYellow,2.0));
curva_http2->setSamples(xPoints,data_http2);
curva_emuso->setRenderHint(QwtPlotCurve::RenderAntialiased,true);
curva_http2->show();
plot->replot();
plot->show();
graphWindow->exec();
SAFEDELETE(curva_emuso);
SAFEDELETE(curva_disponivel);
SAFEDELETE(plot);
SAFEDELETE(graphWindow);
}
}
To copy to clipboard, switch view to plain text mode
MReadWrite *mrw = new MReadWrite(this);
if (!mrw
->openRead
(QDir::currentPath() + "/Log_RAM_10.log")) {
QMessageBox::warning(this,
"Erro",
"Falha ao abrir grafico.");
SAFEDELETE(mrw);
return;
}
else
{
QVector<double> xPoints, data_emuso, data_disponivel, data_servidor, data_central, data_mysql, data_http1, data_http2;
double xCounter = 0.0;
int linhaCounter = 0, ultimoTracejado = 0;
// Localiza ponto de inicio
while (!mrw->isAtEnd())
{
linhaCounter++;
const QString linha
= mrw
->readLine
();
if (linha.contains("------------------------------------------------"))
ultimoTracejado = linhaCounter;
}
mrw->goToLine(ultimoTracejado + 2);
while (!mrw->isAtEnd())
{
const QString linha
= mrw
->readLine
();
data_emuso.append(linha.section("\t",2,2).toDouble());
data_disponivel.append(linha.section("\t",3,3).toDouble());
data_servidor.append(linha.section("\t",5,5).toDouble());
data_central.append(linha.section("\t",6,6).toDouble());
data_mysql.append(linha.section("\t",7,7).toDouble());
data_http1.append(linha.section("\t",8,8).toDouble());
data_http2.append(linha.section("\t",9,9).toDouble());
xPoints.append(xCounter++);
}
mrw->closeFile();
SAFEDELETE(mrw);
if (!data_emuso.isEmpty() && !data_disponivel.isEmpty() && !data_servidor.isEmpty() && !data_central.isEmpty()
&& !data_mysql.isEmpty() && !data_http1.isEmpty() && !data_http2.isEmpty())
{
graphWindow->setFixedSize(800,400);
graphWindow->setWindowTitle("Gráfico (base: 10 min)");
graphWindow->exec();
SAFEDELETE(graphWindow);
}
}
MReadWrite *mrw = new MReadWrite(this);
if (!mrw->openRead(QDir::currentPath() + "/Log_RAM_10.log"))
{
QMessageBox::warning(this,"Erro","Falha ao abrir grafico.");
SAFEDELETE(mrw);
return;
}
else
{
QVector<double> xPoints, data_emuso, data_disponivel, data_servidor, data_central, data_mysql, data_http1, data_http2;
double xCounter = 0.0;
int linhaCounter = 0, ultimoTracejado = 0;
// Localiza ponto de inicio
while (!mrw->isAtEnd())
{
linhaCounter++;
const QString linha = mrw->readLine();
if (linha.contains("------------------------------------------------"))
ultimoTracejado = linhaCounter;
}
mrw->goToLine(ultimoTracejado + 2);
while (!mrw->isAtEnd())
{
const QString linha = mrw->readLine();
data_emuso.append(linha.section("\t",2,2).toDouble());
data_disponivel.append(linha.section("\t",3,3).toDouble());
data_servidor.append(linha.section("\t",5,5).toDouble());
data_central.append(linha.section("\t",6,6).toDouble());
data_mysql.append(linha.section("\t",7,7).toDouble());
data_http1.append(linha.section("\t",8,8).toDouble());
data_http2.append(linha.section("\t",9,9).toDouble());
xPoints.append(xCounter++);
}
mrw->closeFile();
SAFEDELETE(mrw);
if (!data_emuso.isEmpty() && !data_disponivel.isEmpty() && !data_servidor.isEmpty() && !data_central.isEmpty()
&& !data_mysql.isEmpty() && !data_http1.isEmpty() && !data_http2.isEmpty())
{
QDialog *graphWindow = new QDialog(this);
graphWindow->setFixedSize(800,400);
graphWindow->setWindowTitle("Gráfico (base: 10 min)");
graphWindow->exec();
SAFEDELETE(graphWindow);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks