[SDL] benchmarking

Damien Mascré damienmascre at free.fr
Wed Aug 15 00:58:00 PDT 2001


Put this in your code :

int frame_rate_drawn_frames = 0;
int frame_rate_last_time = 0;
int frame_rate = 0; 

and call this function every frame :

void compute_frame_rate(void)
{

    int elapsed;
    int this_tick_count = SDL_GetTicks();

    frame_rate_drawn_frames++;
    elapsed = this_tick_count - frame_rate_last_time;

    if( elapsed > 1000 )
    {
        frame_rate = (frame_rate_drawn_frames * 1000) / elapsed;
        frame_rate_last_time = this_tick_count;
        frame_rate_drawn_frames = 0;
    }

}


Le 15 Aug 2001 16:01:57 +1200, Kevin a écrit :
> I'm doing something very similar, but still getting bizzard results. 
> I'll play round with
> it a bit more after I wake up a bit.
> 
> Could someone possible point me to a site the goes into detail about 
> benchmarking
> algorithms... if such a site exsists.
> 
> - kevin
> 
> 
> 
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
> 





More information about the SDL mailing list