Benchmarking

I did a quick search of the last 400 messages and couldn’t find anything.

How can I setup my program (sdl+opengl) so the frame rate can requested.
and also how to work out the actual frame rate.

The program is a simple opengl rotating cube, with a few modification I
have been playing around with.

sorry if this is too off topic.

  • Kevin Macey

take the time! run your programm and take the time every turn! emh, eeeemh,
yeah, you have to divide the number of frames by the time! if you have 30
farmes and 1 second, you have 30/1 fps! hope it helps> ----- Original Message -----

From: image@visions.co.nz (Kevin)
To: “sdl”
Sent: Tuesday, August 14, 2001 3:44 PM
Subject: [SDL] benchmarking

I did a quick search of the last 400 messages and couldn’t find anything.

How can I setup my program (sdl+opengl) so the frame rate can requested.
and also how to work out the actual frame rate.

The program is a simple opengl rotating cube, with a few modification I
have been playing around with.

sorry if this is too off topic.

  • Kevin Macey

SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

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

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

Awsome… worked great… the function I was using was a little off.
Thanks muchly,

Kevin