From b8c44b81abb7d83fe41e07cae558b30042255b9a Mon Sep 17 00:00:00 2001 From: Aaron Culliney Date: Sun, 18 Jan 2015 11:10:16 -0800 Subject: [PATCH] Simple FPS logging --- src/video/glvideo.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/video/glvideo.c b/src/video/glvideo.c index 4e040433..35cedeef 100644 --- a/src/video/glvideo.c +++ b/src/video/glvideo.c @@ -586,6 +586,23 @@ static void gldriver_shutdown(void) { // #if USE_GLUT static void gldriver_update(int unused) { +#if DEBUG_GL + static uint32_t prevCount = 0; + static uint32_t idleCount = 0; + + idleCount++; + + static struct timespec prev = { 0 }; + struct timespec now; + clock_gettime(CLOCK_MONOTONIC, &now); + + if (now.tv_sec != prev.tv_sec) { + LOG("gldriver_update() : %u", idleCount-prevCount); + prevCount = idleCount; + prev = now; + } +#endif + c_keys_handle_input(-1, 0, 0); glutPostRedisplay(); glutTimerFunc(17, gldriver_update, 0);