From: Steinar H. Gunderson Date: Wed, 8 Jan 2014 20:28:08 +0000 (+0100) Subject: In the demo application, reset the FPS counter every hundred frames. X-Git-Tag: 1.0~96 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=b61cd4cf5535ecfd76d5c923ea7421a8282bf98b In the demo application, reset the FPS counter every hundred frames. Gives much, much better FPS counts for benchmarking. --- diff --git a/demo.cpp b/demo.cpp index 0083f68..cd9fe9f 100644 --- a/demo.cpp +++ b/demo.cpp @@ -303,6 +303,15 @@ int main(int argc, char **argv) printf("%d frames in %.3f seconds = %.1f fps (%.1f ms/frame)\n", frame, elapsed, frame / elapsed, 1e3 * elapsed / frame); + + // Reset every 100 frames, so that local variations in frame times + // (especially for the first few frames, when the shaders are + // compiled etc.) don't make it hard to measure for the entire + // remaining duration of the program. + if (frame == 100) { + frame = 0; + start = now; + } #endif } return 0;