Add a primitive benchmark tool for measuring the time to fetch all rows

This adds another primitive benchmark tool which in this case helps
measuring the time required to load all remaining rows from the selected
table. When activated using the LOAD_DATA_BENCHMARK define, it opens a
message box after loading of all rows using the fetch-all-data button in
the Plot Dock is clicked.
This commit is contained in:
Martin Kleusberg
2019-05-02 11:47:35 +02:00
parent 925eed3ef8
commit 59e1edc2ba

View File

@@ -11,6 +11,14 @@
#include <QRandomGenerator>
#endif
// Enable this line to show the most basic performance stats after pressing the fetch-all-data button. Please keep in mind that while these
// numbers might help to estimate the performance of the data loading procedure, this is not a proper benchmark.
//#define LOAD_DATA_BENCHMARK
#ifdef LOAD_DATA_BENCHMARK
#include <QElapsedTimer>
#endif
static int random_number(int from, int to)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
@@ -709,9 +717,21 @@ void PlotDock::fetchAllData()
{
if(m_currentPlotModel)
{
#ifdef LOAD_DATA_BENCHMARK
// If benchmark mode is enabled start measuring the performance now
QElapsedTimer timer;
timer.start();
#endif
// Make sure all data is loaded
m_currentPlotModel->completeCache();
#ifdef LOAD_DATA_BENCHMARK
QMessageBox::information(this, qApp->applicationName(),
tr("Loading all remaining data for this table took %1ms.")
.arg(timer.elapsed()));
#endif
// Update plot
updatePlot(m_currentPlotModel, m_currentTableSettings);
}