Merge "add a fps counter to sanangeles demo" into gingerbread
This commit is contained in:
committed by
Android (Google) Code Review
commit
edbb8083a8
@@ -190,24 +190,33 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
appInit();
|
appInit();
|
||||||
|
|
||||||
|
struct timeval timeTemp;
|
||||||
|
int frameCount = 0;
|
||||||
|
gettimeofday(&timeTemp, NULL);
|
||||||
|
double totalTime = timeTemp.tv_usec/1000000.0 + timeTemp.tv_sec;
|
||||||
|
|
||||||
while (gAppAlive)
|
while (gAppAlive)
|
||||||
{
|
{
|
||||||
struct timeval timeNow;
|
struct timeval timeNow;
|
||||||
|
|
||||||
if (gAppAlive)
|
gettimeofday(&timeNow, NULL);
|
||||||
{
|
appRender(timeNow.tv_sec * 1000 + timeNow.tv_usec / 1000,
|
||||||
gettimeofday(&timeNow, NULL);
|
sWindowWidth, sWindowHeight);
|
||||||
appRender(timeNow.tv_sec * 1000 + timeNow.tv_usec / 1000,
|
checkGLErrors();
|
||||||
sWindowWidth, sWindowHeight);
|
eglSwapBuffers(sEglDisplay, sEglSurface);
|
||||||
checkGLErrors();
|
checkEGLErrors();
|
||||||
eglSwapBuffers(sEglDisplay, sEglSurface);
|
frameCount++;
|
||||||
checkEGLErrors();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gettimeofday(&timeTemp, NULL);
|
||||||
|
|
||||||
appDeinit();
|
appDeinit();
|
||||||
deinitGraphics();
|
deinitGraphics();
|
||||||
|
|
||||||
|
totalTime = (timeTemp.tv_usec/1000000.0 + timeTemp.tv_sec) - totalTime;
|
||||||
|
printf("totalTime=%f s, frameCount=%d, %.2f fps\n",
|
||||||
|
totalTime, frameCount, frameCount/totalTime);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user