View Single Post
Old 08 December 2018, 00:08   #1
guy lateur
Registered User

guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 47
Posts: 304
Measuring time/frames

I'm trying to check wether I get everything done inside the duration of a frame (ie, in a 50th of a second). Assuming I had a way of measuring time sufficiently accurately, I could measure the time before I 'do my stuff', and then again at the end. Within each frame, I mean.

This is for application in a demo, so the measuring would preferably have as small an influence as possible. I'm using Photon's frame loop, btw, so this is what it would look like:

Code:
;-- main loop start
mainLoop:
waitFrame1:
    btst.b  #0,$dff005          
    bne.s   waitFrame1
    cmp.b   #$2a,VHPOSR
    bne.s   waitFrame1
waitFrame2:
    cmp.b   #$2a,VHPOSR
    beq.s   waitFrame2

;-- frame loop start
    ;TODO: timeStart = current time
    ;do my stuff
    ;TODO: timeStop  = current time
    ;TODO: duration  = timeStop - timeStart
    ;TODO: assert that duration < 20 milliseconds
;-- frame loop end

;-- main loop end
    btst    #CIAB_GAMEPORT0,CIAAPRA ;LMB pressed?
    bne.b   mainLoop
If this is not an option (and I honestly don't think it will be), I could probably measure the duration of the whole mainLoop and count the frames, I guess, and assert the 'mean frame execution duration' is fast enough.

So anyway, does anybody have any other thoughts on how to go about this?
guy lateur is offline  
 
Page generated in 0.04877 seconds with 11 queries