Skip to content
Snippets Groups Projects
Commit d975320b authored by Tomi Korpipää's avatar Tomi Korpipää
Browse files

Improve fps logging

Give some time for the newly loaded test to stabilize before
starting the performance measurement.
parent 9c3bc8ca
Branches
No related tags found
No related merge requests found
......@@ -68,12 +68,14 @@ Item {
}
}
source = view;
measureTimer.start();
stabilizationTimer.start();
}
function reset() {
source = null;
measurementLog = "";
function reset(full) {
if (full) {
source = null;
measurementLog = "";
}
maxFrameTime = 0;
minFrameTime = 5000;
maxRenderTime = 0;
......@@ -87,41 +89,58 @@ Item {
}
onFrameTimeChanged: {
if (!measureTimer.running)
return;
maxFrameTime = Math.max(maxFrameTime, frameTime);
minFrameTime = Math.min(minFrameTime, frameTime);
// If this is done in onFpsChanged, average will not be correct
avgFps += fps;
if (fpsUpdates === 0) {
avgFps = fps;
minFps = fps;
maxFps = fps;
} else {
// If this is done in onFpsChanged, average will not be correct
avgFps += fps;
}
++fpsUpdates;
}
onFpsChanged: {
if (!measureTimer.running)
return;
maxFps = Math.max(maxFps, fps);
minFps = Math.min(minFps, fps);
}
onRenderTimeChanged: {
if (!measureTimer.running)
return;
maxRenderTime = Math.max(maxRenderTime, renderTime);
minRenderTime = Math.min(minRenderTime, renderTime);
}
onSyncTimeChanged: {
if (!measureTimer.running)
return;
maxSyncTime = Math.max(maxSyncTime, syncTime);
minSyncTime = Math.min(minSyncTime, syncTime);
}
Timer {
id: stabilizationTimer
interval: 5000
running: false
onTriggered: {
reset();
measureTimer.start();
}
}
Timer {
id: measureTimer
interval: 60000
running: false
onTriggered: {
if (fpsUpdates === 0) {
// Rerun with constant FPS
avgFps = fps;
minFps = fps;
maxFps = fps;
} else {
avgFps /= fpsUpdates;
}
avgFps /= fpsUpdates;
if (testName.length)
measurementLog += "Test Set: " + testName + "\n";
measurementLog += "Screen Size: (" + source.width + "x" + source.height + ")";
......@@ -243,7 +262,7 @@ Item {
logContainer.visible = true;
}
reset();
reset(true);
if (quitAfter)
Qt.callLater(Qt.quit);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment