summaryrefslogtreecommitdiffstats
path: root/opengl/tests
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-09-08 18:57:42 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-09-08 18:57:42 -0700
commitb1ef9664ada21330249b82611f72a8e10cf607c6 (patch)
tree7c6314ad23f8c7f2325ecb4e38edfbaac82a850c /opengl/tests
parent225bcbbb3cc05a8af13b1d170325faca4fb83991 (diff)
parent879ba138fc8cc4a88d355322a67eaa26f1d57682 (diff)
downloadframeworks_native-b1ef9664ada21330249b82611f72a8e10cf607c6.zip
frameworks_native-b1ef9664ada21330249b82611f72a8e10cf607c6.tar.gz
frameworks_native-b1ef9664ada21330249b82611f72a8e10cf607c6.tar.bz2
Merge "add a fps counter to sanangeles demo" into gingerbread
Diffstat (limited to 'opengl/tests')
-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 06fa0c2..9f80ed4 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;
}