Page 1 of 1

How do I get framerate/timing without LibGS?

Posted: November 19th, 2019, 5:34 pm
by ArthCarvalho
I want to check how my code is performing on the real hardware, but I have no idea how to get the current framerate, or anything else that I could use to profile my code.
LibGS had GsGetVcount() but I have no idea how to implement this by myself.

Re: How do I get framerate/timing without LibGS?

Posted: February 23rd, 2020, 1:21 pm
by MrQuetch
ArthCarvalho wrote: November 19th, 2019, 5:34 pm I want to check how my code is performing on the real hardware, but I have no idea how to get the current framerate, or anything else that I could use to profile my code.
LibGS had GsGetVcount() but I have no idea how to implement this by myself.
I was wondering how one could get a 'time' from whence the console started. This honestly would suffice for now. Well, looking at LIBREF46.PDF, the 'GsGetVcount' function returns a long. You could try using a 'printf' statement in your game-loop to see the current value of the vertical retrace. I tried this, and it worked perfectly:

printf("GsGetVcount: %d \n", GsGetVcount());

Unless, this isn't what you meant by 'having no idea how to implement this yourself'? I imagine you could have a variable (like 'currentFrame') and another one (like 'previousFrame') and subtract one from the other to see how many vertical retraces took place between the two. I'm certain you could get a good set of averages that way.