Measure frame duration


I know I can measure the FPS by just taking TIME_STAMPS in an “ENTER_FRAME” event. OK!

But if my program is fast enough, this will always give me 30FPS (~33ms), which includes an “idle” time openfl waits if the frame is calculated fast enough.
Can I somehow measure how long the frame really took without this idle time?


Currently the only way I can think of is to explicitly measure the time taken to run between two points in your program. For example if you are manually updating many objects using a loop, check the timestamp using ‘Lib.getTimer()’ before and after the loop, then subtract the two time to get a duration. If you are doing this for optimization, doing it manually will help you find which part of your code is running too slow.