Need help in understanding ComputeFPS() method how cuda does this.

Hi,
I am a cuda/opengL newbie. I want to get a holistic view of how this function works. I need some help in understanding the sample codes in the SDK relating to the computeFPS() method. There’s been not much documentation on some of the functions (at least nothing comes up worth reading when I google it)

Here is the code from the SobelFilter.cpp example in SDK.

some useful info:
frameCount and fpsCount has been initialized to 0.
fpsLimit=1 at the top of the code.
the computeFPS() will be called at the end of the display callback of openGL.

Question 1: what is CheckRender? and its purpose? haven’t found anything on google explaining it. Even on the OpenGL reference Manual.
Question 2: How does this method really compute the Frames per second?

[font=“Courier New”]
void computeFPS()
{
frameCount++;
fpsCount++;
if (fpsCount == fpsLimit-1) {
g_Verify = true;
}
if (fpsCount == fpsLimit) {
char fps[256];
float ifps = 1.f / (cutGetAverageTimerValue(timer) / 1000.f);
sprintf(fps, “%s Cuda Edge Detection (%s): %3.1f fps”,
((g_CheckRender && g_CheckRender->IsQAReadback()) ? “AutoTest:” : “”),
filterMode[g_SobelDisplayMode], ifps);

    glutSetWindowTitle(fps);
    fpsCount = 0; 
    if (g_CheckRender && !g_CheckRender->IsQAReadback()) fpsLimit = (int)MAX(ifps, 1.f);

    cutilCheckError(cutResetTimer(timer));  
    AutoQATest();
}

}[/font]

Thanks!!