[cairo-commit] 2 commits - perf/cairo-perf.c perf/cairo-perf.h perf/cairo-perf-posix.c perf/cairo-perf-win32.c

Carl Worth cworth at kemper.freedesktop.org
Thu Oct 5 15:14:23 PDT 2006


 perf/cairo-perf-posix.c |   26 ++++++++++++++------------
 perf/cairo-perf-win32.c |   24 +++++++++++++-----------
 perf/cairo-perf.c       |    4 ++--
 perf/cairo-perf.h       |    6 +++---
 4 files changed, 32 insertions(+), 28 deletions(-)

New commits:
diff-tree d7c2f7e2d74c7e383f6933b974066221bcc5faa5 (from 8af5e14fd8056408bc46698b7186655ec8e60062)
Author: Carl Worth <cworth at cworth.org>
Date:   Thu Oct 5 15:14:14 2006 -0700

    perf: Rename finalize to synchronize as it is used in both start() and stop() now

diff --git a/perf/cairo-perf-posix.c b/perf/cairo-perf-posix.c
index 9a30c32..68637ef 100644
--- a/perf/cairo-perf-posix.c
+++ b/perf/cairo-perf-posix.c
@@ -121,20 +121,20 @@ typedef struct _cairo_perf_timer
 
 static cairo_perf_timer_t timer;
 
-static cairo_perf_timer_finalize_t cairo_perf_timer_finalize = NULL;
-static void *cairo_perf_timer_finalize_closure = NULL;
+static cairo_perf_timer_synchronize_t cairo_perf_timer_synchronize = NULL;
+static void *cairo_perf_timer_synchronize_closure = NULL;
 void
-cairo_perf_timer_set_finalize (cairo_perf_timer_finalize_t	 finalize,
-			       void				*closure)
+cairo_perf_timer_set_synchronize (cairo_perf_timer_synchronize_t	 synchronize,
+				  void					*closure)
 {
-    cairo_perf_timer_finalize = finalize;
-    cairo_perf_timer_finalize_closure = closure;
+    cairo_perf_timer_synchronize = synchronize;
+    cairo_perf_timer_synchronize_closure = closure;
 }
 
 void
 cairo_perf_timer_start (void) {
-    if (cairo_perf_timer_finalize)
-	cairo_perf_timer_finalize (cairo_perf_timer_finalize_closure);
+    if (cairo_perf_timer_synchronize)
+	cairo_perf_timer_synchronize (cairo_perf_timer_synchronize_closure);
 #ifdef OIL_STAMP
     timer.start = OIL_STAMP ();
 #else
@@ -144,8 +144,8 @@ cairo_perf_timer_start (void) {
 
 void
 cairo_perf_timer_stop (void) {
-    if (cairo_perf_timer_finalize)
-	cairo_perf_timer_finalize (cairo_perf_timer_finalize_closure);
+    if (cairo_perf_timer_synchronize)
+	cairo_perf_timer_synchronize (cairo_perf_timer_synchronize_closure);
 #ifdef OIL_STAMP
     timer.stop = OIL_STAMP ();
 #else
diff --git a/perf/cairo-perf-win32.c b/perf/cairo-perf-win32.c
index a50f734..c63ca75 100644
--- a/perf/cairo-perf-win32.c
+++ b/perf/cairo-perf-win32.c
@@ -42,27 +42,27 @@ typedef struct _cairo_perf_timer
 
 static cairo_perf_timer_t timer;
 
-static cairo_perf_timer_finalize_t cairo_perf_timer_finalize = NULL;
-static void *cairo_perf_timer_finalize_closure = NULL;
+static cairo_perf_timer_synchronize_t cairo_perf_timer_synchronize = NULL;
+static void *cairo_perf_timer_synchronize_closure = NULL;
 void
-cairo_perf_timer_set_finalize (cairo_perf_timer_finalize_t	 finalize,
-			       void				*closure)
+cairo_perf_timer_set_synchronize (cairo_perf_timer_synchronize_t	 synchronize,
+				  void					*closure)
 {
-    cairo_perf_timer_finalize = finalize;
-    cairo_perf_timer_finalize_closure = closure;
+    cairo_perf_timer_synchronize = synchronize;
+    cairo_perf_timer_synchronize_closure = closure;
 }
 
 void
 cairo_perf_timer_start (void) {
-    if (cairo_perf_timer_finalize)
-	cairo_perf_timer_finalize (cairo_perf_timer_finalize_closure);
+    if (cairo_perf_timer_synchronize)
+	cairo_perf_timer_synchronize (cairo_perf_timer_synchronize_closure);
     QueryPerformanceCounter(&timer.start);
 }
 
 void
 cairo_perf_timer_stop (void) {
-    if (cairo_perf_timer_finalize)
-	cairo_perf_timer_finalize (cairo_perf_timer_finalize_closure);
+    if (cairo_perf_timer_synchronize)
+	cairo_perf_timer_synchronize (cairo_perf_timer_synchronize_closure);
     QueryPerformanceCounter(&timer.stop);
 }
 
diff --git a/perf/cairo-perf.c b/perf/cairo-perf.c
index 5b94869..0b856a8 100644
--- a/perf/cairo-perf.c
+++ b/perf/cairo-perf.c
@@ -210,8 +210,8 @@ main (int argc, char *argv[])
 						    perf.size, perf.size,
 						    CAIRO_BOILERPLATE_MODE_PERF,
 						    &target->closure);
-		cairo_perf_timer_set_finalize (target->wait_for_rendering,
-					       target->closure);
+		cairo_perf_timer_set_synchronize (target->wait_for_rendering,
+						  target->closure);
 
 		perf.cr = cairo_create (surface);
 
diff --git a/perf/cairo-perf.h b/perf/cairo-perf.h
index cf3d33d..560ba64 100644
--- a/perf/cairo-perf.h
+++ b/perf/cairo-perf.h
@@ -39,11 +39,11 @@ void
 cairo_perf_timer_stop (void);
 
 typedef void
-(*cairo_perf_timer_finalize_t) (void *closure);
+(*cairo_perf_timer_synchronize_t) (void *closure);
 
 void
-cairo_perf_timer_set_finalize (cairo_perf_timer_finalize_t	 finalize,
-			       void				*closure);
+cairo_perf_timer_set_synchronize (cairo_perf_timer_synchronize_t	 synchronize,
+				  void					*closure);
 
 typedef uint64_t cairo_perf_ticks_t;
 
diff-tree 8af5e14fd8056408bc46698b7186655ec8e60062 (from 5412343a77b7b336886ed763a3518ff4602f27aa)
Author: Carl Worth <cworth at cworth.org>
Date:   Thu Oct 5 15:07:52 2006 -0700

    perf: Do backend synchronization in cairo_perf_timer_start as well as cairo_perf_timer_stop

diff --git a/perf/cairo-perf-posix.c b/perf/cairo-perf-posix.c
index 952ec45..9a30c32 100644
--- a/perf/cairo-perf-posix.c
+++ b/perf/cairo-perf-posix.c
@@ -121,15 +121,6 @@ typedef struct _cairo_perf_timer
 
 static cairo_perf_timer_t timer;
 
-void
-cairo_perf_timer_start (void) {
-#ifdef OIL_STAMP
-    timer.start = OIL_STAMP ();
-#else
-    gettimeofday (&timer.tv_start, NULL);
-#endif
-}
-
 static cairo_perf_timer_finalize_t cairo_perf_timer_finalize = NULL;
 static void *cairo_perf_timer_finalize_closure = NULL;
 void
@@ -141,6 +132,17 @@ cairo_perf_timer_set_finalize (cairo_per
 }
 
 void
+cairo_perf_timer_start (void) {
+    if (cairo_perf_timer_finalize)
+	cairo_perf_timer_finalize (cairo_perf_timer_finalize_closure);
+#ifdef OIL_STAMP
+    timer.start = OIL_STAMP ();
+#else
+    gettimeofday (&timer.tv_start, NULL);
+#endif
+}
+
+void
 cairo_perf_timer_stop (void) {
     if (cairo_perf_timer_finalize)
 	cairo_perf_timer_finalize (cairo_perf_timer_finalize_closure);
diff --git a/perf/cairo-perf-win32.c b/perf/cairo-perf-win32.c
index 157d1b2..a50f734 100644
--- a/perf/cairo-perf-win32.c
+++ b/perf/cairo-perf-win32.c
@@ -42,11 +42,6 @@ typedef struct _cairo_perf_timer
 
 static cairo_perf_timer_t timer;
 
-void
-cairo_perf_timer_start (void) {
-    QueryPerformanceCounter(&timer.start);
-}
-
 static cairo_perf_timer_finalize_t cairo_perf_timer_finalize = NULL;
 static void *cairo_perf_timer_finalize_closure = NULL;
 void
@@ -58,6 +53,13 @@ cairo_perf_timer_set_finalize (cairo_per
 }
 
 void
+cairo_perf_timer_start (void) {
+    if (cairo_perf_timer_finalize)
+	cairo_perf_timer_finalize (cairo_perf_timer_finalize_closure);
+    QueryPerformanceCounter(&timer.start);
+}
+
+void
 cairo_perf_timer_stop (void) {
     if (cairo_perf_timer_finalize)
 	cairo_perf_timer_finalize (cairo_perf_timer_finalize_closure);


More information about the cairo-commit mailing list