]> git.cworth.org Git - fips/commitdiff
metrics: Collect new timer-query results before report
authorCarl Worth <cworth@cworth.org>
Thu, 30 May 2013 21:05:08 +0000 (14:05 -0700)
committerCarl Worth <cworth@cworth.org>
Thu, 30 May 2013 21:05:08 +0000 (14:05 -0700)
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

index f4c0a2150f05b2092031a17907da231631b09bd4..8d2d6444beae601b9de93eea5d503a91729321c0 100644 (file)
--- 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 ();
+       }
 }