From: Carl Worth Date: Thu, 30 May 2013 21:05:08 +0000 (-0700) Subject: metrics: Collect new timer-query results before report X-Git-Url: https://git.cworth.org/git?p=fips;a=commitdiff_plain;h=502f6bd8e44c3645852c5bdf485ae9f5e2eb245d 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. --- 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 (); + } }