This code will declare global function BenchmarkFPS()
. When called it will record frame duration statistics over next 5 seconds after skipping half a second. Duration and skip interval can be overridden if passed as optional parameters (in milliseconds).
Sample output:
Jul 04 12:34:56.789 ------------------------------------------------------------
Mean FPS is 62.50 measured in 281 frames
with mean frame time 16.00ms, standard deviation of 0.70ms (0.25%)
99% of all frames took between 15.89ms and 16.11ms to render
------------------------------------------------------------