I wonder if someone(s) can confirm whether this following program is correct to assess the frames-per-second framerate of a given loop (heavily commented for your delectation)..... I used to go by knowing what the refresh rate of the display is (e.g. 50Hz and doing the math in comparison to that benchmark, but this needs to be htz independent). Millisecs() is 1000ths of a second right?
'Is this a correct program to read the frames per second? ..........:
Local counter:Int=MilliSecs() 'Store current MilliSecs() reading
Local passage:Int=0 'Initialize passage of time since last frame
Local m:Int=0 'Initialize temporary variable for math
Local fps:Int=0 'Initialize frames per sercond result variable
Repeat 'keep going
'
'do Max2D graphics processing stuff here
'
m=MilliSecs() ' Get the current MilliSecs() so that the number is consistent
passage=m-counter 'Passage of time since the last iteration of the loop
fps=1000/passage 'Fps is 1000 (millisecs) / millisecs since last loop?
counter=m ' Store current reading for next time
SetRotation 0 'Undo rotation settings from earlier in the graphics stuff
SetScale 1,1 'Undo scale from earlier too
DrawText fps+"fps",0,0 'So that this text draws right - the framerate
Flip ' Flip the backbuffer into view
Until KeyHit(KEY_ESCAPE) 'keep going until escape key hit
'Is this a correct program to read the frames per second? ..........:
Local counter:Int=MilliSecs() 'Store current MilliSecs() reading
Local passage:Int=0 'Initialize passage of time since last frame
Local m:Int=0 'Initialize temporary variable for math
Local fps:Int=0 'Initialize frames per sercond result variable
Repeat 'keep going
'
'do Max2D graphics processing stuff here
'
m=MilliSecs() ' Get the current MilliSecs() so that the number is consistent
passage=m-counter 'Passage of time since the last iteration of the loop
fps=1000/passage 'Fps is 1000 (millisecs) / millisecs since last loop?
counter=m ' Store current reading for next time
SetRotation 0 'Undo rotation settings from earlier in the graphics stuff
SetScale 1,1 'Undo scale from earlier too
DrawText fps+"fps",0,0 'So that this text draws right - the framerate
Flip ' Flip the backbuffer into view
Until KeyHit(KEY_ESCAPE) 'keep going until escape key hit