From 502f6bd8e44c3645852c5bdf485ae9f5e2eb245d Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 30 May 2013 14:05:08 -0700 Subject: [PATCH 1/1] metrics: Collect new timer-query results before report The timers from the most-recently-completed frame may not yet be complete, but still, for the most accurate reports, we now collect all available timer values before printing the report. --- metrics.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/metrics.c b/metrics.c index f4c0a21..8d2d644 100644 --- a/metrics.c +++ b/metrics.c @@ -141,18 +141,7 @@ metrics_end_frame (void) frames++; - - if (frames % 60 == 0) { - double fps; - gettimeofday (&tv_now, NULL); - - fps = (double) frames / (tv_now.tv_sec - tv_start.tv_sec + - (tv_now.tv_usec - tv_start.tv_usec) / 1.0e6); - - printf("FPS: %.3f\n", fps); - - print_program_metrics (); - } + gettimeofday (&tv_now, NULL); /* Consume all counters that are ready. */ counter_t *counter = current_context.counter_head; @@ -179,4 +168,15 @@ metrics_end_frame (void) free (counter); counter = current_context.counter_head; } + + if (frames % 60 == 0) { + double fps; + + fps = (double) frames / (tv_now.tv_sec - tv_start.tv_sec + + (tv_now.tv_usec - tv_start.tv_usec) / 1.0e6); + + printf("FPS: %.3f\n", fps); + + print_program_metrics (); + } } -- 2.43.0