]> git.cworth.org Git - fips/commitdiff
Tiny refactoring of metrics_end_frame interface
authorCarl Worth <cworth@cworth.org>
Fri, 1 Nov 2013 17:42:38 +0000 (10:42 -0700)
committerCarl Worth <cworth@cworth.org>
Mon, 11 Nov 2013 18:31:42 +0000 (10:31 -0800)
Previously, the callers were stopping and starting the counter outside
of the call to metrics_end_frame. There's less code duplication and
more robustness by moving the counter stop and counter start into the
metrics_end_frame function itself.

eglwrap.c
glxwrap.c
metrics.c

index 913532ef023df21c7b6765a82f25649a7f0de237..ef927f72dec9fc8474b31e9167454acf7e6a3e70 100644 (file)
--- a/eglwrap.c
+++ b/eglwrap.c
@@ -80,12 +80,8 @@ eglSwapBuffers (EGLDisplay dpy, EGLSurface surface)
 
        EGLWRAP_DEFER_WITH_RETURN (ret, eglSwapBuffers, dpy, surface);
 
-       context_counter_stop ();
-
        context_end_frame ();
 
-       context_counter_start ();
-
        return ret;
 }
 
index 4b87642e08846612d8d3f2ce1739e39db7373cb8..4523c90588f2dd709926061e677460e43696ecfa 100644 (file)
--- a/glxwrap.c
+++ b/glxwrap.c
@@ -37,11 +37,7 @@ glXSwapBuffers (Display *dpy, GLXDrawable drawable)
 {
        GLWRAP_DEFER (glXSwapBuffers, dpy, drawable);
 
-       context_counter_stop ();
-
        context_end_frame ();
-
-       context_counter_start ();
 }
 
 /* glXGetProcAddressARB is a function which accepts a string and
index 79aeb6dacaec55c331fd92af3007daae1d4ebfe2..d751ce20f6fd146dd050085abe3234e0e296a6fa 100644 (file)
--- a/metrics.c
+++ b/metrics.c
@@ -782,6 +782,9 @@ metrics_end_frame (metrics_t *metrics)
        static int initialized = 0;
        static struct timeval tv_start, tv_now;
 
+       /* Don't leave any counters running over work we do here. */
+       metrics_counter_stop (metrics);
+
        if (! initialized) {
                gettimeofday (&tv_start, NULL);
                if (getenv ("FIPS_VERBOSE"))
@@ -805,4 +808,7 @@ metrics_end_frame (metrics_t *metrics)
 
                print_program_metrics (metrics);
        }
+
+       /* Start the counter up again now that we're done. */
+       metrics_counter_start (metrics);
 }