[10/10] WineX11: add a run-total fps counter to the fps debug channel

Detlef Riekenberg wine.dev at web.de
Tue Aug 26 05:33:30 CDT 2008


On Mo, 2008-08-25 at 09:32 -0500, Stefan Dösinger wrote:
> @@ -3486,15 +3486,19 @@ BOOL X11DRV_SwapBuffers(X11DRV_PDEVICE
> *physDev)
>    /* FPS support */
>    if (TRACE_ON(fps))
>    {
> -      static long prev_time, frames;
> +      static long prev_time, start_time;
> +      static unsigned long frames, frames_total;
>  
>        DWORD time = GetTickCount();
>        frames++;
> +      frames_total++;
>        /* every 1.5 seconds */
>        if (time - prev_time > 1500) {
> -          TRACE_(fps)("@ approx %.2ffps\n", 1000.0*frames/(time -
> prev_time));
> +          TRACE_(fps)("@ approx %.2ffps, total %.2ffps\n",
> +                      1000.0*frames/(time - prev_time),
> 1000.0*frames_total/(time - start_time));
>            prev_time = time;
>            frames = 0;
> +          if(start_time == 0) start_time = time;

The first fps report is not correct
(0 as prev_time is not the time, when the device was created)

Much more Important is the last fps report.
Thiat can be from the actual frame up to 1.5 seconds old.
When a DirectX test run ~10 sec, the last fps line is one second old.
Any change in the Driver, that increase or decrease the needed
test-time between 9 sec and 10.5 sec is not detected.

You need to make the counters globals (or move it in X11DRV_PDEVICE)
and dump a last fps report, when the device is destroyed.

I suggest to rename the variable "time", to make clear what it is and
to avoid a mix-up with time(). Example: "last_swapbuffers_time"

-- 
 
By by ... Detlef





More information about the wine-devel mailing list