Update the entire program to use QVector. This should make the performance better. Still trying to preallocate enough space for 10,000,000 frames which should be more than plenty.

This commit is contained in:
Collin Kidder
2015-05-22 23:33:08 -04:00
parent 799d4ca617
commit ae7a301cfb
13 changed files with 21 additions and 20 deletions
+1 -1
View File
@@ -156,7 +156,7 @@ void CANFrameModel::clearFrames()
//Is this safe? Maybe not but if we don't change it then that's OK
//Is it the best C++ practice? Probably not. This breaks the MVC paradigm
//but, it's for a good cause.
QList<CANFrame>* CANFrameModel::getListReference()
QVector<CANFrame>* CANFrameModel::getListReference()
{
return &frames;
}
+3 -2
View File
@@ -3,6 +3,7 @@
#include <QAbstractTableModel>
#include <QList>
#include <QVector>
#include "can_structs.h"
#include "dbchandler.h"
@@ -26,11 +27,11 @@ public:
void setDBCHandler(DBCHandler *);
void setInterpetMode(bool);
void setOverwriteMode(bool);
QList<CANFrame> *getListReference();
QVector<CANFrame> *getListReference();
private:
QList<CANFrame> frames;
QVector<CANFrame> frames;
DBCHandler *dbcHandler;
bool interpretFrames; //should we use the dbcHandler?
bool overwriteDups; //should we display all frames or only the newest for each ID?
+1 -1
View File
@@ -5,7 +5,7 @@ const QColor FlowViewWindow::graphColors[8] = {Qt::blue, Qt::green, Qt::black, Q
Qt::gray, Qt::yellow, Qt::cyan, Qt::darkMagenta};
FlowViewWindow::FlowViewWindow(QList<CANFrame> *frames, QWidget *parent) :
FlowViewWindow::FlowViewWindow(QVector<CANFrame> *frames, QWidget *parent) :
QDialog(parent),
ui(new Ui::FlowViewWindow)
{
+2 -2
View File
@@ -13,7 +13,7 @@ class FlowViewWindow : public QDialog
Q_OBJECT
public:
explicit FlowViewWindow(QList<CANFrame> *frames, QWidget *parent = 0);
explicit FlowViewWindow(QVector<CANFrame> *frames, QWidget *parent = 0);
~FlowViewWindow();
private slots:
@@ -32,7 +32,7 @@ private:
Ui::FlowViewWindow *ui;
QList<int> foundID;
QList<CANFrame> frameCache;
QList<CANFrame> *modelFrames;
QVector<CANFrame> *modelFrames;
unsigned char refBytes[8];
unsigned char currBytes[8];
int currentPosition;
+1 -1
View File
@@ -2,7 +2,7 @@
#include "ui_frameinfowindow.h"
#include <QtDebug>
FrameInfoWindow::FrameInfoWindow(QList<CANFrame> *frames, QWidget *parent) :
FrameInfoWindow::FrameInfoWindow(QVector<CANFrame> *frames, QWidget *parent) :
QDialog(parent),
ui(new Ui::FrameInfoWindow)
{
+2 -2
View File
@@ -14,7 +14,7 @@ class FrameInfoWindow : public QDialog
Q_OBJECT
public:
explicit FrameInfoWindow(QList<CANFrame> *frames, QWidget *parent = 0);
explicit FrameInfoWindow(QVector<CANFrame> *frames, QWidget *parent = 0);
~FrameInfoWindow();
private slots:
@@ -25,7 +25,7 @@ private:
QList<int> foundID;
QList<CANFrame> frameCache;
QList<CANFrame> *modelFrames;
QVector<CANFrame> *modelFrames;
void refreshIDList();
};
+1 -1
View File
@@ -2,7 +2,7 @@
#include "ui_frameplaybackwindow.h"
#include <QDebug>
FramePlaybackWindow::FramePlaybackWindow(QList<CANFrame> *frames, QWidget *parent) :
FramePlaybackWindow::FramePlaybackWindow(QVector<CANFrame> *frames, QWidget *parent) :
QDialog(parent),
ui(new Ui::FramePlaybackWindow)
{
+2 -2
View File
@@ -15,7 +15,7 @@ class FramePlaybackWindow : public QDialog
Q_OBJECT
public:
explicit FramePlaybackWindow(QList<CANFrame> *frames, QWidget *parent = 0);
explicit FramePlaybackWindow(QVector<CANFrame> *frames, QWidget *parent = 0);
~FramePlaybackWindow();
private slots:
@@ -40,7 +40,7 @@ private:
Ui::FramePlaybackWindow *ui;
QList<int> foundID;
QList<CANFrame> frameCache;
QList<CANFrame> *modelFrames;
QVector<CANFrame> *modelFrames;
int currentPosition;
QTimer *playbackTimer;
bool playbackActive;
+1 -1
View File
@@ -2,7 +2,7 @@
#include "ui_framesenderwindow.h"
#include "utility.h"
FrameSenderWindow::FrameSenderWindow(QList<CANFrame> *frames, QWidget *parent) :
FrameSenderWindow::FrameSenderWindow(QVector<CANFrame> *frames, QWidget *parent) :
QDialog(parent),
ui(new Ui::FrameSenderWindow)
{
+2 -2
View File
@@ -15,7 +15,7 @@ class FrameSenderWindow : public QDialog
Q_OBJECT
public:
explicit FrameSenderWindow(QList<CANFrame> *frames, QWidget *parent = 0);
explicit FrameSenderWindow(QVector<CANFrame> *frames, QWidget *parent = 0);
~FrameSenderWindow();
private slots:
@@ -26,7 +26,7 @@ private:
Ui::FrameSenderWindow *ui;
QList<FrameSendData> sendingData;
QList<CANFrame> frameCache;
QList<CANFrame> *modelFrames;
QVector<CANFrame> *modelFrames;
QTimer *intervalTimer;
void doModifiers(int);
+1 -1
View File
@@ -3,7 +3,7 @@
#include "newgraphdialog.h"
#include <QDebug>
GraphingWindow::GraphingWindow(QList<CANFrame> *frames, QWidget *parent) :
GraphingWindow::GraphingWindow(QVector<CANFrame> *frames, QWidget *parent) :
QDialog(parent),
ui(new Ui::GraphingWindow)
{
+2 -2
View File
@@ -29,7 +29,7 @@ class GraphingWindow : public QDialog
Q_OBJECT
public:
explicit GraphingWindow(QList<CANFrame> *, QWidget *parent = 0);
explicit GraphingWindow(QVector<CANFrame> *, QWidget *parent = 0);
~GraphingWindow();
private slots:
@@ -50,7 +50,7 @@ private slots:
private:
Ui::GraphingWindow *ui;
QList<CANFrame> frameCache;
QList<CANFrame> *modelFrames;
QVector<CANFrame> *modelFrames;
QList<GraphParams> graphParams;
QPen selectedPen;
+2 -2
View File
@@ -248,7 +248,7 @@ void MainWindow::loadCRTDFile(QString filename)
void MainWindow::saveCRTDFile(QString filename)
{
QFile *outFile = new QFile(filename);
QList<CANFrame> *frames = model->getListReference();
QVector<CANFrame> *frames = model->getListReference();
if (!outFile->open(QIODevice::WriteOnly | QIODevice::Text))
return;
@@ -328,7 +328,7 @@ void MainWindow::loadNativeCSVFile(QString filename)
void MainWindow::saveNativeCSVFile(QString filename)
{
QFile *outFile = new QFile(filename);
QList<CANFrame> *frames = model->getListReference();
QVector<CANFrame> *frames = model->getListReference();
if (!outFile->open(QIODevice::WriteOnly | QIODevice::Text))
return;