aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@crimson.no>2017-04-26 12:54:17 +0200
committerRobin Burchell <robin.burchell@crimson.no>2017-04-26 10:58:10 +0000
commitce0bc2626e55b8f710c54498daefc3df88d70e3d (patch)
tree6fad163752162389be5e72f3e5048cb0a0b58bcb
parentd66aa1bf7e9e099643b2f1edf95b79ac5aad179b (diff)
Add an option to destroy the view between runs
Useful to determine if there's something funky going on in caching somewhere Change-Id: I359eabec3b740eff602898f71a035af169800d38 Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
-rw-r--r--src/benchmarkrunner.cpp30
-rw-r--r--src/benchmarkrunner.h3
-rw-r--r--src/main.cpp5
-rw-r--r--src/options.h2
4 files changed, 31 insertions, 9 deletions
diff --git a/src/benchmarkrunner.cpp b/src/benchmarkrunner.cpp
index 6e52949..e10ea19 100644
--- a/src/benchmarkrunner.cpp
+++ b/src/benchmarkrunner.cpp
@@ -47,12 +47,9 @@ BenchmarkRunner::~BenchmarkRunner()
delete m_view;
}
-bool BenchmarkRunner::execute()
+void BenchmarkRunner::createView()
{
- if (Options::instance.benchmarks.size() == 0)
- return false;
- QTimer::singleShot(Options::instance.delayedStart, this, SLOT(start()));
-
+ Q_ASSERT(m_view == 0);
m_view = new QQuickView();
// Make sure proper fullscreen is possible on OSX
m_view->setFlags(Qt::Window
@@ -71,7 +68,20 @@ bool BenchmarkRunner::execute()
else
m_view->show();
m_view->raise();
+}
+bool BenchmarkRunner::execute()
+{
+ if (Options::instance.benchmarks.size() == 0)
+ return false;
+
+ if (Options::instance.destroyViewEachRun) {
+ qWarning() << "Deleting the view. Remember, you should only do this as a debugging aid!";
+ delete m_view;
+ m_view = 0;
+ }
+ createView();
+ QTimer::singleShot(Options::instance.delayedStart, this, SLOT(start()));
return true;
}
@@ -153,10 +163,14 @@ void BenchmarkRunner::recordOperationsPerFrame(qreal ops)
bool restart = false;
restart = bm.operationsPerFrame.size() < Options::instance.repeat;
- if (restart)
- QMetaObject::invokeMethod(this, "start", Qt::QueuedConnection);
- else
+ if (restart) {
+ if (Options::instance.destroyViewEachRun)
+ QMetaObject::invokeMethod(this, "execute", Qt::QueuedConnection); // recreates the view too
+ else
+ QMetaObject::invokeMethod(this, "start", Qt::QueuedConnection); // recreates the view too
+ } else {
QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
+ }
}
diff --git a/src/benchmarkrunner.h b/src/benchmarkrunner.h
index 0710024..dbe267b 100644
--- a/src/benchmarkrunner.h
+++ b/src/benchmarkrunner.h
@@ -57,7 +57,7 @@ public:
BenchmarkRunner();
~BenchmarkRunner();
- bool execute();
+ void createView();
QQuickView *view() const { return m_view; }
QQmlComponent *component() const { return m_component; }
@@ -76,6 +76,7 @@ public:
double hardwareMultiplier() const { return Options::instance.hardwareMultiplier; }
public slots:
+ bool execute();
void recordOperationsPerFrame(qreal count);
void abort();
diff --git a/src/main.cpp b/src/main.cpp
index adeffd9..113f648 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -126,6 +126,10 @@ QStringList processCommandLineArguments(const QCoreApplication &app)
QStringLiteral("-1"));
parser.addOption(countOption);
+ QCommandLineOption destroyViewOption(QStringLiteral("destroy-view"),
+ QStringLiteral("Destroys the QQuickView between each test run. Use it as a debug aid, do not benchmark with this!"));
+ parser.addOption(destroyViewOption);
+
QCommandLineOption frameCountInterval(QStringLiteral("framecount-interval"),
QStringLiteral("Sets the interval used to count frames in milliseconds. Only applicable to 'frame-count' shell."),
QStringLiteral("count"),
@@ -165,6 +169,7 @@ QStringList processCommandLineArguments(const QCoreApplication &app)
Options::instance.count = parser.value(countOption).toInt();
Options::instance.hardwareMultiplier = parser.value(hardwareMultiplierOption).toDouble();
Options::instance.frameCountInterval = parser.value(frameCountInterval).toInt();
+ Options::instance.destroyViewEachRun = parser.isSet(destroyViewOption);
QSize size(parser.value(widthOption).toInt(),
parser.value(heightOption).toInt());
diff --git a/src/options.h b/src/options.h
index 47b83ef..67b2050 100644
--- a/src/options.h
+++ b/src/options.h
@@ -50,6 +50,7 @@ struct Options
, fpsOverride(0)
, windowSize(800, 600)
, hardwareMultiplier(1.0)
+ , destroyViewEachRun(false)
{
}
@@ -70,6 +71,7 @@ struct Options
QSize windowSize;
double hardwareMultiplier;
QList<Benchmark> benchmarks;
+ bool destroyViewEachRun;
static Options instance;
};