diff options
author | Mathias Agopian <mathias@google.com> | 2010-09-08 19:01:37 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-09-08 19:01:37 -0700 |
commit | 7d1588e4e3b37b7f480618e111d78eb102b5ac1e (patch) | |
tree | eed30068eabef368184db5d7854b914a684bf35c /opengl/tests | |
parent | b91d1dc00af9b14f858d083aa78903a9a25664de (diff) | |
parent | b1ef9664ada21330249b82611f72a8e10cf607c6 (diff) | |
download | frameworks_native-7d1588e4e3b37b7f480618e111d78eb102b5ac1e.zip frameworks_native-7d1588e4e3b37b7f480618e111d78eb102b5ac1e.tar.gz frameworks_native-7d1588e4e3b37b7f480618e111d78eb102b5ac1e.tar.bz2 |
am edbb8083: Merge "add a fps counter to sanangeles demo" into gingerbread
Merge commit 'edbb8083a815e9d911f8e659fc5c293543fdf502' into gingerbread-plus-aosp
* commit 'edbb8083a815e9d911f8e659fc5c293543fdf502':
add a fps counter to sanangeles demo
Diffstat (limited to 'opengl/tests')
-rw-r--r-- | opengl/tests/angeles/app-linux.cpp | 27 |
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; } |