How to calculate the Frames per second manually with small piece of code

Hi All,

I am beginner in openGL.

I want to calculate the Frames per second (FPS) manually with a small piece of code.I want this to check the performance of the graphic card.

I used the performance tools like glmark2 and got the FPS values but the glmark2 itself will use its own video/bmp files for getting the FPS results.In my case I want to use my own video/bmp files and want to calcuate the FPS values.

As of now I am using ubuntu 12.10 OS.

Please share your ideas in getting the FPS value manually.

Thanks and Regards
krishna N

What have you tried?

This is fairly simple. Just take snapshots of a high resolution timer after your glXSwapBuffers() call, subtract to get frame time (in seconds), invert to get 1/seconds (frames per second).