summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2010-09-08 19:04:07 -0700
committer Android Git Automerger <android-git-automerger@android.com> 2010-09-08 19:04:07 -0700
commite3372bd6f055991e95c044f0bb3a424fe4eb9302 (patch)
tree4cfd9282d64381824c5a94eae093595468bff55a
parentb34cd448333cee0a2b8d732385edd729f5185a96 (diff)
parent7d1588e4e3b37b7f480618e111d78eb102b5ac1e (diff)
am 099aa9a1: am edbb8083: Merge "add a fps counter to sanangeles demo" into gingerbread
Merge commit '099aa9a1b4eaf6536decbcafac43476c4908ef24' * commit '099aa9a1b4eaf6536decbcafac43476c4908ef24': add a fps counter to sanangeles demo
-rw-r--r--opengl/tests/angeles/app-linux.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/opengl/tests/angeles/app-linux.cpp b/opengl/tests/angeles/app-linux.cpp
index 06fa0c2bd7..9f80ed4442 100644
--- a/opengl/tests/angeles/app-linux.cpp
+++ b/opengl/tests/angeles/app-linux.cpp
@@ -190,24 +190,33 @@ int main(int argc, char *argv[])
}
appInit();
+
+ struct timeval timeTemp;
+ int frameCount = 0;
+ gettimeofday(&timeTemp, NULL);
+ double totalTime = timeTemp.tv_usec/1000000.0 + timeTemp.tv_sec;
while (gAppAlive)
{
struct timeval timeNow;
- if (gAppAlive)
- {
- gettimeofday(&timeNow, NULL);
- appRender(timeNow.tv_sec * 1000 + timeNow.tv_usec / 1000,
- sWindowWidth, sWindowHeight);
- checkGLErrors();
- eglSwapBuffers(sEglDisplay, sEglSurface);
- checkEGLErrors();
- }
+ gettimeofday(&timeNow, NULL);
+ appRender(timeNow.tv_sec * 1000 + timeNow.tv_usec / 1000,
+ sWindowWidth, sWindowHeight);
+ checkGLErrors();
+ eglSwapBuffers(sEglDisplay, sEglSurface);
+ checkEGLErrors();
+ frameCount++;
}
+ gettimeofday(&timeTemp, NULL);
+
appDeinit();
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;
}