DEBUGTIMERS patch for unificatrion
#1
I did update my DEBUGTIMERS patch (which helped me debugging that VSync issue) to the current unification codebase. But I'm unsure if I should suggest adding it into the official codebase. This is mainly for zico and Kp, but other users' opinions are welcome, too.

The current version of this patch can be found at https://github.com/derhass/dxx-rebirth/t...ebugtimers.

This is now enabled via the debugtimers compile time option, so normal builds are totally unaffected. When build with that option, there is a slight runtime overhead (which is probably completely neglectable). Only if the -debugtimers <filename> switch is used, the timings per frame are actually gathered and written to that file. The data is buffered in memory, the -debugtimers-size <n> switch controls how many frames are buffered (default: 10000, takes just a few MB of RAM).

The code also uses GL_ARB_timer_query feature if available to get timings from the GPU as well as to detect the latency og the GPU. I extended the ogl_extension mechanism I created for the syncgl patch to load the new extension function pointers.

I also added a timedemo-like feature. When the measurement is enabled,
average, minimum and maximum frame times are collected whenever one is in the real game (including demos). When the game episode ends (menu is opened, level ends, demo ends), the stats are written to the console:

Code:
STATS: 307 fr, CPU: 16.644ms/4.350ms/20.279ms GPU: 16.605ms/4.110ms/25.038ms lat: 6.129ms/3.424ms/15.643ms

What's still missing: Mac Support. To achieve maximum precision, the patch does not use SDL's timer, but the native clock_gettime() (on Linux) or QueryPerformanceCounter (on Windows) APIs. I don't know what is available on Mac. Currently, the code just checks for windows or everything else. I also could make a fallback to SDL's timers for all other platforms.

So what do you guys think? Should I try to get this stuff added to the official code base?
"Perfection is attained not when there is nothing more to add, but when there is nothing more to remove." -- Antoine de Saint Exupéry
Reply
#2
Since regular builds are unaffected, I have no objection to adding this.  It could be useful to have in case we get more reports of strange GPU timing events, and merging it to the main codebase would reduce the chance that it bitrots.  I see a few cleanups that could be done, but those can be handled later.
Reply
#3
(04-07-2015, 01:41 AM)Kp link Wrote:Since regular builds are unaffected, I have no objection to adding this.  It could be useful to have in case we get more reports of strange GPU timing events

Yeah, maybe this is of some use to someone else.

The main reason why I updated this to the current unification code base is that I want to look at the renderer anyway. So this is primarily for myself.

(04-07-2015, 01:41 AM)Kp link Wrote:and merging it to the main codebase would reduce the chance that it bitrots

Well, that will probably not change much, as it is disabled in default builds...

(04-07-2015, 01:41 AM)Kp link Wrote:I see a few cleanups that could be done, but those can be handled later.

Please, bring them up. There is no problem if I fix those first. As the hack it was intented to be, it is good enough already. But if we plan to actually merge this, I'm going to invest some more time to clean it up.

"Perfection is attained not when there is nothing more to add, but when there is nothing more to remove." -- Antoine de Saint Exupéry
Reply
#4
I agree with kp. Your debugtimers were very helpful in solving that issue with VSync and I can imagine they might come in handy in the future. I'd love to have them in the unification code.
The greatest pleasure in life is to do what people say you cannot do.
Uhm... Honey, there's a head in the toilet!
Reply
#5
@Kp: OK, maybe you can comment on github on the parts which you're not happy with?
"Perfection is attained not when there is nothing more to add, but when there is nothing more to remove." -- Antoine de Saint Exupéry
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)