From: Carl Worth Date: Fri, 1 Nov 2013 17:42:38 +0000 (-0700) Subject: Tiny refactoring of metrics_end_frame interface X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=38cac4f60ed2d37cb90dc6018d90600edf5ba8eb;p=fips Tiny refactoring of metrics_end_frame interface 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. --- diff --git a/eglwrap.c b/eglwrap.c index 913532e..ef927f7 100644 --- 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; } diff --git a/glxwrap.c b/glxwrap.c index 4b87642..4523c90 100644 --- 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 diff --git a/metrics.c b/metrics.c index 79aeb6d..d751ce2 100644 --- 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); }