PDA

View Full Version : Can anyone tell of way to benchmark the speed..



paomeow
10-26-2001, 04:30 AM
I really don't know if it is right to post it here.
Anyway can anyone please tell me of way to benchmark the speed of my openGL program?

Rob The Bloke
10-26-2001, 06:10 AM
measure the time it takes between each frame (in seconds).

frames per second = 1.0f/(time for frame);

Screaming Lunatic
10-26-2001, 11:16 AM
You'll probably want to average the frame rate over a bunch of frames also.

SL

wassup
10-26-2001, 12:35 PM
If you use Builder, try this:

//somewhere in declarations:
char FPS[50];

//your DrawScene function:
DrawScene()
{
static double old_time=Now(), new_time;
static int counter=0;

//....
//.... here you draw anything you want
//....

counter++;
if (counter==10)
{
new_time=Now();
strcpy(FPS,FloatToStr(10.0/(86400.0*(new_time-old_time))).c_str());
FPS[6]=' ';
FPS[7]='f';
FPS[8]='p';
FPS[9]='s';
FPS[10]=0;
LabelForFPS->Caption=FPS;
old_time=new_time;
counter-=counter;
}
SwapBuffers(ghDC);
} // end of function

This will give you an average fps counted for and every 10 frames and put it (for example) into TLabel. There are some strange operations, but it's necessary and works fine.


[This message has been edited by wassup (edited 10-26-2001).]