summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2017-01-26 11:23:28 +0200
committerJari Vetoniemi <mailroxas@gmail.com>2017-01-26 11:23:56 +0200
commit55cbb2f5965361a7c47899340a12d3b38599f811 (patch)
tree342fd9e9a860726e7f70a4d5721afd100a2509a7
parentc5d9fb4ce9947c3628fcbefd934c2de0b8395677 (diff)
Output calculated FPS in 5 second intervals
-rw-r--r--glcapture.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/glcapture.c b/glcapture.c
index 5ac6836..5344215 100644
--- a/glcapture.c
+++ b/glcapture.c
@@ -508,11 +508,16 @@ draw_indicator(const GLint view[4])
static void
swap_buffers(void)
{
- static __thread uint64_t last_time;
+ static __thread uint64_t last_time, fps_time;
const uint64_t ts = get_time_ns();
const uint32_t fps = (last_time > 0 ? 1.0 / ((ts - last_time) / 1e9) : TARGET_FPS);
last_time = ts;
+ if ((ts - fps_time) / 1e9 > 5.0) {
+ WARNX("FPS: %u", fps);
+ fps_time = ts;
+ }
+
void* (*procs[])(const char*) = {
(void*)_eglGetProcAddress,
(void*)_glXGetProcAddressARB,