[cairo-commit] 13 commits - build/configure.ac.system configure.ac perf/cairo-analyse-trace.c perf/cairo-perf.c perf/cairo-perf.h perf/cairo-perf-micro.c perf/cairo-perf-os2.c perf/cairo-perf-posix.c perf/cairo-perf-report.c perf/cairo-perf-trace.c perf/cairo-perf-win32.c perf/cairo-stats.c perf/cairo-stats.h perf/Makefile.am perf/Makefile.sources perf/micro perf/README src/cairoint.h src/cairo-quartz-font.c src/cairo-quartz-surface.c src/cairo-script-private.h src/cairo-surface.c src/cairo-surface-observer.c src/cairo-surface-observer-private.h src/cairo-time.c src/cairo-time-private.h src/cairo-wideint.c src/cairo-wideint-private.h src/cairo-win32-font.c src/cairo-win32-printing-surface.c src/cairo-win32-surface.c src/Makefile.sources test/cairo-test-trace.c test/Makefile.am util/cairo-missing util/Makefile.am

Andrea Canciani ranma42 at kemper.freedesktop.org
Fri Sep 2 04:09:41 PDT 2011


 build/configure.ac.system            |    9 -
 configure.ac                         |    3 
 perf/Makefile.am                     |    7 
 perf/Makefile.sources                |    7 
 perf/README                          |    6 
 perf/cairo-analyse-trace.c           |   52 -------
 perf/cairo-perf-micro.c              |   22 +-
 perf/cairo-perf-os2.c                |   99 -------------
 perf/cairo-perf-posix.c              |  257 -----------------------------------
 perf/cairo-perf-report.c             |   75 ----------
 perf/cairo-perf-trace.c              |  102 +++----------
 perf/cairo-perf-win32.c              |   93 ------------
 perf/cairo-perf.c                    |   95 ++++++++++++
 perf/cairo-perf.h                    |   18 --
 perf/cairo-stats.c                   |   53 ++-----
 perf/cairo-stats.h                   |    6 
 perf/micro/box-outline.c             |    4 
 perf/micro/composite-checker.c       |    2 
 perf/micro/curve.c                   |    4 
 perf/micro/disjoint.c                |    2 
 perf/micro/dragon.c                  |   18 +-
 perf/micro/fill.c                    |    6 
 perf/micro/glyphs.c                  |    4 
 perf/micro/hash-table.c              |    9 -
 perf/micro/hatching.c                |   16 +-
 perf/micro/intersections.c           |   12 -
 perf/micro/line.c                    |   30 ++--
 perf/micro/long-dashed-lines.c       |    2 
 perf/micro/long-lines.c              |   10 -
 perf/micro/many-curves.c             |    8 -
 perf/micro/many-fills.c              |   10 -
 perf/micro/many-strokes.c            |   10 -
 perf/micro/mask.c                    |   18 +-
 perf/micro/mosaic.c                  |   10 -
 perf/micro/paint-with-alpha.c        |    2 
 perf/micro/paint.c                   |    2 
 perf/micro/pattern_create_radial.c   |    2 
 perf/micro/pythagoras-tree.c         |    2 
 perf/micro/rectangles.c              |    6 
 perf/micro/rounded-rectangles.c      |    6 
 perf/micro/spiral.c                  |   34 ++--
 perf/micro/stroke.c                  |    4 
 perf/micro/subimage_copy.c           |    2 
 perf/micro/tessellate.c              |    8 -
 perf/micro/text.c                    |    2 
 perf/micro/twin.c                    |    2 
 perf/micro/unaligned-clip.c          |    2 
 perf/micro/wave.c                    |    2 
 perf/micro/wide-fills.c              |   10 -
 perf/micro/wide-strokes.c            |   10 -
 perf/micro/world-map.c               |    8 -
 perf/micro/zrusin.c                  |    4 
 src/Makefile.sources                 |    2 
 src/cairo-quartz-font.c              |    1 
 src/cairo-quartz-surface.c           |    1 
 src/cairo-script-private.h           |    2 
 src/cairo-surface-observer-private.h |   13 -
 src/cairo-surface-observer.c         |  170 ++++++++++-------------
 src/cairo-surface.c                  |    2 
 src/cairo-time-private.h             |   93 ++++++++++++
 src/cairo-time.c                     |  215 +++++++++++++++++++++++++++++
 src/cairo-wideint-private.h          |   12 +
 src/cairo-wideint.c                  |   16 ++
 src/cairo-win32-font.c               |    1 
 src/cairo-win32-printing-surface.c   |    1 
 src/cairo-win32-surface.c            |    1 
 src/cairoint.h                       |    2 
 test/Makefile.am                     |    6 
 test/cairo-test-trace.c              |   47 ------
 util/Makefile.am                     |    2 
 util/cairo-missing/Makefile.am       |   10 +
 util/cairo-missing/Makefile.sources  |    8 +
 util/cairo-missing/Makefile.win32    |   10 +
 util/cairo-missing/cairo-missing.h   |   49 ++++++
 util/cairo-missing/getline.c         |   89 ++++++++++++
 util/cairo-missing/strndup.c         |   54 +++++++
 76 files changed, 988 insertions(+), 1006 deletions(-)

New commits:
commit 1bcc27985fe76a674ea5b8a24b1bad544390b301
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Fri Sep 2 12:51:10 2011 +0200

    perf: Fix win32 build
    
    Microsoft C Compiler complains about:
    
    hash-table.c(44) : error C2466: cannot allocate an array of constant
    size 0
    
    Adding an unused element makes it happy.

diff --git a/perf/micro/hash-table.c b/perf/micro/hash-table.c
index dc8975d..a026638 100644
--- a/perf/micro/hash-table.c
+++ b/perf/micro/hash-table.c
@@ -41,7 +41,12 @@
 static cairo_time_t
 do_hash_table (cairo_t *cr, int width, int height, int loops)
 {
-    cairo_scaled_font_t *active_fonts[ACTIVE_FONTS];
+    /*
+     * Microsoft C Compiler complains that:
+     * error C2466: cannot allocate an array of constant size 0
+     * so we add an unused element to make it happy
+     */
+    cairo_scaled_font_t *active_fonts[ACTIVE_FONTS + 1];
     cairo_matrix_t m;
     int i;
 
commit b1a1dfcdcfb865a4867541f91897f7dda556d206
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Fri Sep 2 12:34:04 2011 +0200

    win32: Fix linking
    
    round() is not available on win32 and causes the linking to fail with:
    
    cairo-surface-observer.obj : error LNK2019: unresolved external symbol
    round referenced in function percent

diff --git a/src/cairo-surface-observer.c b/src/cairo-surface-observer.c
index a0dcb2f..65f6585 100644
--- a/src/cairo-surface-observer.c
+++ b/src/cairo-surface-observer.c
@@ -1603,7 +1603,8 @@ print_record (cairo_output_stream_t *stream,
 static double percent (cairo_time_t a, cairo_time_t b)
 {
     /* Fake %.1f */
-    return round (_cairo_time_to_s (a) * 1000 / _cairo_time_to_s (b)) / 10;
+    return _cairo_round (_cairo_time_to_s (a) * 1000 /
+			 _cairo_time_to_s (b)) / 10;
 }
 
 static cairo_bool_t
commit 04a7bad9237a1e0f2887328860ba29695ad32199
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Fri Sep 2 12:25:48 2011 +0200

    surface: Fix make check
    
    cairo_surface_map_to_image() and cairo_surface_unmap_image() are
    called by cairo-surface-observer but they are not slim_hidden:
    
    Checking .libs/libcairo.so for local PLT entries
    00000000002e27a8  0000019d00000007 R_X86_64_JUMP_SLOT
         000000000005df30 cairo_surface_unmap_image + 0
    00000000002e2b90  0000026100000007 R_X86_64_JUMP_SLOT
         000000000005f5c0 cairo_surface_map_to_image + 0

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index c325c8a..d15b94b 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -666,6 +666,7 @@ cairo_surface_map_to_image (cairo_surface_t  *surface,
 
     return image;
 }
+slim_hidden_def (cairo_surface_map_to_image);
 
 /**
  * cairo_surface_unmap_image:
@@ -750,6 +751,7 @@ error:
     if (status)
 	_cairo_surface_set_error (surface, status);
 }
+slim_hidden_def (cairo_surface_unmap_image);
 
 cairo_surface_t *
 _cairo_surface_create_similar_solid (cairo_surface_t	 *other,
diff --git a/src/cairoint.h b/src/cairoint.h
index 51beec2..df2071b 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -2427,6 +2427,7 @@ slim_hidden_proto (cairo_surface_get_font_options);
 slim_hidden_proto (cairo_surface_get_mime_data);
 slim_hidden_proto (cairo_surface_get_type);
 slim_hidden_proto (cairo_surface_has_show_text_glyphs);
+slim_hidden_proto (cairo_surface_map_to_image);
 slim_hidden_proto (cairo_surface_mark_dirty);
 slim_hidden_proto (cairo_surface_mark_dirty_rectangle);
 slim_hidden_proto_no_warn (cairo_surface_reference);
@@ -2435,6 +2436,7 @@ slim_hidden_proto (cairo_surface_set_fallback_resolution);
 slim_hidden_proto (cairo_surface_set_mime_data);
 slim_hidden_proto (cairo_surface_show_page);
 slim_hidden_proto (cairo_surface_status);
+slim_hidden_proto (cairo_surface_unmap_image);
 slim_hidden_proto (cairo_text_cluster_allocate);
 slim_hidden_proto (cairo_text_cluster_free);
 slim_hidden_proto (cairo_toy_font_face_create);
commit 14fab8f84a18aca57d0426944b161fe85cc51444
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Fri Sep 2 12:25:02 2011 +0200

    script: Fix make check
    
    make check fails because cairo-script-private.h cannot be compiled
    standalone:
    
    ./cairo-script-private.h:45:1: error: unknown type name ‘cairo_private’
    ...
    
    ./cairo-script-private.h:48:40: error: unknown type name ‘cairo_output_stream_t’

diff --git a/src/cairo-script-private.h b/src/cairo-script-private.h
index 6a94fd8..698a54e 100644
--- a/src/cairo-script-private.h
+++ b/src/cairo-script-private.h
@@ -38,6 +38,8 @@
 
 #include "cairo.h"
 
+#include "cairo-compiler-private.h"
+#include "cairo-output-stream-private.h"
 #include "cairo-script.h"
 
 CAIRO_BEGIN_DECLS
commit 297aa4d4a0a007461f998588e80b9fbde1718876
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Wed Aug 31 17:08:27 2011 +0200

    perf: Fix readme
    
    The README in perf/ was not updated when cairo-perf.c was renamed to
    cairo-perf-micro.c

diff --git a/perf/README b/perf/README
index 8fcb430..42a6148 100644
--- a/perf/README
+++ b/perf/README
@@ -214,8 +214,8 @@ added:
  2. cairo-perf.h: Add a new CAIRO_PERF_DECL line with the name of your
     function, (my_new_test in the example above)
 
- 3. cairo-perf.c: Add a new row to the list at the end of the file. A
-    typical entry would look like:
+ 3. cairo-perf-micro.c: Add a new row to the list at the end of the
+    file. A typical entry would look like:
 
 	{ my_new_test, 16, 64 }
 
commit dcd3e2cde13dcf56c3281911c98b2356b41ae877
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Wed Aug 31 17:03:33 2011 +0200

    perf: Get rid of cairo_perf_ticks_per_second()
    
    The cairo_time_from_s() and cairo_time_to_s() functions should be used
    instead.

diff --git a/perf/cairo-perf-micro.c b/perf/cairo-perf-micro.c
index 959bfbc..096986b 100644
--- a/perf/cairo-perf-micro.c
+++ b/perf/cairo-perf-micro.c
@@ -135,7 +135,7 @@ cairo_perf_calibrate (cairo_perf_t	*perf,
     calibration = perf_func (perf->cr, perf->size, perf->size, min_loops);
 
     if (!perf->fast_and_sloppy) {
-	calibration_max = perf->ms_per_iteration * 0.0001 / 4 * cairo_perf_ticks_per_second ();
+	calibration_max = _cairo_time_from_s (perf->ms_per_iteration * 0.0001 / 4);
 	while (calibration < calibration_max) {
 	    min_loops *= 2;
 	    calibration = perf_func (perf->cr, perf->size, perf->size, min_loops);
@@ -153,7 +153,7 @@ cairo_perf_calibrate (cairo_perf_t	*perf,
      * a more rigorous analysis of the synchronisation overhead,
      * that is to estimate the time for loop=0.
      */
-    loops = perf->ms_per_iteration * 0.001 * cairo_perf_ticks_per_second () * min_loops / calibration;
+    loops = _cairo_time_from_s (perf->ms_per_iteration * 0.001 * min_loops / calibration);
     min_loops = perf->fast_and_sloppy ? 1 : 10;
     if (loops < min_loops)
 	loops = min_loops;
@@ -262,7 +262,7 @@ cairo_perf_run (cairo_perf_t	   *perf,
 			    perf->target->name,
 			    _content_to_string (perf->target->content, similar),
 			    name, perf->size,
-			    cairo_perf_ticks_per_second () / 1000.0);
+			    _cairo_time_to_double (_cairo_time_from_s (1.)) / 1000.);
 		printf (" %lld", (long long) times[i]);
 	    } else if (! perf->exact_iterations) {
 		if (i > 0) {
@@ -289,16 +289,16 @@ cairo_perf_run (cairo_perf_t	   *perf,
 		fprintf (perf->summary,
 			 "%10lld %#8.3f %#8.3f %#5.2f%% %3d: %.2f\n",
 			 (long long) stats.min_ticks,
-			 (stats.min_ticks * 1000.0) / cairo_perf_ticks_per_second (),
-			 (stats.median_ticks * 1000.0) / cairo_perf_ticks_per_second (),
+			 _cairo_time_to_s (stats.min_ticks) * 1000.0,
+			 _cairo_time_to_s (stats.median_ticks) * 1000.0,
 			 stats.std_dev * 100.0, stats.iterations,
-			 count * cairo_perf_ticks_per_second () / stats.min_ticks);
+			 count / _cairo_time_to_s (stats.min_ticks));
 	    } else {
 		fprintf (perf->summary,
 			 "%10lld %#8.3f %#8.3f %#5.2f%% %3d\n",
 			 (long long) stats.min_ticks,
-			 (stats.min_ticks * 1000.0) / cairo_perf_ticks_per_second (),
-			 (stats.median_ticks * 1000.0) / cairo_perf_ticks_per_second (),
+			 _cairo_time_to_s (stats.min_ticks) * 1000.0,
+			 _cairo_time_to_s (stats.median_ticks) * 1000.0,
 			 stats.std_dev * 100.0, stats.iterations);
 	    }
 	    fflush (perf->summary);
diff --git a/perf/cairo-perf-trace.c b/perf/cairo-perf-trace.c
index d4ed30d..3a9b822 100644
--- a/perf/cairo-perf-trace.c
+++ b/perf/cairo-perf-trace.c
@@ -653,12 +653,12 @@ cairo_perf_trace (cairo_perf_t			   *perf,
 
 	if (perf->observe) {
 	    cairo_device_t *observer = cairo_surface_get_device (args.surface);
-	    times[i] = cairo_device_observer_elapsed (observer) * (1e-9 * cairo_perf_ticks_per_second ());
-	    paint[i] = cairo_device_observer_paint_elapsed (observer) * (1e-9 * cairo_perf_ticks_per_second ());
-	    mask[i] = cairo_device_observer_mask_elapsed (observer) * (1e-9 * cairo_perf_ticks_per_second ());
-	    stroke[i] = cairo_device_observer_stroke_elapsed (observer) * (1e-9 * cairo_perf_ticks_per_second ());
-	    fill[i] = cairo_device_observer_fill_elapsed (observer) * (1e-9 * cairo_perf_ticks_per_second ());
-	    glyphs[i] = cairo_device_observer_glyphs_elapsed (observer) * (1e-9 * cairo_perf_ticks_per_second ());
+	    times[i] = _cairo_time_from_s (1.e9 * cairo_device_observer_elapsed (observer));
+	    paint[i] = _cairo_time_from_s (1.e9 * cairo_device_observer_paint_elapsed (observer));
+	    mask[i] = _cairo_time_from_s (1.e9 * cairo_device_observer_mask_elapsed (observer));
+	    stroke[i] = _cairo_time_from_s (1.e9 * cairo_device_observer_stroke_elapsed (observer));
+	    fill[i] = _cairo_time_from_s (1.e9 * cairo_device_observer_fill_elapsed (observer));
+	    glyphs[i] = _cairo_time_from_s (1.e9 * cairo_device_observer_glyphs_elapsed (observer));
 	} else {
 	    clear_surface (args.surface); /* queue a write to the sync'ed surface */
 	    cairo_perf_timer_stop ();
@@ -692,7 +692,7 @@ cairo_perf_trace (cairo_perf_t			   *perf,
 			"rgba",
 			name,
 			0,
-			cairo_perf_ticks_per_second () / 1000.0);
+			_cairo_time_to_double (_cairo_time_from_s (1)) / 1000.);
 	    printf (" %lld", (long long) times[i]);
 	    fflush (stdout);
 	} else if (! perf->exact_iterations) {
@@ -718,35 +718,35 @@ cairo_perf_trace (cairo_perf_t			   *perf,
 		     name);
 	    if (perf->observe) {
 		fprintf (perf->summary,
-			 " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+			 " %#9.3f", _cairo_time_to_s (stats.median_ticks));
 
 		_cairo_stats_compute (&stats, paint, i+1);
 		fprintf (perf->summary,
-			 " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+			 " %#9.3f", _cairo_time_to_s (stats.median_ticks));
 
 		_cairo_stats_compute (&stats, mask, i+1);
 		fprintf (perf->summary,
-			 " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+			 " %#9.3f", _cairo_time_to_s (stats.median_ticks));
 
 		_cairo_stats_compute (&stats, fill, i+1);
 		fprintf (perf->summary,
-			 " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+			 " %#9.3f", _cairo_time_to_s (stats.median_ticks));
 
 		_cairo_stats_compute (&stats, stroke, i+1);
 		fprintf (perf->summary,
-			 " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+			 " %#9.3f", _cairo_time_to_s (stats.median_ticks));
 
 		_cairo_stats_compute (&stats, glyphs, i+1);
 		fprintf (perf->summary,
-			 " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+			 " %#9.3f", _cairo_time_to_s (stats.median_ticks));
 
 		fprintf (perf->summary,
 			 " %5d", i+1);
 	    } else {
 		fprintf (perf->summary,
 			 "%#8.3f %#8.3f %#6.2f%% %4d/%d",
-			 (double) stats.min_ticks / cairo_perf_ticks_per_second (),
-			 (double) stats.median_ticks / cairo_perf_ticks_per_second (),
+			 _cairo_time_to_s (stats.min_ticks),
+			 _cairo_time_to_s (stats.median_ticks),
 			 stats.std_dev * 100.0,
 			 stats.iterations, i+1);
 	    }
@@ -766,35 +766,35 @@ cairo_perf_trace (cairo_perf_t			   *perf,
 	}
 	if (perf->observe) {
 	    fprintf (perf->summary,
-		     " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+		     " %#9.3f", _cairo_time_to_s (stats.median_ticks));
 
 	    _cairo_stats_compute (&stats, paint, i+1);
 	    fprintf (perf->summary,
-		     " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+		     " %#9.3f", _cairo_time_to_s (stats.median_ticks));
 
 	    _cairo_stats_compute (&stats, mask, i+1);
 	    fprintf (perf->summary,
-		     " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+		     " %#9.3f", _cairo_time_to_s (stats.median_ticks));
 
 	    _cairo_stats_compute (&stats, fill, i+1);
 	    fprintf (perf->summary,
-		     " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+		     " %#9.3f", _cairo_time_to_s (stats.median_ticks));
 
 	    _cairo_stats_compute (&stats, stroke, i+1);
 	    fprintf (perf->summary,
-		     " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+		     " %#9.3f", _cairo_time_to_s (stats.median_ticks));
 
 	    _cairo_stats_compute (&stats, glyphs, i+1);
 	    fprintf (perf->summary,
-		     " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+		     " %#9.3f", _cairo_time_to_s (stats.median_ticks));
 
 	    fprintf (perf->summary,
 		     " %5d\n", i+1);
 	} else {
 	    fprintf (perf->summary,
 		     "%#8.3f %#8.3f %#6.2f%% %4d/%d\n",
-		     (double) stats.min_ticks / cairo_perf_ticks_per_second (),
-		     (double) stats.median_ticks / cairo_perf_ticks_per_second (),
+		     _cairo_time_to_s (stats.min_ticks),
+		     _cairo_time_to_s (stats.median_ticks),
 		     stats.std_dev * 100.0,
 		     stats.iterations, i);
 	}
diff --git a/perf/cairo-perf.c b/perf/cairo-perf.c
index 1a60bdc..7f2ff5b 100644
--- a/perf/cairo-perf.c
+++ b/perf/cairo-perf.c
@@ -78,12 +78,6 @@ cairo_perf_timer_elapsed (void)
     return timer;
 }
 
-cairo_time_t
-cairo_perf_ticks_per_second (void)
-{
-    return _cairo_time_from_s (1.);
-}
-
 void
 cairo_perf_yield (void)
 {
diff --git a/perf/cairo-perf.h b/perf/cairo-perf.h
index 5facc8a..11c03f7 100644
--- a/perf/cairo-perf.h
+++ b/perf/cairo-perf.h
@@ -58,9 +58,6 @@ cairo_perf_timer_set_synchronize (cairo_perf_timer_synchronize_t  synchronize,
 cairo_time_t
 cairo_perf_timer_elapsed (void);
 
-cairo_time_t
-cairo_perf_ticks_per_second (void);
-
 /* yield */
 
 void
commit 9172e2aec0bfd7ac9ae464726bc79ace2d4d7113
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Wed Aug 31 17:55:07 2011 +0200

    perf: Drop cairo_perf_ticks_t in favor of cairo_time_t
    
    cairo_time_t offers a superset of the functions provided by
    cairo_perf_ticks_t.

diff --git a/perf/README b/perf/README
index b142e59..8fcb430 100644
--- a/perf/README
+++ b/perf/README
@@ -166,7 +166,7 @@ Here is the basic structure of a performance test file:
 
     #include "cairo-perf.h"
 
-    static cairo_perf_ticks_t
+    static cairo_time_t
     do_my_new_test (cairo_t *cr, int width, int height)
     {
 	cairo_perf_timer_start ();
diff --git a/perf/cairo-perf-micro.c b/perf/cairo-perf-micro.c
index 0f5f64e..959bfbc 100644
--- a/perf/cairo-perf-micro.c
+++ b/perf/cairo-perf-micro.c
@@ -128,7 +128,7 @@ static unsigned
 cairo_perf_calibrate (cairo_perf_t	*perf,
 		      cairo_perf_func_t  perf_func)
 {
-    cairo_perf_ticks_t calibration, calibration_max;
+    cairo_time_t calibration, calibration_max;
     unsigned loops, min_loops;
 
     min_loops = 1;
@@ -169,7 +169,7 @@ cairo_perf_run (cairo_perf_t	   *perf,
 {
     static cairo_bool_t first_run = TRUE;
     unsigned int i, similar, has_similar;
-    cairo_perf_ticks_t *times;
+    cairo_time_t *times;
     cairo_stats_t stats = {0.0, 0.0};
     int low_std_dev_count;
 
@@ -477,7 +477,7 @@ main (int   argc,
     }
 
     perf.targets = cairo_boilerplate_get_targets (&perf.num_targets, NULL);
-    perf.times = xmalloc (perf.iterations * sizeof (cairo_perf_ticks_t));
+    perf.times = xmalloc (perf.iterations * sizeof (cairo_time_t));
 
     for (i = 0; i < perf.num_targets; i++) {
 	const cairo_boilerplate_target_t *target = perf.targets[i];
diff --git a/perf/cairo-perf-report.c b/perf/cairo-perf-report.c
index 01ddeb1..ffcd90a 100644
--- a/perf/cairo-perf-report.c
+++ b/perf/cairo-perf-report.c
@@ -169,13 +169,13 @@ test_report_parse (test_report_t *report,
 	skip_space ();
 
 	report->samples_size = 5;
-	report->samples = xmalloc (report->samples_size * sizeof (cairo_perf_ticks_t));
+	report->samples = xmalloc (report->samples_size * sizeof (cairo_time_t));
 	report->stats.min_ticks = 0;
 	do {
 	    if (report->samples_count == report->samples_size) {
 		report->samples_size *= 2;
 		report->samples = xrealloc (report->samples,
-					    report->samples_size * sizeof (cairo_perf_ticks_t));
+					    report->samples_size * sizeof (cairo_time_t));
 	    }
 	    parse_long_long (report->samples[report->samples_count]);
 	    if (report->samples_count == 0) {
@@ -358,11 +358,11 @@ cairo_perf_report_sort_and_compute_stats (cairo_perf_report_t *report,
 		if (new_samples_count > base->samples_size) {
 		    base->samples_size = new_samples_count;
 		    base->samples = xrealloc (base->samples,
-					      base->samples_size * sizeof (cairo_perf_ticks_t));
+					      base->samples_size * sizeof (cairo_time_t));
 		}
 		for (t = base + 1; t < next; t++) {
 		    memcpy (&base->samples[base->samples_count], t->samples,
-			    t->samples_count * sizeof (cairo_perf_ticks_t));
+			    t->samples_count * sizeof (cairo_time_t));
 		    base->samples_count += t->samples_count;
 		}
 	    }
diff --git a/perf/cairo-perf-trace.c b/perf/cairo-perf-trace.c
index 3319917..d4ed30d 100644
--- a/perf/cairo-perf-trace.c
+++ b/perf/cairo-perf-trace.c
@@ -544,7 +544,7 @@ cairo_perf_trace (cairo_perf_t			   *perf,
 {
     static cairo_bool_t first_run = TRUE;
     unsigned int i;
-    cairo_perf_ticks_t *times, *paint, *mask, *fill, *stroke, *glyphs;
+    cairo_time_t *times, *paint, *mask, *fill, *stroke, *glyphs;
     cairo_stats_t stats = {0.0, 0.0};
     struct trace args = { target };
     int low_std_dev_count;
@@ -902,7 +902,7 @@ main (int   argc,
 	trace_dir = getenv ("CAIRO_TRACE_DIR");
 
     perf.targets = cairo_boilerplate_get_targets (&perf.num_targets, NULL);
-    perf.times = xmalloc (6 * perf.iterations * sizeof (cairo_perf_ticks_t));
+    perf.times = xmalloc (6 * perf.iterations * sizeof (cairo_time_t));
 
     /* do we have a list of filenames? */
     perf.exact_names = have_trace_filenames (&perf);
diff --git a/perf/cairo-perf.h b/perf/cairo-perf.h
index df5e141..5facc8a 100644
--- a/perf/cairo-perf.h
+++ b/perf/cairo-perf.h
@@ -32,11 +32,9 @@
 #include "../src/cairo-time-private.h"
 #include <stdio.h>
 
-typedef cairo_time_t cairo_perf_ticks_t;
-
 typedef struct _cairo_stats {
-    cairo_perf_ticks_t min_ticks;
-    cairo_perf_ticks_t median_ticks;
+    cairo_time_t min_ticks;
+    cairo_time_t median_ticks;
     double ticks_per_ms;
     double std_dev;
     int iterations;
@@ -57,10 +55,10 @@ void
 cairo_perf_timer_set_synchronize (cairo_perf_timer_synchronize_t  synchronize,
 				  void				 *closure);
 
-cairo_perf_ticks_t
+cairo_time_t
 cairo_perf_timer_elapsed (void);
 
-cairo_perf_ticks_t
+cairo_time_t
 cairo_perf_ticks_per_second (void);
 
 /* yield */
@@ -89,7 +87,7 @@ typedef struct _cairo_perf {
     cairo_bool_t fast_and_sloppy;
 
     /* Stuff used internally */
-    cairo_perf_ticks_t *times;
+    cairo_time_t *times;
     const cairo_boilerplate_target_t **targets;
     int num_targets;
     const cairo_boilerplate_target_t *target;
@@ -99,7 +97,7 @@ typedef struct _cairo_perf {
     cairo_t *cr;
 } cairo_perf_t;
 
-typedef cairo_perf_ticks_t
+typedef cairo_time_t
 (*cairo_perf_func_t) (cairo_t *cr, int width, int height, int loops);
 
 typedef double
@@ -133,7 +131,7 @@ typedef struct _test_report {
     int size;
 
     /* The samples only exists for "raw" reports */
-    cairo_perf_ticks_t *samples;
+    cairo_time_t *samples;
     unsigned int samples_size;
     unsigned int samples_count;
 
diff --git a/perf/cairo-stats.c b/perf/cairo-stats.c
index 5273c60..e088e19 100644
--- a/perf/cairo-stats.c
+++ b/perf/cairo-stats.c
@@ -26,9 +26,9 @@
 #include "cairo-stats.h"
 
 void
-_cairo_stats_compute (cairo_stats_t	 *stats,
-		      cairo_perf_ticks_t *values,
-		      int		  num_values)
+_cairo_stats_compute (cairo_stats_t *stats,
+		      cairo_time_t  *values,
+		      int	     num_values)
 {
     int i;
     cairo_time_t sumtime;
@@ -46,8 +46,7 @@ _cairo_stats_compute (cairo_stats_t	 *stats,
      * and third quartiles and IQR is the inter-quartile range (Q3 -
      * Q1).
      */
-    qsort (values, num_values,
-	   sizeof (cairo_perf_ticks_t), _cairo_time_cmp);
+    qsort (values, num_values, sizeof (cairo_time_t), _cairo_time_cmp);
 
     q1 = _cairo_time_to_s (values[(1*num_values)/4]);
     q3 = _cairo_time_to_s (values[(3*num_values)/4]);
diff --git a/perf/cairo-stats.h b/perf/cairo-stats.h
index 5b5b064..8406e65 100644
--- a/perf/cairo-stats.h
+++ b/perf/cairo-stats.h
@@ -29,8 +29,8 @@
 #include "cairo-perf.h"
 
 void
-_cairo_stats_compute (cairo_stats_t	 *stats,
-		      cairo_perf_ticks_t *values,
-		      int		  num_values);
+_cairo_stats_compute (cairo_stats_t *stats,
+		      cairo_time_t  *values,
+		      int	     num_values);
 
 #endif /* _CAIRO_STATS_H_ */
diff --git a/perf/micro/box-outline.c b/perf/micro/box-outline.c
index fe0719f..a0c47f7 100644
--- a/perf/micro/box-outline.c
+++ b/perf/micro/box-outline.c
@@ -40,7 +40,7 @@
  * for the xlib backend and 16x slower for the image backend.
  */
 
-static cairo_perf_ticks_t
+static cairo_time_t
 box_outline_stroke (cairo_t *cr, int width, int height, int loops)
 {
     cairo_set_source_rgb (cr, 0, 0, 1); /* blue */
@@ -64,7 +64,7 @@ box_outline_stroke (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 box_outline_fill (cairo_t *cr, int width, int height, int loops)
 {
     cairo_set_source_rgb (cr, 0, 0, 1); /* blue */
diff --git a/perf/micro/composite-checker.c b/perf/micro/composite-checker.c
index 27dc364..0d7af0c 100644
--- a/perf/micro/composite-checker.c
+++ b/perf/micro/composite-checker.c
@@ -47,7 +47,7 @@
 static cairo_pattern_t *checkerboard = NULL;
 static cairo_pattern_t *src_pattern = NULL;
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_composite_checker (cairo_t *cr,
                       int      width,
                       int      height,
diff --git a/perf/micro/curve.c b/perf/micro/curve.c
index 8ff58db..7def326 100644
--- a/perf/micro/curve.c
+++ b/perf/micro/curve.c
@@ -38,7 +38,7 @@ uniform_random (double minval, double maxval)
     return minval + state * (maxval - minval) / 4294967296.0;
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_curve_stroke (cairo_t *cr, int width, int height, int loops)
 {
     state = 0xc0ffee;
@@ -62,7 +62,7 @@ do_curve_stroke (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_curve_fill (cairo_t *cr, int width, int height, int loops)
 {
     state = 0xc0ffee;
diff --git a/perf/micro/disjoint.c b/perf/micro/disjoint.c
index 98b9e8e..d7f5026 100644
--- a/perf/micro/disjoint.c
+++ b/perf/micro/disjoint.c
@@ -62,7 +62,7 @@ static void clip (cairo_t *cr, int width, int height)
     cairo_clip (cr);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw (cairo_t *cr, int width, int height, int loops)
 {
     cairo_save (cr);
diff --git a/perf/micro/dragon.c b/perf/micro/dragon.c
index cd5ad9b..5bc8d26 100644
--- a/perf/micro/dragon.c
+++ b/perf/micro/dragon.c
@@ -94,7 +94,7 @@ path (cairo_t *cr, int step, int dir, int iterations)
     }
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_dragon (cairo_t *cr, int width, int height, int loops)
 {
     cairo_pattern_t *pattern;
@@ -161,7 +161,7 @@ do_dragon (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_dragon_solid (cairo_t *cr, int width, int height, int loops)
 {
     double cx, cy;
@@ -202,14 +202,14 @@ do_dragon_solid (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_dragon_solid_unaligned (cairo_t *cr, int width, int height, int loops)
 {
     cairo_translate (cr, 0.01, 0.01);
     return do_dragon_solid (cr, width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_dragon_solid_aligned_clip (cairo_t *cr, int width, int height, int loops)
 {
     cairo_reset_clip (cr);
@@ -220,7 +220,7 @@ do_dragon_solid_aligned_clip (cairo_t *cr, int width, int height, int loops)
     return do_dragon_solid (cr, width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_dragon_unaligned_solid_aligned_clip (cairo_t *cr, int width, int height, int loops)
 {
     cairo_translate (cr, 0.01, 0.01);
@@ -232,7 +232,7 @@ do_dragon_unaligned_solid_aligned_clip (cairo_t *cr, int width, int height, int
     return do_dragon_solid (cr, width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_dragon_solid_unaligned_clip (cairo_t *cr, int width, int height, int loops)
 {
     cairo_reset_clip (cr);
@@ -243,7 +243,7 @@ do_dragon_solid_unaligned_clip (cairo_t *cr, int width, int height, int loops)
     return do_dragon_solid (cr, width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_dragon_unaligned_solid_unaligned_clip (cairo_t *cr, int width, int height, int loops)
 {
     cairo_translate (cr, 0.01, 0.01);
@@ -255,7 +255,7 @@ do_dragon_unaligned_solid_unaligned_clip (cairo_t *cr, int width, int height, in
     return do_dragon_solid (cr, width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_dragon_solid_circle_clip (cairo_t *cr, int width, int height, int loops)
 {
     cairo_reset_clip (cr);
diff --git a/perf/micro/fill.c b/perf/micro/fill.c
index a11298f..0795227 100644
--- a/perf/micro/fill.c
+++ b/perf/micro/fill.c
@@ -25,7 +25,7 @@
 
 #include "cairo-perf.h"
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_fill (cairo_t *cr, int width, int height, int loops)
 {
     cairo_arc (cr,
@@ -45,7 +45,7 @@ do_fill (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_fill_annuli (cairo_t *cr, int width, int height, int loops)
 {
     cairo_new_sub_path (cr);
@@ -84,7 +84,7 @@ do_fill_annuli (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_fill_eo_noaa (cairo_t *cr, int width, int height, int loops)
 {
     cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
diff --git a/perf/micro/glyphs.c b/perf/micro/glyphs.c
index ae70a8e..74c67ee 100644
--- a/perf/micro/glyphs.c
+++ b/perf/micro/glyphs.c
@@ -27,7 +27,7 @@
 
 #include "cairo-perf.h"
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_glyphs (double font_size,
 	   cairo_antialias_t antialias,
 	   cairo_t *cr, int width, int height, int loops)
@@ -142,7 +142,7 @@ count_glyphs (double font_size,
 }
 
 #define DECL(name,size, aa) \
-static cairo_perf_ticks_t \
+static cairo_time_t \
 do_glyphs##name (cairo_t *cr, int width, int height, int loops) \
 { \
     return do_glyphs (size, aa, cr, width, height, loops); \
diff --git a/perf/micro/hash-table.c b/perf/micro/hash-table.c
index 79978f5..dc8975d 100644
--- a/perf/micro/hash-table.c
+++ b/perf/micro/hash-table.c
@@ -38,7 +38,7 @@
  * show the O(n) behavior.
  */
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_hash_table (cairo_t *cr, int width, int height, int loops)
 {
     cairo_scaled_font_t *active_fonts[ACTIVE_FONTS];
diff --git a/perf/micro/hatching.c b/perf/micro/hatching.c
index 2098ab3..e31d301 100644
--- a/perf/micro/hatching.c
+++ b/perf/micro/hatching.c
@@ -80,7 +80,7 @@ static void clip_alpha (cairo_t *cr)
     cairo_paint_with_alpha (cr, .5);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw (cairo_t *cr,
       void (*prepare) (cairo_t *cr),
       void (*transform) (cairo_t *cr, int width, int height),
@@ -109,42 +109,42 @@ draw (cairo_t *cr,
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_aligned_aa (cairo_t *cr, int width, int height, int loops)
 {
     return draw(cr, aa, aligned, cairo_fill,
 		width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_misaligned_aa (cairo_t *cr, int width, int height, int loops)
 {
     return draw(cr, aa, misaligned, cairo_fill,
 		width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_rotated_aa (cairo_t *cr, int width, int height, int loops)
 {
     return draw(cr, aa, rotated, cairo_fill,
 		width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_aligned_mono (cairo_t *cr, int width, int height, int loops)
 {
     return draw(cr, mono, aligned, cairo_fill,
 		width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_misaligned_mono (cairo_t *cr, int width, int height, int loops)
 {
     return draw(cr, mono, misaligned, cairo_fill,
 		width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_rotated_mono (cairo_t *cr, int width, int height, int loops)
 {
     return draw(cr, mono, rotated, cairo_fill,
@@ -152,7 +152,7 @@ draw_rotated_mono (cairo_t *cr, int width, int height, int loops)
 }
 
 #define F(name, op,transform,aa) \
-static cairo_perf_ticks_t \
+static cairo_time_t \
 draw_##name (cairo_t *cr, int width, int height, int loops) \
 { return draw(cr, (aa), (transform), (op), width, height, loops); }
 
diff --git a/perf/micro/intersections.c b/perf/micro/intersections.c
index 8f55165..9a81eee 100644
--- a/perf/micro/intersections.c
+++ b/perf/micro/intersections.c
@@ -39,7 +39,7 @@ uniform_random (double minval, double maxval)
     return minval + state * (maxval - minval) / 4294967296.0;
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_random (cairo_t *cr, cairo_fill_rule_t fill_rule,
 	     int width, int height, int loops)
 {
@@ -77,7 +77,7 @@ draw_random (cairo_t *cr, cairo_fill_rule_t fill_rule,
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_random_curve (cairo_t *cr, cairo_fill_rule_t fill_rule,
 		   int width, int height, int loops)
 {
@@ -119,25 +119,25 @@ draw_random_curve (cairo_t *cr, cairo_fill_rule_t fill_rule,
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 random_eo (cairo_t *cr, int width, int height, int loops)
 {
     return draw_random (cr, CAIRO_FILL_RULE_EVEN_ODD, width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 random_nz (cairo_t *cr, int width, int height, int loops)
 {
     return draw_random (cr, CAIRO_FILL_RULE_WINDING, width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 random_curve_eo (cairo_t *cr, int width, int height, int loops)
 {
     return draw_random_curve (cr, CAIRO_FILL_RULE_EVEN_ODD, width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 random_curve_nz (cairo_t *cr, int width, int height, int loops)
 {
     return draw_random_curve (cr, CAIRO_FILL_RULE_WINDING, width, height, loops);
diff --git a/perf/micro/line.c b/perf/micro/line.c
index 6249d9c..7ba9f90 100644
--- a/perf/micro/line.c
+++ b/perf/micro/line.c
@@ -26,7 +26,7 @@
 
 #include "cairo-perf.h"
 
-static cairo_perf_ticks_t
+static cairo_time_t
 horizontal (cairo_t *cr, int width, int height, int loops)
 {
     double h = height/2 + .5;
@@ -46,21 +46,21 @@ horizontal (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 horizontal_hair (cairo_t *cr, int width, int height, int loops)
 {
     cairo_set_line_width (cr, 1.);
     return horizontal (cr, width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 horizontal_wide (cairo_t *cr, int width, int height, int loops)
 {
     cairo_set_line_width (cr, 5.);
     return horizontal (cr, width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 nearly_horizontal (cairo_t *cr, int width, int height, int loops)
 {
     double h = height/2;
@@ -80,14 +80,14 @@ nearly_horizontal (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 nearly_horizontal_hair (cairo_t *cr, int width, int height, int loops)
 {
     cairo_set_line_width (cr, 1.);
     return nearly_horizontal (cr, width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 nearly_horizontal_wide (cairo_t *cr, int width, int height, int loops)
 {
     cairo_set_line_width (cr, 5.);
@@ -95,7 +95,7 @@ nearly_horizontal_wide (cairo_t *cr, int width, int height, int loops)
 }
 
 
-static cairo_perf_ticks_t
+static cairo_time_t
 vertical (cairo_t *cr, int width, int height, int loops)
 {
     double w = width/2 + .5;
@@ -115,21 +115,21 @@ vertical (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 vertical_hair (cairo_t *cr, int width, int height, int loops)
 {
     cairo_set_line_width (cr, 1.);
     return vertical (cr, width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 vertical_wide (cairo_t *cr, int width, int height, int loops)
 {
     cairo_set_line_width (cr, 5.);
     return vertical (cr, width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 nearly_vertical (cairo_t *cr, int width, int height, int loops)
 {
     double w = width/2;
@@ -149,14 +149,14 @@ nearly_vertical (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 nearly_vertical_hair (cairo_t *cr, int width, int height, int loops)
 {
     cairo_set_line_width (cr, 1.);
     return nearly_vertical (cr, width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 nearly_vertical_wide (cairo_t *cr, int width, int height, int loops)
 {
     cairo_set_line_width (cr, 5.);
@@ -164,7 +164,7 @@ nearly_vertical_wide (cairo_t *cr, int width, int height, int loops)
 }
 
 
-static cairo_perf_ticks_t
+static cairo_time_t
 diagonal (cairo_t *cr, int width, int height, int loops)
 {
     cairo_move_to (cr, 0, 0);
@@ -182,14 +182,14 @@ diagonal (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 diagonal_hair (cairo_t *cr, int width, int height, int loops)
 {
     cairo_set_line_width (cr, 1.);
     return diagonal (cr, width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 diagonal_wide (cairo_t *cr, int width, int height, int loops)
 {
     cairo_set_line_width (cr, 5.);
diff --git a/perf/micro/long-dashed-lines.c b/perf/micro/long-dashed-lines.c
index 74de158..fa99b20 100644
--- a/perf/micro/long-dashed-lines.c
+++ b/perf/micro/long-dashed-lines.c
@@ -27,7 +27,7 @@
 
 #include "cairo-perf.h"
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_long_dashed_lines (cairo_t *cr, int width, int height, int loops)
 {
     double dash[2] = { 2.0, 2.0 };
diff --git a/perf/micro/long-lines.c b/perf/micro/long-lines.c
index 577f17c..b3a9458 100644
--- a/perf/micro/long-lines.c
+++ b/perf/micro/long-lines.c
@@ -42,7 +42,7 @@ typedef enum {
 #define NUM_LINES    20
 #define LONG_FACTOR  50.0
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_long_lines (cairo_t *cr, int width, int height, int loops, long_lines_crop_t crop)
 {
     int i;
@@ -108,25 +108,25 @@ do_long_lines (cairo_t *cr, int width, int height, int loops, long_lines_crop_t
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 long_lines_uncropped (cairo_t *cr, int width, int height, int loops)
 {
     return do_long_lines (cr, width, height, loops, 0);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 long_lines_uncropped_once (cairo_t *cr, int width, int height, int loops)
 {
     return do_long_lines (cr, width, height, loops, LONG_LINES_ONCE);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 long_lines_cropped (cairo_t *cr, int width, int height, int loops)
 {
     return do_long_lines (cr, width, height, loops, LONG_LINES_CROPPED);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 long_lines_cropped_once (cairo_t *cr, int width, int height, int loops)
 {
     return do_long_lines (cr, width, height, loops, LONG_LINES_CROPPED | LONG_LINES_ONCE);
diff --git a/perf/micro/many-curves.c b/perf/micro/many-curves.c
index b44fd13..dc7cdf9 100644
--- a/perf/micro/many-curves.c
+++ b/perf/micro/many-curves.c
@@ -38,7 +38,7 @@ uniform_random (double minval, double maxval)
     return minval + state * (maxval - minval) / 4294967296.0;
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_many_curves_stroked (cairo_t *cr, int width, int height, int loops)
 {
     int count;
@@ -67,21 +67,21 @@ do_many_curves_stroked (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_many_curves_hair_stroked (cairo_t *cr, int width, int height, int loops)
 {
     cairo_set_line_width (cr, 1.);
     return do_many_curves_stroked (cr, width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_many_curves_wide_stroked (cairo_t *cr, int width, int height, int loops)
 {
     cairo_set_line_width (cr, 5.);
     return do_many_curves_stroked (cr, width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_many_curves_filled (cairo_t *cr, int width, int height, int loops)
 {
     int count;
diff --git a/perf/micro/many-fills.c b/perf/micro/many-fills.c
index c52e1bf..eb56e8b 100644
--- a/perf/micro/many-fills.c
+++ b/perf/micro/many-fills.c
@@ -45,7 +45,7 @@ uniform_random (double minval, double maxval)
     return minval + state * (maxval - minval) / 4294967296.0;
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_many_fills_ha (cairo_t *cr, int width, int height, int loops)
 {
     int count;
@@ -69,7 +69,7 @@ do_many_fills_ha (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_many_fills_h (cairo_t *cr, int width, int height, int loops)
 {
     int count;
@@ -93,7 +93,7 @@ do_many_fills_h (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_many_fills_va (cairo_t *cr, int width, int height, int loops)
 {
     int count;
@@ -117,7 +117,7 @@ do_many_fills_va (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_many_fills_v (cairo_t *cr, int width, int height, int loops)
 {
     int count;
@@ -141,7 +141,7 @@ do_many_fills_v (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_many_fills (cairo_t *cr, int width, int height, int loops)
 {
     int count;
diff --git a/perf/micro/many-strokes.c b/perf/micro/many-strokes.c
index 8ef1876..f033945 100644
--- a/perf/micro/many-strokes.c
+++ b/perf/micro/many-strokes.c
@@ -38,7 +38,7 @@ uniform_random (double minval, double maxval)
     return minval + state * (maxval - minval) / 4294967296.0;
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_many_strokes_ha (cairo_t *cr, int width, int height, int loops)
 {
     int count;
@@ -64,7 +64,7 @@ do_many_strokes_ha (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_many_strokes_h (cairo_t *cr, int width, int height, int loops)
 {
     int count;
@@ -90,7 +90,7 @@ do_many_strokes_h (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_many_strokes_va (cairo_t *cr, int width, int height, int loops)
 {
     int count;
@@ -116,7 +116,7 @@ do_many_strokes_va (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_many_strokes_v (cairo_t *cr, int width, int height, int loops)
 {
     int count;
@@ -142,7 +142,7 @@ do_many_strokes_v (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_many_strokes (cairo_t *cr, int width, int height, int loops)
 {
     int count;
diff --git a/perf/micro/mask.c b/perf/micro/mask.c
index 840d43f..79092e8 100644
--- a/perf/micro/mask.c
+++ b/perf/micro/mask.c
@@ -27,7 +27,7 @@
 
 #include "cairo-perf.h"
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_mask_solid (cairo_t *cr, int width, int height, int loops)
 {
     cairo_pattern_t *mask;
@@ -70,7 +70,7 @@ init_surface (cairo_surface_t *surface, int width, int height)
     return surface;
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_mask_image (cairo_t *cr, int width, int height, int loops)
 {
     cairo_surface_t *surface;
@@ -94,7 +94,7 @@ do_mask_image (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_mask_image_half (cairo_t *cr, int width, int height, int loops)
 {
     cairo_surface_t *surface;
@@ -121,7 +121,7 @@ do_mask_image_half (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_mask_image_double (cairo_t *cr, int width, int height, int loops)
 {
     cairo_surface_t *surface;
@@ -148,7 +148,7 @@ do_mask_image_double (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_mask_similar (cairo_t *cr, int width, int height, int loops)
 {
     cairo_surface_t *surface;
@@ -173,7 +173,7 @@ do_mask_similar (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_mask_similar_half (cairo_t *cr, int width, int height, int loops)
 {
     cairo_surface_t *surface;
@@ -201,7 +201,7 @@ do_mask_similar_half (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_mask_similar_double (cairo_t *cr, int width, int height, int loops)
 {
     cairo_surface_t *surface;
@@ -229,7 +229,7 @@ do_mask_similar_double (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_mask_linear (cairo_t *cr, int width, int height, int loops)
 {
     cairo_pattern_t *mask;
@@ -250,7 +250,7 @@ do_mask_linear (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_mask_radial (cairo_t *cr, int width, int height, int loops)
 {
     cairo_pattern_t *mask;
diff --git a/perf/micro/mosaic.c b/perf/micro/mosaic.c
index a63166c..d76b840 100644
--- a/perf/micro/mosaic.c
+++ b/perf/micro/mosaic.c
@@ -92,7 +92,7 @@ mosaic_next_path (cairo_t *cr, struct mosaic_region_iter *iter)
     return 1;
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 mosaic_perform(cairo_t *cr, unsigned flags, int width, int height, int loops)
 {
     struct mosaic_region_iter iter;
@@ -136,25 +136,25 @@ mosaic_perform(cairo_t *cr, unsigned flags, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 mosaic_fill_curves (cairo_t *cr, int width, int height, int loops)
 {
     return mosaic_perform (cr, MOSAIC_FILL | MOSAIC_CURVE_TO, width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 mosaic_fill_lines (cairo_t *cr, int width, int height, int loops)
 {
     return mosaic_perform (cr, MOSAIC_FILL | MOSAIC_LINE_TO, width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 mosaic_tessellate_lines (cairo_t *cr, int width, int height, int loops)
 {
     return mosaic_perform (cr, MOSAIC_TESSELLATE | MOSAIC_LINE_TO, width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 mosaic_tessellate_curves (cairo_t *cr, int width, int height, int loops)
 {
     return mosaic_perform (cr, MOSAIC_TESSELLATE | MOSAIC_CURVE_TO, width, height, loops);
diff --git a/perf/micro/paint-with-alpha.c b/perf/micro/paint-with-alpha.c
index 051d653..3c1f69e 100644
--- a/perf/micro/paint-with-alpha.c
+++ b/perf/micro/paint-with-alpha.c
@@ -25,7 +25,7 @@
 
 #include "cairo-perf.h"
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_paint_with_alpha (cairo_t *cr, int width, int height, int loops)
 {
     cairo_perf_timer_start ();
diff --git a/perf/micro/paint.c b/perf/micro/paint.c
index 1ba108f..dc7e0a0 100644
--- a/perf/micro/paint.c
+++ b/perf/micro/paint.c
@@ -25,7 +25,7 @@
 
 #include "cairo-perf.h"
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_paint (cairo_t *cr, int width, int height, int loops)
 {
     cairo_perf_timer_start ();
diff --git a/perf/micro/pattern_create_radial.c b/perf/micro/pattern_create_radial.c
index 7104c00..13260bb 100644
--- a/perf/micro/pattern_create_radial.c
+++ b/perf/micro/pattern_create_radial.c
@@ -55,7 +55,7 @@ generate_double_in_range (double min, double max)
     return d;
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_pattern_create_radial (cairo_t *cr, int width, int height, int loops)
 {
     cairo_perf_timer_start ();
diff --git a/perf/micro/pythagoras-tree.c b/perf/micro/pythagoras-tree.c
index 3da4569..6e823a8 100644
--- a/perf/micro/pythagoras-tree.c
+++ b/perf/micro/pythagoras-tree.c
@@ -58,7 +58,7 @@ add_rectangle (cairo_t *cr, double size)
     cairo_restore (cr);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_pythagoras_tree (cairo_t *cr, int width, int height, int loops)
 {
     double size = 128;
diff --git a/perf/micro/rectangles.c b/perf/micro/rectangles.c
index 6bfbc65..891572b 100644
--- a/perf/micro/rectangles.c
+++ b/perf/micro/rectangles.c
@@ -39,7 +39,7 @@ static struct {
     double height;
 } rects[RECTANGLE_COUNT];
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_rectangles (cairo_t *cr, int width, int height, int loops)
 {
     int i;
@@ -59,7 +59,7 @@ do_rectangles (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_rectangles_once (cairo_t *cr, int width, int height, int loops)
 {
     int i;
@@ -80,7 +80,7 @@ do_rectangles_once (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_rectangle (cairo_t *cr, int width, int height, int loops)
 {
     cairo_perf_timer_start ();
diff --git a/perf/micro/rounded-rectangles.c b/perf/micro/rounded-rectangles.c
index 4db62fc..5985249 100644
--- a/perf/micro/rounded-rectangles.c
+++ b/perf/micro/rounded-rectangles.c
@@ -60,7 +60,7 @@ rounded_rectangle (cairo_t *cr,
     cairo_arc (cr, x+radius,   y+radius,   radius, M_PI,            270 * M_PI / 180);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_rectangle (cairo_t *cr, int width, int height, int loops)
 {
     cairo_perf_timer_start ();
@@ -75,7 +75,7 @@ do_rectangle (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_rectangles (cairo_t *cr, int width, int height, int loops)
 {
     int i;
@@ -97,7 +97,7 @@ do_rectangles (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_rectangles_once (cairo_t *cr, int width, int height, int loops)
 {
     int i;
diff --git a/perf/micro/spiral.c b/perf/micro/spiral.c
index 10bb918..85d0580 100644
--- a/perf/micro/spiral.c
+++ b/perf/micro/spiral.c
@@ -39,7 +39,7 @@ typedef enum {
     DIAGCLOSE                   /* forces a diagonal */
 } close_t;
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_spiral (cairo_t *cr,
              cairo_fill_rule_t fill_rule,
              align_t align,
@@ -106,7 +106,7 @@ draw_spiral (cairo_t *cr,
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_spiral_box (cairo_t *cr,
 		 cairo_fill_rule_t fill_rule,
 		 align_t align,
@@ -142,7 +142,7 @@ draw_spiral_box (cairo_t *cr,
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_spiral_stroke (cairo_t *cr,
 		    align_t align,
 		    int width, int height, int loops)
@@ -197,7 +197,7 @@ draw_spiral_stroke (cairo_t *cr,
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_spiral_eo_pa_re (cairo_t *cr, int width, int height, int loops)
 {
     return draw_spiral (cr,
@@ -207,7 +207,7 @@ draw_spiral_eo_pa_re (cairo_t *cr, int width, int height, int loops)
                         width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_spiral_nz_pa_re (cairo_t *cr, int width, int height, int loops)
 {
     return draw_spiral (cr,
@@ -217,7 +217,7 @@ draw_spiral_nz_pa_re (cairo_t *cr, int width, int height, int loops)
                         width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_spiral_eo_na_re (cairo_t *cr, int width, int height, int loops)
 {
     return draw_spiral (cr,
@@ -227,7 +227,7 @@ draw_spiral_eo_na_re (cairo_t *cr, int width, int height, int loops)
                         width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_spiral_nz_na_re (cairo_t *cr, int width, int height, int loops)
 {
     return draw_spiral (cr,
@@ -237,7 +237,7 @@ draw_spiral_nz_na_re (cairo_t *cr, int width, int height, int loops)
                         width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_spiral_eo_pa_di (cairo_t *cr, int width, int height, int loops)
 {
     return draw_spiral (cr,
@@ -247,7 +247,7 @@ draw_spiral_eo_pa_di (cairo_t *cr, int width, int height, int loops)
                         width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_spiral_nz_pa_di (cairo_t *cr, int width, int height, int loops)
 {
     return draw_spiral (cr,
@@ -257,7 +257,7 @@ draw_spiral_nz_pa_di (cairo_t *cr, int width, int height, int loops)
                         width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_spiral_eo_na_di (cairo_t *cr, int width, int height, int loops)
 {
     return draw_spiral (cr,
@@ -267,7 +267,7 @@ draw_spiral_eo_na_di (cairo_t *cr, int width, int height, int loops)
                         width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_spiral_nz_na_di (cairo_t *cr, int width, int height, int loops)
 {
     return draw_spiral (cr,
@@ -277,7 +277,7 @@ draw_spiral_nz_na_di (cairo_t *cr, int width, int height, int loops)
                         width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_spiral_nz_pa_box (cairo_t *cr, int width, int height, int loops)
 {
     return draw_spiral_box (cr,
@@ -285,7 +285,7 @@ draw_spiral_nz_pa_box (cairo_t *cr, int width, int height, int loops)
 			    width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_spiral_nz_na_box (cairo_t *cr, int width, int height, int loops)
 {
     return draw_spiral_box (cr,
@@ -294,7 +294,7 @@ draw_spiral_nz_na_box (cairo_t *cr, int width, int height, int loops)
 }
 
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_spiral_eo_pa_box (cairo_t *cr, int width, int height, int loops)
 {
     return draw_spiral_box (cr,
@@ -302,7 +302,7 @@ draw_spiral_eo_pa_box (cairo_t *cr, int width, int height, int loops)
 			    width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_spiral_eo_na_box (cairo_t *cr, int width, int height, int loops)
 {
     return draw_spiral_box (cr,
@@ -310,7 +310,7 @@ draw_spiral_eo_na_box (cairo_t *cr, int width, int height, int loops)
 			    width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_spiral_stroke_pa (cairo_t *cr, int width, int height, int loops)
 {
     return draw_spiral_stroke (cr,
@@ -318,7 +318,7 @@ draw_spiral_stroke_pa (cairo_t *cr, int width, int height, int loops)
 			       width, height, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 draw_spiral_stroke_na (cairo_t *cr, int width, int height, int loops)
 {
     return draw_spiral_stroke (cr,
diff --git a/perf/micro/stroke.c b/perf/micro/stroke.c
index 950fb48..8d7dc52 100644
--- a/perf/micro/stroke.c
+++ b/perf/micro/stroke.c
@@ -25,7 +25,7 @@
 
 #include "cairo-perf.h"
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_stroke (cairo_t *cr, int width, int height, int loops)
 {
     cairo_arc (cr,
@@ -60,7 +60,7 @@ rounded_rectangle (cairo_t *cr,
     cairo_arc (cr, x+radius,   y+radius,   radius, M_PI,            270 * M_PI / 180);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_strokes (cairo_t *cr, int width, int height, int loops)
 {
     /* a pair of overlapping rectangles */
diff --git a/perf/micro/subimage_copy.c b/perf/micro/subimage_copy.c
index 8c70464..eb04154 100644
--- a/perf/micro/subimage_copy.c
+++ b/perf/micro/subimage_copy.c
@@ -34,7 +34,7 @@
  * should be independent of the source and destination surface sizes.
  */
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_subimage_copy (cairo_t *cr, int width, int height, int loops)
 {
     cairo_rectangle (cr, 2, 2, 4, 4);
diff --git a/perf/micro/tessellate.c b/perf/micro/tessellate.c
index 38effff..38c8b86 100644
--- a/perf/micro/tessellate.c
+++ b/perf/micro/tessellate.c
@@ -98,7 +98,7 @@ point_t points[300] = {
  {46.6169,94.982}, {96.7277,88.4318}, {45.8039,18.3765}, {76.6448,78.0224}, {25.7585,90.4782}
 };
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_tessellate (cairo_t *cr, int num_points, int loops)
 {
     int i;
@@ -123,19 +123,19 @@ do_tessellate (cairo_t *cr, int num_points, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 tessellate_16 (cairo_t *cr, int width, int height, int loops)
 {
     return do_tessellate (cr, 16, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 tessellate_64 (cairo_t *cr, int width, int height, int loops)
 {
     return do_tessellate (cr, 64, loops);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 tessellate_256 (cairo_t *cr, int width, int height, int loops)
 {
     return do_tessellate (cr, 256, loops);
diff --git a/perf/micro/text.c b/perf/micro/text.c
index 190c3c2..bd2ca7b 100644
--- a/perf/micro/text.c
+++ b/perf/micro/text.c
@@ -25,7 +25,7 @@
 
 #include "cairo-perf.h"
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_text (cairo_t *cr, int width, int height, int loops)
 {
     const char text[] = "the jay, pig, fox, zebra and my wolves quack";
diff --git a/perf/micro/twin.c b/perf/micro/twin.c
index 2bc01ed..cc6f020 100644
--- a/perf/micro/twin.c
+++ b/perf/micro/twin.c
@@ -3,7 +3,7 @@
 
 #include "cairo-perf.h"
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_twin (cairo_t *cr,
 	 int width,
 	 int height,
diff --git a/perf/micro/unaligned-clip.c b/perf/micro/unaligned-clip.c
index adc44fe..d71549c 100644
--- a/perf/micro/unaligned-clip.c
+++ b/perf/micro/unaligned-clip.c
@@ -28,7 +28,7 @@
 
 #include "cairo-perf.h"
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_unaligned_clip (cairo_t *cr, int width, int height, int loops)
 {
     cairo_perf_timer_start ();
diff --git a/perf/micro/wave.c b/perf/micro/wave.c
index 6613fc9..88029f8 100644
--- a/perf/micro/wave.c
+++ b/perf/micro/wave.c
@@ -57,7 +57,7 @@ generate_random_waveform(cairo_t *target, int width, int height)
     return surface;
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_wave (cairo_t *cr, int width, int height, int loops)
 {
     cairo_surface_t *wave;
diff --git a/perf/micro/wide-fills.c b/perf/micro/wide-fills.c
index a4adc48..a9beeeb 100644
--- a/perf/micro/wide-fills.c
+++ b/perf/micro/wide-fills.c
@@ -45,7 +45,7 @@ uniform_random (double minval, double maxval)
     return minval + state * (maxval - minval) / 4294967296.0;
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_wide_fills_ha (cairo_t *cr, int width, int height, int loops)
 {
     int count;
@@ -69,7 +69,7 @@ do_wide_fills_ha (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_wide_fills_h (cairo_t *cr, int width, int height, int loops)
 {
     int count;
@@ -93,7 +93,7 @@ do_wide_fills_h (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_wide_fills_va (cairo_t *cr, int width, int height, int loops)
 {
     int count;
@@ -117,7 +117,7 @@ do_wide_fills_va (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_wide_fills_v (cairo_t *cr, int width, int height, int loops)
 {
     int count;
@@ -141,7 +141,7 @@ do_wide_fills_v (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_wide_fills (cairo_t *cr, int width, int height, int loops)
 {
     int count;
diff --git a/perf/micro/wide-strokes.c b/perf/micro/wide-strokes.c
index 450d6a9..e6c27da 100644
--- a/perf/micro/wide-strokes.c
+++ b/perf/micro/wide-strokes.c
@@ -38,7 +38,7 @@ uniform_random (double minval, double maxval)
     return minval + state * (maxval - minval) / 4294967296.0;
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_wide_strokes_ha (cairo_t *cr, int width, int height, int loops)
 {
     int count;
@@ -64,7 +64,7 @@ do_wide_strokes_ha (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_wide_strokes_h (cairo_t *cr, int width, int height, int loops)
 {
     int count;
@@ -90,7 +90,7 @@ do_wide_strokes_h (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_wide_strokes_va (cairo_t *cr, int width, int height, int loops)
 {
     int count;
@@ -116,7 +116,7 @@ do_wide_strokes_va (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_wide_strokes_v (cairo_t *cr, int width, int height, int loops)
 {
     int count;
@@ -142,7 +142,7 @@ do_wide_strokes_v (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_wide_strokes (cairo_t *cr, int width, int height, int loops)
 {
     int count;
diff --git a/perf/micro/world-map.c b/perf/micro/world-map.c
index 4f9a880..cb0aeee 100644
--- a/perf/micro/world-map.c
+++ b/perf/micro/world-map.c
@@ -53,7 +53,7 @@ enum {
     FILL = 2,
 };
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_world_map (cairo_t *cr, int width, int height, int loops, int mode)
 {
     const wm_element_t *e;
@@ -116,19 +116,19 @@ do_world_map (cairo_t *cr, int width, int height, int loops, int mode)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_world_map_stroke (cairo_t *cr, int width, int height, int loops)
 {
     return do_world_map (cr, width, height, loops, STROKE);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_world_map_fill (cairo_t *cr, int width, int height, int loops)
 {
     return do_world_map (cr, width, height, loops, FILL);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 do_world_map_both (cairo_t *cr, int width, int height, int loops)
 {
     return do_world_map (cr, width, height, loops, FILL | STROKE);
diff --git a/perf/micro/zrusin.c b/perf/micro/zrusin.c
index 87c8da3..c4dccbf 100644
--- a/perf/micro/zrusin.c
+++ b/perf/micro/zrusin.c
@@ -44,7 +44,7 @@ zrusin_another_path (cairo_t *cr)
 	cairo_line_to (cr, zrusin_another[i].x, zrusin_another[i].y);
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 zrusin_another_tessellate (cairo_t *cr, int width, int height, int loops)
 {
     zrusin_another_path (cr);
@@ -66,7 +66,7 @@ zrusin_another_tessellate (cairo_t *cr, int width, int height, int loops)
     return cairo_perf_timer_elapsed ();
 }
 
-static cairo_perf_ticks_t
+static cairo_time_t
 zrusin_another_fill (cairo_t *cr, int width, int height, int loops)
 {
     zrusin_another_path (cr);
commit 2855ff4666922f2c38505414270d47f659b0d499
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Wed Aug 31 16:42:03 2011 +0200

    perf: Reuse cairo-time
    
    Instead of redefining time getters, use the generic one provided by
    _cairo_time_*.

diff --git a/perf/Makefile.am b/perf/Makefile.am
index 88f691f..28a4720 100644
--- a/perf/Makefile.am
+++ b/perf/Makefile.am
@@ -48,6 +48,7 @@ cairo_perf_micro_DEPENDENCIES = \
 
 libcairoperf_la_SOURCES = \
 	$(libcairoperf_sources)	\
+	$(libcairoperf_external_sources)
 	$(libcairoperf_headers)
 
 cairo_analyse_trace_SOURCES = \
diff --git a/perf/Makefile.sources b/perf/Makefile.sources
index 0c15ae9..b99234b 100644
--- a/perf/Makefile.sources
+++ b/perf/Makefile.sources
@@ -1,11 +1,10 @@
 libcairoperf_sources = \
-	cairo-perf-os2.c	\
-	cairo-perf-posix.c	\
-	cairo-perf-report.c	\
-	cairo-perf-win32.c	\
+	cairo-perf.c	\
 	cairo-stats.c		\
 	$(NULL)
 
+libcairoperf_external_sources = ../src/cairo-time.c
+
 libcairoperf_headers = \
 	cairo-perf.h   \
 	cairo-stats.h  \
diff --git a/perf/cairo-perf-os2.c b/perf/cairo-perf-os2.c
deleted file mode 100644
index 1849938..0000000
--- a/perf/cairo-perf-os2.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2007 Netlabs
- * Copyright (c) 2006 Mozilla Corporation
- * Copyright (c) 2006 Red Hat, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * the authors not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. The authors make no representations about the
- * suitability of this software for any purpose.  It is provided "as
- * is" without express or implied warranty.
- *
- * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
- * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Peter Weilbacher <mozilla at weilbacher.org>
- *	    Vladimir Vukicevic <vladimir at pobox.com> (win32/linux code)
- *	    Carl Worth <cworth at cworth.org> (win32/linux code)
- */
-
-#include "cairo-perf.h"
-
-#if CAIRO_HAS_OS2_SURFACE
-
-#define INCL_BASE
-#include <os2.h>
-
-/* timers */
-typedef struct _cairo_perf_timer
-{
-    /* make them double so that they can store the full QWORD precision */
-    double start;
-    double stop;
-} cairo_perf_timer_t;
-
-static cairo_perf_timer_t timer;
-
-static cairo_perf_timer_synchronize_t cairo_perf_timer_synchronize = NULL;
-static void *cairo_perf_timer_synchronize_closure = NULL;
-void
-cairo_perf_timer_set_synchronize (cairo_perf_timer_synchronize_t  synchronize,
-				  void				 *closure)
-{
-    cairo_perf_timer_synchronize = synchronize;
-    cairo_perf_timer_synchronize_closure = closure;
-}
-
-void
-cairo_perf_timer_start (void) {
-    QWORD time;
-
-    if (cairo_perf_timer_synchronize)
-	cairo_perf_timer_synchronize (cairo_perf_timer_synchronize_closure);
-    DosTmrQueryTime(&time);
-    timer.start = (time.ulHi*4294967296.0 + time.ulLo);
-}
-
-void
-cairo_perf_timer_stop (void) {
-    QWORD time;
-
-    if (cairo_perf_timer_synchronize)
-	cairo_perf_timer_synchronize (cairo_perf_timer_synchronize_closure);
-    DosTmrQueryTime(&time);
-    timer.stop = (time.ulHi*4294967296.0 + time.ulLo);
-}
-
-cairo_perf_ticks_t
-cairo_perf_timer_elapsed (void) {
-    ULONG freq;
-
-    DosTmrQueryFreq(&freq);
-    /* return time difference in milliseconds */
-    return (timer.stop - timer.start) / freq * 1000;
-}
-
-cairo_perf_ticks_t
-cairo_perf_ticks_per_second (void) {
-    return 1000; /* in ms */
-}
-
-
-/* yield */
-void
-cairo_perf_yield (void) {
-    /* try to deactivate this thread until the scheduler calls it again */
-    DosSleep (0);
-}
-
-#endif /* CAIRO_HAS_OS2_SURFACE */
diff --git a/perf/cairo-perf-posix.c b/perf/cairo-perf-posix.c
deleted file mode 100644
index 59d8e3c..0000000
--- a/perf/cairo-perf-posix.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright © 2006 Mozilla Corporation
- * Copyright © 2006 Red Hat, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * the authors not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. The authors make no representations about the
- * suitability of this software for any purpose.  It is provided "as
- * is" without express or implied warranty.
- *
- * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
- * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Vladimir Vukicevic <vladimir at pobox.com>
- *	    Carl Worth <cworth at cworth.org>
- */
-
-/* Portions of this file come from liboil:
- *
- * LIBOIL - Library of Optimized Inner Loops
- * Copyright (c) 2003,2004 David A. Schleef <ds at schleef.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define _XOPEN_SOURCE 600	/* for round() */
-
-#include "cairo-perf.h"
-
-#if !CAIRO_HAS_OS2_SURFACE && !CAIRO_HAS_WIN32_SURFACE
-
-#include "config.h"
-
-#include <signal.h>
-#include <time.h>
-#include <sys/time.h>
-#include <unistd.h>
-#ifdef _POSIX_PRIORITY_SCHEDULING
-#include <sched.h>
-#endif
-
-/* timers */
-
-#if defined(HAVE_CLOCK_GETTIME)
-#if defined(CLOCK_MONOTONIC_RAW)
-#define CLOCK CLOCK_MONOTONIC_RAW
-#elif defined(CLOCK_MONOTONIC)
-#define CLOCK CLOCK_MONOTONIC
-#endif
-#endif
-
-#if ! defined(CLOCK)
-#if defined(__i386__) || defined(__amd64__)
-static inline cairo_perf_ticks_t
-oil_profile_stamp_rdtsc (void)
-{
-    unsigned a, d;
-    __asm__ __volatile__("rdtsc" : "=a" (a), "=d" (d));
-    return ((uint64_t)a) | (((uint64_t)d) << 32);
-}
-#define OIL_STAMP oil_profile_stamp_rdtsc
-#endif
-
-#if defined(__powerpc__) || defined(__PPC__) || defined(__ppc__)
-static inline cairo_perf_ticks_t
-oil_profile_stamp_tb (void)
-{
-    uint32_t junk;
-    uint64_t ts;
-
-    __asm__ __volatile__ (
-	"1:     mftbu   %1;"
-	"       mftb    %0+1;"
-	"       mftbu   %0;"
-	"       cmpw    %0,%1;"
-	"       bne     1b" :
-	"=r" (ts), "=r" (junk));
-
-    return ts;
-}
-#define OIL_STAMP oil_profile_stamp_tb
-#endif
-
-#if defined(__alpha__)
-static inline cairo_perf_ticks_t
-oil_profile_stamp_alpha (void)
-{
-    unsigned int ts;
-    __asm__ __volatile__ ("rpcc %0\n" : "=r"(ts));
-    return ts;
-}
-#define OIL_STAMP oil_profile_stamp_alpha
-#endif
-
-#if defined(__s390__)
-static cairo_perf_ticks_t
-oil_profile_stamp_s390 (void)
-{
-    uint64_t ts;
-    __asm__ __volatile__ ("STCK %0\n" : : "m" (ts));
-    return ts;
-}
-#define OIL_STAMP oil_profile_stamp_s390
-#endif
-#endif
-
-#if defined(__APPLE__)
-#include <mach/mach_time.h>
-#undef OIL_STAMP
-#define OIL_STAMP mach_absolute_time
-#endif
-
-
-typedef struct _cairo_perf_timer {
-#if defined(CLOCK)
-    struct timespec tv_start;
-    struct timespec tv_stop;
-#elif defined(OIL_STAMP)
-    cairo_perf_ticks_t start;
-    cairo_perf_ticks_t stop;
-#else
-    struct timeval tv_start;
-    struct timeval tv_stop;
-#endif
-} cairo_perf_timer_t;
-
-static cairo_perf_timer_t timer;
-
-static cairo_perf_timer_synchronize_t cairo_perf_timer_synchronize = NULL;
-static void *cairo_perf_timer_synchronize_closure = NULL;
-void
-cairo_perf_timer_set_synchronize (cairo_perf_timer_synchronize_t  synchronize,
-				  void				 *closure)
-{
-    cairo_perf_timer_synchronize = synchronize;
-    cairo_perf_timer_synchronize_closure = closure;
-}
-
-void
-cairo_perf_timer_start (void)
-{
-    if (cairo_perf_timer_synchronize)
-	cairo_perf_timer_synchronize (cairo_perf_timer_synchronize_closure);
-
-#if defined(CLOCK)
-    clock_gettime (CLOCK, &timer.tv_start);
-#elif defined(OIL_STAMP)
-    timer.start = OIL_STAMP ();
-#else
-    gettimeofday (&timer.tv_start, NULL);
-#endif
-}
-
-void
-cairo_perf_timer_stop (void)
-{
-    if (cairo_perf_timer_synchronize)
-	cairo_perf_timer_synchronize (cairo_perf_timer_synchronize_closure);
-
-#if defined(CLOCK)
-    clock_gettime (CLOCK, &timer.tv_stop);
-#elif defined(OIL_STAMP)
-    timer.stop = OIL_STAMP ();
-#else
-    gettimeofday (&timer.tv_stop, NULL);
-#endif
-}
-
-cairo_perf_ticks_t
-cairo_perf_timer_elapsed (void)
-{
-    cairo_perf_ticks_t ticks;
-
-#if defined(CLOCK)
-    ticks  = timer.tv_stop.tv_sec - timer.tv_start.tv_sec;
-    ticks *= 1000000000;
-    ticks += timer.tv_stop.tv_nsec - timer.tv_start.tv_nsec;
-#elif defined(OIL_STAMP)
-    ticks = timer.stop - timer.start;
-#else
-    ticks  = timer.tv_stop.tv_sec - timer.tv_start.tv_sec;
-    ticks *= 1000000;
-    ticks += timer.tv_stop.tv_usec - timer.tv_start.tv_usec;
-#endif
-
-    return ticks;
-}
-
-cairo_perf_ticks_t
-cairo_perf_ticks_per_second (void)
-{
-#if defined(CLOCK)
-    /* For clock_gettime() the units are nano-seconds */
-    return 1000000000;
-#elif defined(OIL_STAMP)
-    static cairo_perf_ticks_t tps = 0;
-    /* XXX: This is obviously not stable in light of changing CPU speed. */
-    if (tps == 0) {
-	struct timeval tv_start, tv_stop;
-	double tv_elapsed;
-	cairo_perf_timer_start ();
-	gettimeofday (&tv_start, NULL);
-	usleep (20000);
-	cairo_perf_timer_stop ();
-	gettimeofday (&tv_stop, NULL);
-	tv_elapsed = ((tv_stop.tv_sec - tv_start.tv_sec) +
-		      + (tv_stop.tv_usec - tv_start.tv_usec) / 1000000.0);
-	tps = round (cairo_perf_timer_elapsed () / tv_elapsed);
-    }
-    return tps;
-#else
-    /* For gettimeofday() the units are micro-seconds */
-    return 1000000;
-#endif
-}
-
-/* yield */
-
-void
-cairo_perf_yield (void)
-{
-#ifdef _POSIX_PRIORITY_SCHEDULING
-    sched_yield ();
-#endif
-}
-
-#endif /* !CAIRO_HAS_OS2_SURFACE && !CAIRO_HAS_WIN32_SURFACE */
diff --git a/perf/cairo-perf-win32.c b/perf/cairo-perf-win32.c
deleted file mode 100644
index 23b8fb4..0000000
--- a/perf/cairo-perf-win32.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright © 2006 Mozilla Corporation
- * Copyright © 2006 Red Hat, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * the authors not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. The authors make no representations about the
- * suitability of this software for any purpose.  It is provided "as
- * is" without express or implied warranty.
- *
- * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
- * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Vladimir Vukicevic <vladimir at pobox.com>
- *	    Carl Worth <cworth at cworth.org>
- */
-
-#include "cairo-perf.h"
-
-#if CAIRO_HAS_WIN32_SURFACE
-
-#define USE_WINAPI
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-/* timers */
-
-typedef struct _cairo_perf_timer
-{
-    LARGE_INTEGER start;
-    LARGE_INTEGER stop;
-} cairo_perf_timer_t;
-
-static cairo_perf_timer_t timer;
-
-static cairo_perf_timer_synchronize_t cairo_perf_timer_synchronize = NULL;
-static void *cairo_perf_timer_synchronize_closure = NULL;
-void
-cairo_perf_timer_set_synchronize (cairo_perf_timer_synchronize_t  synchronize,
-				  void				 *closure)
-{
-    cairo_perf_timer_synchronize = synchronize;
-    cairo_perf_timer_synchronize_closure = closure;
-}
-
-void
-cairo_perf_timer_start (void) {
-    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_synchronize)
-	cairo_perf_timer_synchronize (cairo_perf_timer_synchronize_closure);
-    QueryPerformanceCounter(&timer.stop);
-}
-
-cairo_perf_ticks_t
-cairo_perf_timer_elapsed (void) {
-    return (timer.stop.QuadPart - timer.start.QuadPart);
-}
-
-cairo_perf_ticks_t
-cairo_perf_ticks_per_second (void) {
-    LARGE_INTEGER freq;
-
-    QueryPerformanceFrequency(&freq);
-
-    return freq.QuadPart;
-}
-
-
-/* yield */
-
-void
-cairo_perf_yield (void) {
-    SleepEx(0, TRUE);
-}
-
-#endif /* CAIRO_HAS_WIN32_SURFACE */
diff --git a/perf/cairo-perf.c b/perf/cairo-perf.c
new file mode 100644
index 0000000..1a60bdc
--- /dev/null
+++ b/perf/cairo-perf.c
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2007 Netlabs
+ * Copyright (c) 2006 Mozilla Corporation
+ * Copyright (c) 2006 Red Hat, Inc.
+ * Copyright (c) 2011 Andrea Canciani
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * the authors not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. The authors make no representations about the
+ * suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: Peter Weilbacher <mozilla at weilbacher.org>
+ *	    Vladimir Vukicevic <vladimir at pobox.com> (win32/linux code)
+ *	    Carl Worth <cworth at cworth.org> (win32/linux code)
+ *          Andrea Canciani <ranma42 at gmail.com>
+ */
+
+#include "cairo-perf.h"
+#include "../src/cairo-time-private.h"
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#if defined(__OS2__)
+#define INCL_BASE
+#include <os2.h>
+#elif defined(_WIN32)
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#elif defined(_POSIX_PRIORITY_SCHEDULING)
+#include <sched.h>
+#endif
+
+
+/* timers */
+static cairo_time_t timer;
+static cairo_perf_timer_synchronize_t cairo_perf_timer_synchronize = NULL;
+static void *cairo_perf_timer_synchronize_closure = NULL;
+
+void
+cairo_perf_timer_set_synchronize (cairo_perf_timer_synchronize_t  synchronize,
+				  void				 *closure)
+{
+    cairo_perf_timer_synchronize = synchronize;
+    cairo_perf_timer_synchronize_closure = closure;
+}
+
+void
+cairo_perf_timer_start (void)
+{
+    timer = _cairo_time_get ();
+}
+
+void
+cairo_perf_timer_stop (void)
+{
+    timer = _cairo_time_get_delta (timer);
+}
+
+cairo_time_t
+cairo_perf_timer_elapsed (void)
+{
+    return timer;
+}
+
+cairo_time_t
+cairo_perf_ticks_per_second (void)
+{
+    return _cairo_time_from_s (1.);
+}
+
+void
+cairo_perf_yield (void)
+{
+    /* try to deactivate this thread until the scheduler calls it again */
+
+#if defined(__OS2__)
+    DosSleep (0);
+#elif defined(_WIN32)
+    SleepEx(0, TRUE);
+#elif defined(_POSIX_PRIORITY_SCHEDULING)
+    sched_yield ();
+#else
+    sleep (0);
+#endif
+}
diff --git a/perf/cairo-perf.h b/perf/cairo-perf.h
index 9c70b5b..df5e141 100644
--- a/perf/cairo-perf.h
+++ b/perf/cairo-perf.h
@@ -29,9 +29,10 @@
 #define _CAIRO_PERF_H_
 
 #include "cairo-boilerplate.h"
+#include "../src/cairo-time-private.h"
 #include <stdio.h>
 
-typedef uint64_t cairo_perf_ticks_t;
+typedef cairo_time_t cairo_perf_ticks_t;
 
 typedef struct _cairo_stats {
     cairo_perf_ticks_t min_ticks;
diff --git a/perf/cairo-stats.c b/perf/cairo-stats.c
index fbe16e7..5273c60 100644
--- a/perf/cairo-stats.c
+++ b/perf/cairo-stats.c
@@ -25,26 +25,13 @@
 
 #include "cairo-stats.h"
 
-static int
-_cairo_perf_ticks_cmp (const void *_a,
-		       const void *_b)
-{
-    const cairo_perf_ticks_t *a = _a;
-    const cairo_perf_ticks_t *b = _b;
-
-    if (*a > *b)
-	return 1;
-    if (*a < *b)
-	return -1;
-    return 0;
-}
-
 void
 _cairo_stats_compute (cairo_stats_t	 *stats,
 		      cairo_perf_ticks_t *values,
 		      int		  num_values)
 {
     int i;
+    cairo_time_t sumtime;
     double sum, mean, delta, q1, q3, iqr;
     double outlier_min, outlier_max;
     int min_valid, num_valid;
@@ -60,41 +47,46 @@ _cairo_stats_compute (cairo_stats_t	 *stats,
      * Q1).
      */
     qsort (values, num_values,
-	   sizeof (cairo_perf_ticks_t), _cairo_perf_ticks_cmp);
+	   sizeof (cairo_perf_ticks_t), _cairo_time_cmp);
 
-    q1		= values[(1*num_values)/4];
-    q3		= values[(3*num_values)/4];
+    q1 = _cairo_time_to_s (values[(1*num_values)/4]);
+    q3 = _cairo_time_to_s (values[(3*num_values)/4]);
 
     iqr = q3 - q1;
 
-    outlier_min = q1 - 1.5 * iqr;
-    outlier_max = q3 + 1.5 * iqr;
+    outlier_min = _cairo_time_from_s (q1 - 1.5 * iqr);
+    outlier_max = _cairo_time_from_s (q3 + 1.5 * iqr);
 
     min_valid = 0;
-    while (min_valid < num_values && values[min_valid] < outlier_min)
+    while (min_valid < num_values &&
+	   _cairo_time_to_s (values[min_valid]) < outlier_min)
+    {
 	min_valid++;
+    }
 
     i = min_valid;
     num_valid = 0;
-    while (i + num_valid < num_values && values[i+num_valid] <= outlier_max)
+    while (i + num_valid < num_values &&
+	   _cairo_time_to_s (values[i+num_valid]) <= outlier_max)
+    {
 	num_valid++;
+    }
 
     stats->iterations = num_valid;
     stats->min_ticks = values[min_valid];
 
-    sum = 0.0;
+    sumtime = _cairo_time_from_s (0);
     for (i = min_valid; i < min_valid + num_valid; i++) {
-	sum += values[i];
-	if (values[i] < stats->min_ticks)
-	    stats->min_ticks = values[i];
+	sumtime = _cairo_time_add (sumtime, values[i]);
+	stats->min_ticks = _cairo_time_min (stats->min_ticks, values[i]);
     }
 
-    mean = sum / num_valid;
+    mean = _cairo_time_to_s (sumtime) / num_valid;
     stats->median_ticks = values[min_valid + num_valid / 2];
 
     sum = 0.0;
     for (i = min_valid; i < min_valid + num_valid; i++) {
-	delta = values[i] - mean;
+	delta = _cairo_time_to_s (values[i]) - mean;
 	sum += delta * delta;
     }
 
commit 6d6bfbd641bbb4de62df704e724e507a7e55b883
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Tue Aug 30 16:16:04 2011 +0200

    Introduce the cairo-missing library
    
    The cairo-missing library provides the functions which are needed in
    order to correctly compile cairo (or its utilities) and which were not
    found during configuration.
    
    Fixes the build on MacOS X Lion, which failed because of collisons
    between the cairo internal getline and strndup and those in libc:
    
    cairo-analyse-trace.c:282: error: static declaration of ‘getline’ follows non-static declaration
    /usr/include/stdio.h:449: error: previous declaration of ‘getline’ was here
    cairo-analyse-trace.c:307: error: static declaration of ‘strndup’ follows non-static declaration
    ...

diff --git a/build/configure.ac.system b/build/configure.ac.system
index 10a2dca..5c3f4f9 100644
--- a/build/configure.ac.system
+++ b/build/configure.ac.system
@@ -108,7 +108,7 @@ AC_CHECK_HEADER(fenv.h,
 
 dnl check for misc headers and functions
 AC_CHECK_HEADERS([libgen.h byteswap.h signal.h setjmp.h fenv.h])
-AC_CHECK_FUNCS([vasnprintf link ctime_r drand48 flockfile funlockfile ffs])
+AC_CHECK_FUNCS([ctime_r drand48 flockfile funlockfile getline link strndup])
 
 dnl check for win32 headers (this detects mingw as well)
 AC_CHECK_HEADERS([windows.h], have_windows=yes, have_windows=no)
diff --git a/configure.ac b/configure.ac
index 71f8bf3..4b85c8a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -805,6 +805,7 @@ perf/micro/Makefile
 util/Makefile
 util/cairo-fdr/Makefile
 util/cairo-gobject/Makefile
+util/cairo-missing/Makefile
 util/cairo-script/Makefile
 util/cairo-script/examples/Makefile
 util/cairo-sphinx/Makefile
diff --git a/perf/Makefile.am b/perf/Makefile.am
index 4344b98..88f691f 100644
--- a/perf/Makefile.am
+++ b/perf/Makefile.am
@@ -6,6 +6,7 @@ AM_CPPFLAGS =					\
 	-I$(srcdir)				\
 	-I$(top_srcdir)/boilerplate		\
 	-I$(top_srcdir)/src			\
+	-I$(top_srcdir)/util/cairo-missing	\
 	-I$(top_srcdir)/util/cairo-script	\
 	-I$(top_builddir)/src			\
 	$(CAIRO_CFLAGS)
@@ -54,9 +55,11 @@ cairo_analyse_trace_SOURCES = \
 	$(cairo_analyse_trace_external_sources)
 cairo_analyse_trace_LDADD =		\
 	$(top_builddir)/util/cairo-script/libcairo-script-interpreter.la \
+	$(top_builddir)/util/cairo-missing/libcairo-missing.la \
 	$(LDADD)
 cairo_analyse_trace_DEPENDENCIES = \
 	$(top_builddir)/util/cairo-script/libcairo-script-interpreter.la \
+	$(top_builddir)/util/cairo-missing/libcairo-missing.la \
 	$(LDADD)
 
 cairo_perf_trace_SOURCES = \
@@ -64,9 +67,11 @@ cairo_perf_trace_SOURCES = \
 	$(cairo_perf_trace_external_sources)
 cairo_perf_trace_LDADD =		\
 	$(top_builddir)/util/cairo-script/libcairo-script-interpreter.la \
+	$(top_builddir)/util/cairo-missing/libcairo-missing.la \
 	$(LDADD)
 cairo_perf_trace_DEPENDENCIES = \
 	$(top_builddir)/util/cairo-script/libcairo-script-interpreter.la \
+	$(top_builddir)/util/cairo-missing/libcairo-missing.la \
 	$(LDADD)
 
 cairo_perf_diff_files_SOURCES =	$(cairo_perf_diff_files_sources)
diff --git a/perf/cairo-analyse-trace.c b/perf/cairo-analyse-trace.c
index 1fee3cf..9622907 100644
--- a/perf/cairo-analyse-trace.c
+++ b/perf/cairo-analyse-trace.c
@@ -38,6 +38,7 @@
 
 #include "cairo-boilerplate-getopt.h"
 #include <cairo-script-interpreter.h>
+#include "cairo-missing.h"
 
 /* rudely reuse bits of the library... */
 #include "../src/cairo-error-private.h"
@@ -273,57 +274,6 @@ usage (const char *argv0)
 	     argv0, argv0);
 }
 
-#ifndef __USE_GNU
-#define POORMANS_GETLINE_BUFFER_SIZE (65536)
-static ssize_t
-getline (char	**lineptr,
-	 size_t  *n,
-	 FILE	 *stream)
-{
-    if (!*lineptr)
-    {
-	*n = POORMANS_GETLINE_BUFFER_SIZE;
-	*lineptr = (char *) malloc (*n);
-    }
-
-    if (!fgets (*lineptr, *n, stream))
-	return -1;
-
-    if (!feof (stream) && !strchr (*lineptr, '\n'))
-    {
-	fprintf (stderr, "The poor man's implementation of getline in "
-			  __FILE__ " needs a bigger buffer. Perhaps it's "
-			 "time for a complete implementation of getline.\n");
-	exit (0);
-    }
-
-    return strlen (*lineptr);
-}
-#undef POORMANS_GETLINE_BUFFER_SIZE
-
-static char *
-strndup (const char *s,
-	 size_t      n)
-{
-    size_t len;
-    char *sdup;
-
-    if (!s)
-	return NULL;
-
-    len = strlen (s);
-    len = (n < len ? n : len);
-    sdup = (char *) malloc (len + 1);
-    if (sdup)
-    {
-	memcpy (sdup, s, len);
-	sdup[len] = '\0';
-    }
-
-    return sdup;
-}
-#endif /* ifndef __USE_GNU */
-
 static cairo_bool_t
 read_excludes (cairo_perf_t *perf,
 	       const char   *filename)
diff --git a/perf/cairo-perf-report.c b/perf/cairo-perf-report.c
index a04db6b..01ddeb1 100644
--- a/perf/cairo-perf-report.c
+++ b/perf/cairo-perf-report.c
@@ -25,6 +25,7 @@
  * Authors: Carl Worth <cworth at cworth.org>
  */
 
+#include "cairo-missing.h"
 #include "cairo-perf.h"
 #include "cairo-stats.h"
 
@@ -49,17 +50,6 @@
 typedef ptrdiff_t ssize_t;
 #endif
 
-#if !defined (__USE_GNU) && !defined(__USE_XOPEN2K8)
-static ssize_t
-getline (char	**lineptr,
-	 size_t  *n,
-	 FILE	 *stream);
-
-static char *
-strndup (const char *s,
-	 size_t      n);
-#endif
-
 #ifdef _MSC_VER
 static long long
 strtoll (const char  *nptr,
@@ -230,61 +220,6 @@ test_report_parse (test_report_t *report,
     return TEST_REPORT_STATUS_SUCCESS;
 }
 
-/* We conditionally provide a custom implementation of getline and strndup
- * as needed. These aren't necessary full-fledged general purpose
- * implementations. They just get the job done for our purposes.
- */
-#if !defined (__USE_GNU) && !defined(__USE_XOPEN2K8)
-#define POORMANS_GETLINE_BUFFER_SIZE (65536)
-static ssize_t
-getline (char	**lineptr,
-	 size_t  *n,
-	 FILE	 *stream)
-{
-    if (!*lineptr)
-    {
-	*n = POORMANS_GETLINE_BUFFER_SIZE;
-	*lineptr = (char *) malloc (*n);
-    }
-
-    if (!fgets (*lineptr, *n, stream))
-	return -1;
-
-    if (!feof (stream) && !strchr (*lineptr, '\n'))
-    {
-	fprintf (stderr, "The poor man's implementation of getline in "
-			  __FILE__ " needs a bigger buffer. Perhaps it's "
-			 "time for a complete implementation of getline.\n");
-	exit (0);
-    }
-
-    return strlen (*lineptr);
-}
-#undef POORMANS_GETLINE_BUFFER_SIZE
-
-static char *
-strndup (const char *s,
-	 size_t      n)
-{
-    size_t len;
-    char *sdup;
-
-    if (!s)
-	return NULL;
-
-    len = strlen (s);
-    len = (n < len ? n : len);
-    sdup = (char *) malloc (len + 1);
-    if (sdup)
-    {
-	memcpy (sdup, s, len);
-	sdup[len] = '\0';
-    }
-
-    return sdup;
-}
-#endif /* ifndef __USE_GNU */
-
 /* We provide hereafter a win32 implementation of the basename
  * and strtoll functions which are not available otherwise.
  * The basename function is fully compliant to its GNU specs.
diff --git a/perf/cairo-perf-trace.c b/perf/cairo-perf-trace.c
index 25a98f3..3319917 100644
--- a/perf/cairo-perf-trace.c
+++ b/perf/cairo-perf-trace.c
@@ -32,6 +32,7 @@
 
 #include "../cairo-version.h" /* for the real version */
 
+#include "cairo-missing.h"
 #include "cairo-perf.h"
 #include "cairo-stats.h"
 
@@ -373,57 +374,6 @@ usage (const char *argv0)
 	     argv0, argv0);
 }
 
-#ifndef __USE_GNU
-#define POORMANS_GETLINE_BUFFER_SIZE (65536)
-static ssize_t
-getline (char	**lineptr,
-	 size_t  *n,
-	 FILE	 *stream)
-{
-    if (!*lineptr)
-    {
-	*n = POORMANS_GETLINE_BUFFER_SIZE;
-	*lineptr = (char *) malloc (*n);
-    }
-
-    if (!fgets (*lineptr, *n, stream))
-	return -1;
-
-    if (!feof (stream) && !strchr (*lineptr, '\n'))
-    {
-	fprintf (stderr, "The poor man's implementation of getline in "
-			  __FILE__ " needs a bigger buffer. Perhaps it's "
-			 "time for a complete implementation of getline.\n");
-	exit (0);
-    }
-
-    return strlen (*lineptr);
-}
-#undef POORMANS_GETLINE_BUFFER_SIZE
-
-static char *
-strndup (const char *s,
-	 size_t      n)
-{
-    size_t len;
-    char *sdup;
-
-    if (!s)
-	return NULL;
-
-    len = strlen (s);
-    len = (n < len ? n : len);
-    sdup = (char *) malloc (len + 1);
-    if (sdup)
-    {
-	memcpy (sdup, s, len);
-	sdup[len] = '\0';
-    }
-
-    return sdup;
-}
-#endif /* ifndef __USE_GNU */
-
 static cairo_bool_t
 read_excludes (cairo_perf_t *perf,
 	       const char   *filename)
diff --git a/test/Makefile.am b/test/Makefile.am
index d525ae3..2fa61a5 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -114,13 +114,16 @@ cairo_test_trace_LDADD =		\
 	$(top_builddir)/util/cairo-script/libcairo-script-interpreter.la \
         $(top_builddir)/boilerplate/libcairoboilerplate.la	\
 	$(top_builddir)/src/libcairo.la 			\
+	$(top_builddir)/util/cairo-missing/libcairo-missing.la  \
 	$(CAIRO_LDADD) \
 	$(SHM_LIBS)
 cairo_test_trace_DEPENDENCIES = \
 	$(top_builddir)/test/pdiff/libpdiff.la 			\
 	$(top_builddir)/util/cairo-script/libcairo-script-interpreter.la \
         $(top_builddir)/boilerplate/libcairoboilerplate.la	\
-	$(top_builddir)/src/libcairo.la
+	$(top_builddir)/src/libcairo.la                         \
+	$(top_builddir)/util/cairo-missing/libcairo-missing.la  \
+	$(NULL)
 endif
 
 BUILT_SOURCES += cairo-test-constructors.c
@@ -271,6 +274,7 @@ AM_CPPFLAGS =					\
 	-I$(srcdir)				\
 	-I$(srcdir)/pdiff			\
 	-I$(top_srcdir)/boilerplate		\
+	-I$(top_srcdir)/util/cairo-missing	\
 	-I$(top_srcdir)/util/cairo-script	\
 	-I$(top_srcdir)/src			\
 	-I$(top_builddir)/src			\
diff --git a/test/cairo-test-trace.c b/test/cairo-test-trace.c
index 96039ab..146ca6f 100644
--- a/test/cairo-test-trace.c
+++ b/test/cairo-test-trace.c
@@ -59,6 +59,7 @@
 
 #include "cairo-boilerplate-getopt.h"
 #include <cairo-script-interpreter.h>
+#include "cairo-missing.h"
 
 #if CAIRO_HAS_SCRIPT_SURFACE
 #include <cairo-script.h>
@@ -1415,52 +1416,6 @@ test_trace (test_trace_t *test, const char *trace)
     free (trace_cpy);
 }
 
-#ifndef __USE_GNU
-#define POORMANS_GETLINE_BUFFER_SIZE (65536)
-static ssize_t
-getline (char **lineptr, size_t *n, FILE *stream)
-{
-    if (*lineptr == NULL) {
-        *n = POORMANS_GETLINE_BUFFER_SIZE;
-        *lineptr = (char *) malloc (*n);
-    }
-
-    if (! fgets (*lineptr, *n, stream))
-        return -1;
-
-    if (! feof (stream) && !strchr (*lineptr, '\n')) {
-        fprintf (stderr, "The poor man's implementation of getline in "
-                          __FILE__ " needs a bigger buffer. Perhaps it's "
-                         "time for a complete implementation of getline.\n");
-        exit (0);
-    }
-
-    return strlen (*lineptr);
-}
-#undef POORMANS_GETLINE_BUFFER_SIZE
-
-static char *
-strndup (const char *s, size_t n)
-{
-    size_t len;
-    char *sdup;
-
-    if (!s)
-        return NULL;
-
-    len = strlen (s);
-    len = (n < len ? n : len);
-    sdup = (char *) malloc (len + 1);
-    if (sdup)
-    {
-        memcpy (sdup, s, len);
-        sdup[len] = '\0';
-    }
-
-    return sdup;
-}
-#endif /* ifndef __USE_GNU */
-
 static cairo_bool_t
 read_excludes (test_trace_t *test, const char *filename)
 {
diff --git a/util/Makefile.am b/util/Makefile.am
index 6c6c849..f202f35 100644
--- a/util/Makefile.am
+++ b/util/Makefile.am
@@ -1,6 +1,6 @@
 include $(top_srcdir)/build/Makefile.am.common
 
-SUBDIRS = .
+SUBDIRS = . cairo-missing
 
 if CAIRO_HAS_GOBJECT_FUNCTIONS
 SUBDIRS += cairo-gobject
diff --git a/util/cairo-missing/Makefile.am b/util/cairo-missing/Makefile.am
new file mode 100644
index 0000000..c8d6ccd
--- /dev/null
+++ b/util/cairo-missing/Makefile.am
@@ -0,0 +1,10 @@
+include $(top_srcdir)/util/cairo-missing/Makefile.sources
+
+AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src
+
+lib_LTLIBRARIES = libcairo-missing.la
+
+libcairo_missing_la_SOURCES = \
+	$(libcairo_missing_sources)	\
+	$(libcairo_missing_headers)	\
+	$(NULL)
diff --git a/util/cairo-missing/Makefile.sources b/util/cairo-missing/Makefile.sources
new file mode 100644
index 0000000..1a30631
--- /dev/null
+++ b/util/cairo-missing/Makefile.sources
@@ -0,0 +1,8 @@
+libcairo_missing_sources = \
+	strndup.c \
+	getline.c \
+	$(NULL)
+
+libcairo_missing_headers = \
+	cairo-missing.h \
+	$(NULL)
diff --git a/util/cairo-missing/Makefile.win32 b/util/cairo-missing/Makefile.win32
new file mode 100644
index 0000000..ac24a2c
--- /dev/null
+++ b/util/cairo-missing/Makefile.win32
@@ -0,0 +1,10 @@
+top_srcdir = ../../
+include $(top_srcdir)/build/Makefile.win32.common
+include $(top_srcdir)/util/cairo-missing/Makefile.sources
+
+all: inform $(CFG)/libcairo-missing.lib
+
+libcairo_missing_OBJECTS = $(patsubst %.c, $(CFG)/%-static.obj, $(libcairo_missing_sources))
+
+$(CFG)/libcairo-script-interpreter.lib: $(libcairo_missing_OBJECTS)
+	@$(AR) $(CAIRO_ARFLAGS) -OUT:$@ $(libcairo_missing_OBJECTS)
diff --git a/util/cairo-missing/cairo-missing.h b/util/cairo-missing/cairo-missing.h
new file mode 100644
index 0000000..1397756
--- /dev/null
+++ b/util/cairo-missing/cairo-missing.h
@@ -0,0 +1,49 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2006 Red Hat, Inc.
+ * Copyright © 2011 Andrea Canciani
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose.  It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * Authors: Carl Worth <cworth at cworth.org>
+ *	    Andrea Canciani <ranma42 at gmail.com>
+ */
+
+#ifndef CAIRO_MISSING_H
+#define CAIRO_MISSING_H
+
+#include "cairo-compiler-private.h"
+
+#include <stdio.h>
+#include <string.h>
+
+#ifndef HAVE_GETLINE
+cairo_private ssize_t
+getline (char **lineptr, size_t *n, FILE *stream);
+#endif
+
+#ifndef HAVE_STRNDUP
+cairo_private char *
+strndup (const char *s, size_t n);
+#endif
+
+#endif
diff --git a/util/cairo-missing/getline.c b/util/cairo-missing/getline.c
new file mode 100644
index 0000000..584c6ac
--- /dev/null
+++ b/util/cairo-missing/getline.c
@@ -0,0 +1,89 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2006 Red Hat, Inc.
+ * Copyright © 2011 Andrea Canciani
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose.  It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * Authors: Carl Worth <cworth at cworth.org>
+ *	    Andrea Canciani <ranma42 at gmail.com>
+ */
+
+#include "cairo-missing.h"
+
+#ifndef HAVE_GETLINE
+
+#define GETLINE_MIN_BUFFER_SIZE 128
+ssize_t
+getline (char	**lineptr,
+	 size_t  *n,
+	 FILE	 *stream)
+{
+    char *line, *tmpline;
+    size_t len, offset;
+    ssize_t ret;
+
+    offset = 0;
+    len = *n;
+    line = *lineptr;
+    if (len < GETLINE_BUFFER_SIZE) {
+	len = GETLINE_BUFFER_SIZE;
+	line = NULL;
+    }
+
+    if (line == NULL) {
+	line = (char *) malloc (len);
+	if (unlikely (line == NULL))
+	    return -1;
+    }
+
+    while (1) {
+	if (offset + 1 == len) {
+	    tmpline = (char *) cairo_realloc (line, len, 2);
+	    if (unlikely (tmpline == NULL)) {
+		if (line != *lineptr)
+		    free (line);
+		return -1;
+	    }
+	    len *= 2;
+	    line = tmpline;
+	}
+
+	ret = getc (stream);
+	if (ret == -1)
+	    break;
+
+	line[offset++] = ret;
+	if (ret == '\n') {
+	    ret = offset;
+	    break;
+	}
+    }
+
+    line[offset++] = '\0';
+    *lineptr = line;
+    *n = len;
+
+    return ret;
+}
+#undef GETLINE_BUFFER_SIZE
+#endif
diff --git a/util/cairo-missing/strndup.c b/util/cairo-missing/strndup.c
new file mode 100644
index 0000000..6eabc12
--- /dev/null
+++ b/util/cairo-missing/strndup.c
@@ -0,0 +1,54 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2006 Red Hat, Inc.
+ * Copyright © 2011 Andrea Canciani
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose.  It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * Authors: Carl Worth <cworth at cworth.org>
+ *	    Andrea Canciani <ranma42 at gmail.com>
+ */
+
+#include "cairo-missing.h"
+
+#ifndef HAVE_STRNDUP
+char *
+strndup (const char *s,
+	 size_t      n)
+{
+    size_t len;
+    char *sdup;
+
+    if (s == NULL)
+	return NULL;
+
+    len = strlen (s);
+    len = MIN (n, len);
+    sdup = (char *) malloc (len + 1);
+    if (sdup != NULL) {
+	memcpy (sdup, s, len);
+	sdup[len] = '\0';
+    }
+
+    return sdup;
+}
+#endif
commit 0101a545793291d0fe76b765ba8392ade5faa1a1
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Tue Aug 30 16:15:28 2011 +0200

    time: Add cairo_time_t type
    
    Add the cairo_time_t type (currently based on cairo_uint64_t) and use
    it in cairo-observer and in the perf suite.
    
    Fixes the build on MacOS X (for the src/ subdir) and Win32, whch
    failed because they don't provide clock_gettime:
    
    cairo-surface-observer.c:629: error: implicit declaration of function 'clock_gettime'
    cairo-surface-observer.c:629: warning: nested extern declaration of 'clock_gettime'
    cairo-surface-observer.c:629: error: 'CLOCK_MONOTONIC' undeclared (first use in this function)
    ...

diff --git a/build/configure.ac.system b/build/configure.ac.system
index b405740..10a2dca 100644
--- a/build/configure.ac.system
+++ b/build/configure.ac.system
@@ -53,9 +53,7 @@ dnl ====================================================================
 AC_CHECK_LIBM
 LIBS="$LIBS $LIBM"
 
-AC_CHECK_LIB(rt, sched_yield, [RT_LIBS=-lrt], [RT_LIBS=])
-CAIROPERF_LIBS=$RT_LIBS
-AC_SUBST(CAIROPERF_LIBS)
+AC_CHECK_LIB(rt, sched_yield)
 
 has_shm_open=
 AC_CHECK_LIB(rt, shm_open, [
@@ -102,10 +100,7 @@ dnl check for mmap support
 AC_CHECK_HEADERS([sys/mman.h], [AC_CHECK_FUNCS([mmap])])
 
 dnl check for clock_gettime() support
-save_LIBS="$LIBS"
-LIBS="$LIBS $RT_LIBS"
 AC_CHECK_HEADERS([time.h], [AC_CHECK_FUNCS([clock_gettime])])
-LIBS="$save_LIBS"
 
 dnl check for GNU-extensions to fenv
 AC_CHECK_HEADER(fenv.h,
diff --git a/configure.ac b/configure.ac
index c7c167e..71f8bf3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -622,7 +622,7 @@ dnl ===========================================================================
 
 CAIRO_ENABLE_SURFACE_BACKEND(mime, mime, always)
 CAIRO_ENABLE_SURFACE_BACKEND(recording, recording, always)
-CAIRO_ENABLE_SURFACE_BACKEND(observer, observer, always, observer_LIBS=-lrt)
+CAIRO_ENABLE_SURFACE_BACKEND(observer, observer, always)
 CAIRO_ENABLE_SURFACE_BACKEND(tee, tee, no)
 CAIRO_ENABLE_SURFACE_BACKEND(xml, xml, no, [
     use_xml=$have_libz
diff --git a/perf/Makefile.am b/perf/Makefile.am
index 3ac60da..4344b98 100644
--- a/perf/Makefile.am
+++ b/perf/Makefile.am
@@ -48,7 +48,6 @@ cairo_perf_micro_DEPENDENCIES = \
 libcairoperf_la_SOURCES = \
 	$(libcairoperf_sources)	\
 	$(libcairoperf_headers)
-libcairoperf_la_LIBADD = $(CAIROPERF_LIBS)
 
 cairo_analyse_trace_SOURCES = \
 	$(cairo_analyse_trace_sources)	\
diff --git a/src/Makefile.sources b/src/Makefile.sources
index 8f2d09e..0b820f8 100644
--- a/src/Makefile.sources
+++ b/src/Makefile.sources
@@ -106,6 +106,7 @@ cairo_private = \
 	cairo-surface-subsurface-private.h \
 	cairo-surface-snapshot-private.h \
 	cairo-surface-wrapper-private.h \
+	cairo-time-private.h \
 	cairo-types-private.h \
 	cairo-user-font-private.h \
 	cairo-wideint-private.h \
@@ -192,6 +193,7 @@ cairo_sources = \
 	cairo-surface-subsurface.c \
 	cairo-surface-wrapper.c \
 	cairo-system.c \
+	cairo-time.c \
 	cairo-tor-scan-converter.c \
 	cairo-toy-font-face.c \
 	cairo-traps.c \
diff --git a/src/cairo-surface-observer-private.h b/src/cairo-surface-observer-private.h
index a846a1c..61507b2 100644
--- a/src/cairo-surface-observer-private.h
+++ b/src/cairo-surface-observer-private.h
@@ -41,6 +41,7 @@
 #include "cairo-device-private.h"
 #include "cairo-recording-surface-private.h"
 #include "cairo-surface-private.h"
+#include "cairo-time-private.h"
 
 struct stat {
     double min, max, sum, sum_sq;
@@ -89,7 +90,7 @@ struct _cairo_observation_record {
     double tolerance;
     int antialias;
     int clip;
-    double elapsed;
+    cairo_time_t elapsed;
 };
 
 struct _cairo_observation {
@@ -100,7 +101,7 @@ struct _cairo_observation {
     /* XXX put interesting stats here! */
 
     struct paint {
-	double elapsed;
+	cairo_time_t elapsed;
 	unsigned int count;
 	struct extents extents;
 	unsigned int operators[NUM_OPERATORS];
@@ -112,7 +113,7 @@ struct _cairo_observation {
     } paint;
 
     struct mask {
-	double elapsed;
+	cairo_time_t elapsed;
 	unsigned int count;
 	struct extents extents;
 	unsigned int operators[NUM_OPERATORS];
@@ -125,7 +126,7 @@ struct _cairo_observation {
     } mask;
 
     struct fill {
-	double elapsed;
+	cairo_time_t elapsed;
 	unsigned int count;
 	struct extents extents;
 	unsigned int operators[NUM_OPERATORS];
@@ -140,7 +141,7 @@ struct _cairo_observation {
     } fill;
 
     struct stroke {
-	double elapsed;
+	cairo_time_t elapsed;
 	unsigned int count;
 	struct extents extents;
 	unsigned int operators[NUM_OPERATORS];
@@ -157,7 +158,7 @@ struct _cairo_observation {
     } stroke;
 
     struct glyphs {
-	double elapsed;
+	cairo_time_t elapsed;
 	unsigned int count;
 	struct extents extents;
 	unsigned int operators[NUM_OPERATORS];
diff --git a/src/cairo-surface-observer.c b/src/cairo-surface-observer.c
index 92f2624..a0dcb2f 100644
--- a/src/cairo-surface-observer.c
+++ b/src/cairo-surface-observer.c
@@ -487,7 +487,7 @@ record_paint (cairo_observation_record_t *r,
 	      cairo_operator_t op,
 	      const cairo_pattern_t *source,
 	      const cairo_clip_t *clip,
-	      double elapsed)
+	      cairo_time_t elapsed)
 {
     record_target (r, target);
 
@@ -512,7 +512,7 @@ record_mask (cairo_observation_record_t *r,
 	     const cairo_pattern_t *source,
 	     const cairo_pattern_t *mask,
 	     const cairo_clip_t *clip,
-	     double elapsed)
+	     cairo_time_t elapsed)
 {
     record_target (r, target);
 
@@ -540,7 +540,7 @@ record_fill (cairo_observation_record_t *r,
 	     double			 tolerance,
 	     cairo_antialias_t		 antialias,
 	     const cairo_clip_t		*clip,
-	     double elapsed)
+	     cairo_time_t elapsed)
 {
     record_target (r, target);
 
@@ -570,7 +570,7 @@ record_stroke (cairo_observation_record_t *r,
 	       double			 tolerance,
 	       cairo_antialias_t	 antialias,
 	       const cairo_clip_t	*clip,
-	       double			 elapsed)
+	       cairo_time_t		 elapsed)
 {
     record_target (r, target);
 
@@ -597,7 +597,7 @@ record_glyphs (cairo_observation_record_t *r,
 	       int			 num_glyphs,
 	       cairo_scaled_font_t	*scaled_font,
 	       const cairo_clip_t	*clip,
-	       double			 elapsed)
+	       cairo_time_t		 elapsed)
 {
     record_target (r, target);
 
@@ -628,25 +628,6 @@ add_record (cairo_observation_t *log,
 }
 
 static void
-start_timer (struct timespec *ts)
-{
-    clock_gettime (CLOCK_MONOTONIC, ts);
-}
-
-static double
-stop_timer (const struct timespec *then)
-{
-    struct timespec now;
-    double elapsed;
-
-    clock_gettime (CLOCK_MONOTONIC, &now);
-
-    elapsed = now.tv_nsec - then->tv_nsec;
-    elapsed += 1e9 * (now.tv_sec - then->tv_sec);
-    return elapsed;
-}
-
-static void
 sync (cairo_surface_t *target, int x, int y)
 {
     cairo_rectangle_t extents;
@@ -674,7 +655,7 @@ add_record_paint (cairo_observation_t *log,
 		 cairo_operator_t op,
 		 const cairo_pattern_t *source,
 		 const cairo_clip_t *clip,
-		 double elapsed)
+		 cairo_time_t elapsed)
 {
     cairo_observation_record_t record;
     cairo_int_status_t status;
@@ -692,9 +673,9 @@ add_record_paint (cairo_observation_t *log,
 	assert (status == CAIRO_INT_STATUS_SUCCESS);
     }
 
-    if (elapsed > log->paint.slowest.elapsed)
+    if (_cairo_time_gt (elapsed, log->paint.slowest.elapsed))
 	log->paint.slowest = record;
-    log->paint.elapsed += elapsed;
+    log->paint.elapsed = _cairo_time_add (log->paint.elapsed, elapsed);
 }
 
 static cairo_int_status_t
@@ -708,8 +689,7 @@ _cairo_surface_observer_paint (void *abstract_surface,
     cairo_composite_rectangles_t composite;
     cairo_rectangle_int_t extents;
     cairo_int_status_t status;
-    struct timespec ts;
-    double elapsed;
+    cairo_time_t t;
     int x, y;
 
     /* XXX device locking */
@@ -741,7 +721,7 @@ _cairo_surface_observer_paint (void *abstract_surface,
     add_extents (&device->log.paint.extents, &composite);
     _cairo_composite_rectangles_fini (&composite);
 
-    start_timer (&ts);
+    t = _cairo_time_get ();
     status =  _cairo_surface_paint (surface->target,
 				    op, source,
 				    clip);
@@ -749,10 +729,10 @@ _cairo_surface_observer_paint (void *abstract_surface,
 	return status;
 
     sync (surface->target, x, y);
-    elapsed = stop_timer (&ts);
+    t = _cairo_time_get_delta (t);
 
-    add_record_paint (&surface->log, surface->target, op, source, clip, elapsed);
-    add_record_paint (&device->log, surface->target, op, source, clip, elapsed);
+    add_record_paint (&surface->log, surface->target, op, source, clip, t);
+    add_record_paint (&device->log, surface->target, op, source, clip, t);
 
     return CAIRO_STATUS_SUCCESS;
 }
@@ -764,7 +744,7 @@ add_record_mask (cairo_observation_t *log,
 		 const cairo_pattern_t *source,
 		 const cairo_pattern_t *mask,
 		 const cairo_clip_t *clip,
-		 double elapsed)
+		 cairo_time_t elapsed)
 {
     cairo_observation_record_t record;
     cairo_int_status_t status;
@@ -778,9 +758,9 @@ add_record_mask (cairo_observation_t *log,
 	assert (status == CAIRO_INT_STATUS_SUCCESS);
     }
 
-    if (elapsed > log->mask.slowest.elapsed)
+    if (_cairo_time_gt (elapsed, log->mask.slowest.elapsed))
 	log->mask.slowest = record;
-    log->mask.elapsed += elapsed;
+    log->mask.elapsed = _cairo_time_add (log->mask.elapsed, elapsed);
 }
 
 static cairo_int_status_t
@@ -795,8 +775,7 @@ _cairo_surface_observer_mask (void *abstract_surface,
     cairo_composite_rectangles_t composite;
     cairo_rectangle_int_t extents;
     cairo_int_status_t status;
-    struct timespec ts;
-    double elapsed;
+    cairo_time_t t;
     int x, y;
 
     surface->log.mask.count++;
@@ -828,7 +807,7 @@ _cairo_surface_observer_mask (void *abstract_surface,
     add_extents (&device->log.mask.extents, &composite);
     _cairo_composite_rectangles_fini (&composite);
 
-    start_timer (&ts);
+    t = _cairo_time_get ();
     status =  _cairo_surface_mask (surface->target,
 				   op, source, mask,
 				   clip);
@@ -836,14 +815,14 @@ _cairo_surface_observer_mask (void *abstract_surface,
 	return status;
 
     sync (surface->target, x, y);
-    elapsed = stop_timer (&ts);
+    t = _cairo_time_get_delta (t);
 
     add_record_mask (&surface->log,
 		     surface->target, op, source, mask, clip,
-		     elapsed);
+		     t);
     add_record_mask (&device->log,
 		     surface->target, op, source, mask, clip,
-		     elapsed);
+		     t);
 
     return CAIRO_STATUS_SUCCESS;
 }
@@ -858,7 +837,7 @@ add_record_fill (cairo_observation_t *log,
 		 double				 tolerance,
 		 cairo_antialias_t		 antialias,
 		 const cairo_clip_t		 *clip,
-		 double elapsed)
+		 cairo_time_t elapsed)
 {
     cairo_observation_record_t record;
     cairo_int_status_t status;
@@ -878,9 +857,9 @@ add_record_fill (cairo_observation_t *log,
 	assert (status == CAIRO_INT_STATUS_SUCCESS);
     }
 
-    if (elapsed > log->fill.slowest.elapsed)
+    if (_cairo_time_gt (elapsed, log->fill.slowest.elapsed))
 	log->fill.slowest = record;
-    log->fill.elapsed += elapsed;
+    log->fill.elapsed = _cairo_time_add (log->fill.elapsed, elapsed);
 }
 
 static cairo_int_status_t
@@ -898,8 +877,7 @@ _cairo_surface_observer_fill (void			*abstract_surface,
     cairo_composite_rectangles_t composite;
     cairo_rectangle_int_t extents;
     cairo_int_status_t status;
-    struct timespec ts;
-    double elapsed;
+    cairo_time_t t;
     int x, y;
 
     surface->log.fill.count++;
@@ -935,7 +913,7 @@ _cairo_surface_observer_fill (void			*abstract_surface,
     add_extents (&device->log.fill.extents, &composite);
     _cairo_composite_rectangles_fini (&composite);
 
-    start_timer (&ts);
+    t = _cairo_time_get ();
     status = _cairo_surface_fill (surface->target,
 				  op, source, path,
 				  fill_rule, tolerance, antialias,
@@ -944,17 +922,17 @@ _cairo_surface_observer_fill (void			*abstract_surface,
 	return status;
 
     sync (surface->target, x, y);
-    elapsed = stop_timer (&ts);
+    t = _cairo_time_get_delta (t);
 
     add_record_fill (&surface->log,
 		     surface->target, op, source, path,
 		     fill_rule, tolerance, antialias,
-		     clip, elapsed);
+		     clip, t);
 
     add_record_fill (&device->log,
 		     surface->target, op, source, path,
 		     fill_rule, tolerance, antialias,
-		     clip, elapsed);
+		     clip, t);
 
     return CAIRO_STATUS_SUCCESS;
 }
@@ -971,7 +949,7 @@ add_record_stroke (cairo_observation_t *log,
 		 double				 tolerance,
 		 cairo_antialias_t		 antialias,
 		 const cairo_clip_t		*clip,
-		 double elapsed)
+		 cairo_time_t elapsed)
 {
     cairo_observation_record_t record;
     cairo_int_status_t status;
@@ -992,9 +970,9 @@ add_record_stroke (cairo_observation_t *log,
 	assert (status == CAIRO_INT_STATUS_SUCCESS);
     }
 
-    if (elapsed > log->stroke.slowest.elapsed)
+    if (_cairo_time_gt (elapsed, log->stroke.slowest.elapsed))
 	log->stroke.slowest = record;
-    log->stroke.elapsed += elapsed;
+    log->stroke.elapsed = _cairo_time_add (log->stroke.elapsed, elapsed);
 }
 
 static cairo_int_status_t
@@ -1014,8 +992,7 @@ _cairo_surface_observer_stroke (void				*abstract_surface,
     cairo_composite_rectangles_t composite;
     cairo_rectangle_int_t extents;
     cairo_int_status_t status;
-    struct timespec ts;
-    double elapsed;
+    cairo_time_t t;
     int x, y;
 
     surface->log.stroke.count++;
@@ -1054,7 +1031,7 @@ _cairo_surface_observer_stroke (void				*abstract_surface,
     add_extents (&device->log.stroke.extents, &composite);
     _cairo_composite_rectangles_fini (&composite);
 
-    start_timer (&ts);
+    t = _cairo_time_get ();
     status = _cairo_surface_stroke (surface->target,
 				  op, source, path,
 				  style, ctm, ctm_inverse,
@@ -1064,19 +1041,19 @@ _cairo_surface_observer_stroke (void				*abstract_surface,
 	return status;
 
     sync (surface->target, x, y);
-    elapsed = stop_timer (&ts);
+    t = _cairo_time_get_delta (t);
 
     add_record_stroke (&surface->log,
 		       surface->target, op, source, path,
 		       style, ctm,ctm_inverse,
 		       tolerance, antialias,
-		       clip, elapsed);
+		       clip, t);
 
     add_record_stroke (&device->log,
 		       surface->target, op, source, path,
 		       style, ctm,ctm_inverse,
 		       tolerance, antialias,
-		       clip, elapsed);
+		       clip, t);
 
     return CAIRO_STATUS_SUCCESS;
 }
@@ -1090,7 +1067,7 @@ add_record_glyphs (cairo_observation_t	*log,
 		   int			 num_glyphs,
 		   cairo_scaled_font_t	*scaled_font,
 		   const cairo_clip_t	*clip,
-		   double elapsed)
+		   cairo_time_t elapsed)
 {
     cairo_observation_record_t record;
     cairo_int_status_t status;
@@ -1112,9 +1089,9 @@ add_record_glyphs (cairo_observation_t	*log,
 	assert (status == CAIRO_INT_STATUS_SUCCESS);
     }
 
-    if (elapsed > log->glyphs.slowest.elapsed)
+    if (_cairo_time_gt (elapsed, log->glyphs.slowest.elapsed))
 	log->glyphs.slowest = record;
-    log->glyphs.elapsed += elapsed;
+    log->glyphs.elapsed = _cairo_time_add (log->glyphs.elapsed, elapsed);
 }
 
 static cairo_int_status_t
@@ -1133,8 +1110,7 @@ _cairo_surface_observer_glyphs (void			*abstract_surface,
     cairo_rectangle_int_t extents;
     cairo_int_status_t status;
     cairo_glyph_t *dev_glyphs;
-    struct timespec ts;
-    double elapsed;
+    cairo_time_t t;
     int x, y;
 
     surface->log.glyphs.count++;
@@ -1175,7 +1151,7 @@ _cairo_surface_observer_glyphs (void			*abstract_surface,
     memcpy (dev_glyphs, glyphs, num_glyphs * sizeof (cairo_glyph_t));
 
     *remaining_glyphs = 0;
-    start_timer (&ts);
+    t = _cairo_time_get ();
     status = _cairo_surface_show_text_glyphs (surface->target, op, source,
 					      NULL, 0,
 					      dev_glyphs, num_glyphs,
@@ -1187,17 +1163,17 @@ _cairo_surface_observer_glyphs (void			*abstract_surface,
 	return status;
 
     sync (surface->target, x, y);
-    elapsed = stop_timer (&ts);
+    t = _cairo_time_get_delta (t);
 
     add_record_glyphs (&surface->log,
 		       surface->target, op, source,
 		       glyphs, num_glyphs, scaled_font,
-		       clip, elapsed);
+		       clip, t);
 
     add_record_glyphs (&device->log,
 		       surface->target, op, source,
 		       glyphs, num_glyphs, scaled_font,
-		       clip, elapsed);
+		       clip, t);
 
     return CAIRO_STATUS_SUCCESS;
 }
@@ -1620,13 +1596,14 @@ print_record (cairo_output_stream_t *stream,
 	_cairo_output_stream_printf (stream, "  antialias: %s\n",
 				     antialias_names[r->antialias]);
     _cairo_output_stream_printf (stream, "  clip: %s\n", clip_names[r->clip]);
-    _cairo_output_stream_printf (stream, "  elapsed: %f ns\n", r->elapsed);
+    _cairo_output_stream_printf (stream, "  elapsed: %f ns\n",
+				 _cairo_time_to_ns (r->elapsed));
 }
 
-static double percent (double a, double b)
+static double percent (cairo_time_t a, cairo_time_t b)
 {
     /* Fake %.1f */
-    return round (a*1000 / b) / 10;
+    return round (_cairo_time_to_s (a) * 1000 / _cairo_time_to_s (b)) / 10;
 }
 
 static cairo_bool_t
@@ -1653,15 +1630,17 @@ replay_record (cairo_observation_t *log,
     return TRUE;
 }
 
-static double
-_cairo_observation_total_elapsed_ns (cairo_observation_t *log)
+static cairo_time_t
+_cairo_observation_total_elapsed (cairo_observation_t *log)
 {
-    double total = 0;
-    total += log->paint.elapsed;
-    total += log->mask.elapsed;
-    total += log->fill.elapsed;
-    total += log->stroke.elapsed;
-    total += log->glyphs.elapsed;
+    cairo_time_t total;
+
+    total = log->paint.elapsed;
+    total = _cairo_time_add (total, log->mask.elapsed);
+    total = _cairo_time_add (total, log->fill.elapsed);
+    total = _cairo_time_add (total, log->stroke.elapsed);
+    total = _cairo_time_add (total, log->glyphs.elapsed);
+
     return total;
 }
 
@@ -1670,15 +1649,15 @@ _cairo_observation_print (cairo_output_stream_t *stream,
 			  cairo_observation_t *log)
 {
     cairo_device_t *script;
-    double total;
+    cairo_time_t total;
 
     script = _cairo_script_context_create_internal (stream);
     _cairo_script_context_attach_snapshots (script, FALSE);
 
-    total = _cairo_observation_total_elapsed_ns (log);
+    total = _cairo_observation_total_elapsed (log);
 
     _cairo_output_stream_printf (stream, "elapsed: %f\n",
-				 total);
+				 _cairo_time_to_ns (total));
     _cairo_output_stream_printf (stream, "surfaces: %d\n",
 				 log->num_surfaces);
     _cairo_output_stream_printf (stream, "contexts: %d\n",
@@ -1689,7 +1668,7 @@ _cairo_observation_print (cairo_output_stream_t *stream,
 
     _cairo_output_stream_printf (stream, "paint: count %d [no-op %d], elapsed %f [%f%%]\n",
 				 log->paint.count, log->paint.noop,
-				 log->paint.elapsed,
+				 _cairo_time_to_ns (log->paint.elapsed),
 				 percent (log->paint.elapsed, total));
     if (log->paint.count) {
 	print_extents (stream, &log->paint.extents);
@@ -1709,7 +1688,7 @@ _cairo_observation_print (cairo_output_stream_t *stream,
 
     _cairo_output_stream_printf (stream, "mask: count %d [no-op %d], elapsed %f [%f%%]\n",
 				 log->mask.count, log->mask.noop,
-				 log->mask.elapsed,
+				 _cairo_time_to_ns (log->mask.elapsed),
 				 percent (log->mask.elapsed, total));
     if (log->mask.count) {
 	print_extents (stream, &log->mask.extents);
@@ -1730,7 +1709,7 @@ _cairo_observation_print (cairo_output_stream_t *stream,
 
     _cairo_output_stream_printf (stream, "fill: count %d [no-op %d], elaspsed %f [%f%%]\n",
 				 log->fill.count, log->fill.noop,
-				 log->fill.elapsed,
+				 _cairo_time_to_ns (log->fill.elapsed),
 				 percent (log->fill.elapsed, total));
     if (log->fill.count) {
 	print_extents (stream, &log->fill.extents);
@@ -1753,7 +1732,7 @@ _cairo_observation_print (cairo_output_stream_t *stream,
 
     _cairo_output_stream_printf (stream, "stroke: count %d [no-op %d], elapsed %f [%f%%]\n",
 				 log->stroke.count, log->stroke.noop,
-				 log->stroke.elapsed,
+				 _cairo_time_to_ns (log->stroke.elapsed),
 				 percent (log->stroke.elapsed, total));
     if (log->stroke.count) {
 	print_extents (stream, &log->stroke.extents);
@@ -1777,7 +1756,7 @@ _cairo_observation_print (cairo_output_stream_t *stream,
 
     _cairo_output_stream_printf (stream, "glyphs: count %d [no-op %d], elasped %f [%f%%]\n",
 				 log->glyphs.count, log->glyphs.noop,
-				 log->glyphs.elapsed,
+				 _cairo_time_to_ns (log->glyphs.elapsed),
 				 percent (log->glyphs.elapsed, total));
     if (log->glyphs.count) {
 	print_extents (stream, &log->glyphs.extents);
@@ -1831,7 +1810,7 @@ cairo_surface_observer_elapsed (cairo_surface_t *abstract_surface)
 	return -1;
 
     surface = (cairo_surface_observer_t *) abstract_surface;
-    return _cairo_observation_total_elapsed_ns (&surface->log);
+    return _cairo_time_to_ns (_cairo_observation_total_elapsed (&surface->log));
 }
 
 void
@@ -1867,7 +1846,7 @@ cairo_device_observer_elapsed (cairo_device_t *abstract_device)
 	return -1;
 
     device = (cairo_device_observer_t *) abstract_device;
-    return _cairo_observation_total_elapsed_ns (&device->log);
+    return _cairo_time_to_ns (_cairo_observation_total_elapsed (&device->log));
 }
 
 double
@@ -1882,7 +1861,7 @@ cairo_device_observer_paint_elapsed (cairo_device_t *abstract_device)
 	return -1;
 
     device = (cairo_device_observer_t *) abstract_device;
-    return device->log.paint.elapsed;
+    return _cairo_time_to_ns (device->log.paint.elapsed);
 }
 
 double
@@ -1897,7 +1876,7 @@ cairo_device_observer_mask_elapsed (cairo_device_t *abstract_device)
 	return -1;
 
     device = (cairo_device_observer_t *) abstract_device;
-    return device->log.mask.elapsed;
+    return _cairo_time_to_ns (device->log.mask.elapsed);
 }
 
 double
@@ -1912,7 +1891,7 @@ cairo_device_observer_fill_elapsed (cairo_device_t *abstract_device)
 	return -1;
 
     device = (cairo_device_observer_t *) abstract_device;
-    return device->log.fill.elapsed;
+    return _cairo_time_to_ns (device->log.fill.elapsed);
 }
 
 double
@@ -1927,7 +1906,7 @@ cairo_device_observer_stroke_elapsed (cairo_device_t *abstract_device)
 	return -1;
 
     device = (cairo_device_observer_t *) abstract_device;
-    return device->log.stroke.elapsed;
+    return _cairo_time_to_ns (device->log.stroke.elapsed);
 }
 
 double
@@ -1942,5 +1921,5 @@ cairo_device_observer_glyphs_elapsed (cairo_device_t *abstract_device)
 	return -1;
 
     device = (cairo_device_observer_t *) abstract_device;
-    return device->log.glyphs.elapsed;
+    return _cairo_time_to_ns (device->log.glyphs.elapsed);
 }
diff --git a/src/cairo-time-private.h b/src/cairo-time-private.h
new file mode 100644
index 0000000..f7c48f3
--- /dev/null
+++ b/src/cairo-time-private.h
@@ -0,0 +1,93 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright (C) 2011 Andrea Canciani
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose.  It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * Authors: Andrea Canciani <ranma42 at gmail.com>
+ *
+ */
+
+#ifndef CAIRO_TIME_PRIVATE_H
+#define CAIRO_TIME_PRIVATE_H
+
+#include "cairo-compiler-private.h"
+#include "cairo-wideint-private.h"
+
+typedef cairo_uint64_t cairo_time_t;
+
+#define _cairo_time_add _cairo_uint64_add
+#define _cairo_time_sub _cairo_uint64_sub
+#define _cairo_time_gt  _cairo_uint64_gt
+#define _cairo_time_lt  _cairo_uint64_lt
+
+#define _cairo_time_to_double   _cairo_uint64_to_double
+#define _cairo_time_from_double _cairo_double_to_uint64
+
+cairo_private int
+_cairo_time_cmp (const void *a,
+		 const void *b);
+
+cairo_private double
+_cairo_time_to_s (cairo_time_t t);
+
+cairo_private cairo_time_t
+_cairo_time_from_s (double t);
+
+cairo_private cairo_time_t
+_cairo_time_get (void);
+
+static cairo_always_inline cairo_time_t
+_cairo_time_get_delta (cairo_time_t t)
+{
+    cairo_time_t now;
+
+    now = _cairo_time_get ();
+
+    return _cairo_time_sub (now, t);
+}
+
+static cairo_always_inline double
+_cairo_time_to_ns (cairo_time_t t)
+{
+    return 1.e9 * _cairo_time_to_s (t);
+}
+
+static cairo_always_inline cairo_time_t
+_cairo_time_max (cairo_time_t a, cairo_time_t b)
+{
+    if (_cairo_uint64_gt (a, b))
+	return a;
+    else
+	return b;
+}
+
+static cairo_always_inline cairo_time_t
+_cairo_time_min (cairo_time_t a, cairo_time_t b)
+{
+    if (_cairo_uint64_lt (a, b))
+	return a;
+    else
+	return b;
+}
+
+#endif
diff --git a/src/cairo-time.c b/src/cairo-time.c
new file mode 100644
index 0000000..32749f5
--- /dev/null
+++ b/src/cairo-time.c
@@ -0,0 +1,215 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright (c) 2007 Netlabs
+ * Copyright (c) 2006 Mozilla Corporation
+ * Copyright (c) 2006 Red Hat, Inc.
+ * Copyright (c) 2011 Andrea Canciani
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * the authors not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. The authors make no representations about the
+ * suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: Peter Weilbacher <mozilla at weilbacher.org>
+ *	    Vladimir Vukicevic <vladimir at pobox.com>
+ *	    Carl Worth <cworth at cworth.org>
+ *          Andrea Canciani <ranma42 at gmail.com>
+ */
+
+#include "cairoint.h"
+
+#include "cairo-time-private.h"
+
+#if HAVE_CLOCKGETTIME
+#if defined(CLOCK_MONOTONIC_RAW)
+#define CAIRO_CLOCK CLOCK_MONOTONIC_RAW
+#elif defined(CLOCK_MONOTONIC)
+#define CAIRO_CLOCK CLOCK_MONOTONIC
+#endif
+#endif
+
+#if defined(__APPLE__)
+#include <mach/mach_time.h>
+
+static cairo_always_inline double
+_cairo_time_1s (void)
+{
+    mach_timebase_info_data_t freq;
+
+    mach_timebase_info (&freq);
+
+    return 1000000000. * freq.denom / freq.numer;
+}
+
+cairo_time_t
+_cairo_time_get (void)
+{
+    return mach_absolute_time ();
+}
+
+#elif defined(__OS2__)
+#define INCL_BASE
+#include <os2.h>
+
+static cairo_always_inline double
+_cairo_time_1s (void)
+{
+    ULONG freq;
+
+    DosTmrQueryFreq (&freq);
+
+    return freq;
+}
+
+cairo_time_t
+_cairo_time_get (void)
+{
+    QWORD t;
+    cairo_uint64_t r;
+
+    DosTmrQueryTime (&t);
+
+    r = _cairo_uint64_lsl (_cairo_uint32_to_uint64 (t.ulHi), 32);
+    r = _cairo_uint64_add (r, _cairo_uint32_to_uint64 (t.ulLo));
+
+    return r;
+}
+
+#elif _WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+static cairo_always_inline double
+_cairo_time_1s (void)
+{
+    LARGE_INTEGER freq;
+
+    QueryPerformanceFrequency (&freq);
+
+    return freq.QuadPart;
+}
+
+cairo_time_t
+_cairo_time_get (void)
+{
+    LARGE_INTEGER t;
+
+    QueryPerformanceCounter (&t);
+
+    return t.QuadPart;
+}
+
+#elif defined(CAIRO_CLOCK)
+#include <time.h>
+
+static cairo_always_inline double
+_cairo_time_1s (void)
+{
+    return 1000000000;
+}
+
+cairo_time_t
+_cairo_time_get (void)
+{
+    struct timespec t;
+    cairo_time_t r;
+
+    clock_gettime (CAIRO_CLOCK, &t);
+
+    r = _cairo_double_to_uint64 (_cairo_time_1s ());
+    r = _cairo_uint64_mul (r, _cairo_uint32_to_uint64 (t.tv_sec));
+    r = _cairo_uint64_add (r, _cairo_uint32_to_uint64 (t.tv_nsec));
+
+    return r;
+}
+
+#else
+#include <sys/time.h>
+
+static cairo_always_inline double
+_cairo_time_1s (void)
+{
+    return 1000000;
+}
+
+cairo_time_t
+_cairo_time_get (void)
+{
+    struct timeval t;
+    cairo_time_t r;
+
+    gettimeofday (&t, NULL);
+
+    r = _cairo_double_to_uint64 (_cairo_time_1s ());
+    r = _cairo_uint64_mul (r, _cairo_uint32_to_uint64 (t.tv_sec));
+    r = _cairo_uint64_add (r, _cairo_uint32_to_uint64 (t.tv_usec));
+
+    return r;
+}
+
+#endif
+
+int
+_cairo_time_cmp (const void *a,
+		 const void *b)
+{
+    const cairo_time_t *ta, *tb;
+
+    ta = a;
+    tb = b;
+
+    if (_cairo_time_gt (*ta, *tb))
+	return 1;
+    else if (_cairo_time_lt (*ta, *tb))
+	return -1;
+    else
+	return 0;
+}
+
+static double
+_cairo_time_ticks_per_sec (void)
+{
+    static double ticks = 0;
+
+    if (unlikely (ticks == 0))
+	ticks = _cairo_time_1s ();
+
+    return ticks;
+}
+
+static double
+_cairo_time_s_per_tick (void)
+{
+    static double s = 0;
+
+    if (unlikely (s == 0))
+	s = 1. / _cairo_time_ticks_per_sec ();
+
+    return s;
+}
+
+double
+_cairo_time_to_s (cairo_time_t t)
+{
+    return _cairo_uint64_to_double (t) * _cairo_time_s_per_tick ();
+}
+
+cairo_time_t
+_cairo_time_from_s (double t)
+{
+    return _cairo_double_to_uint64 (t * _cairo_time_ticks_per_sec ());
+}
diff --git a/src/cairo-wideint-private.h b/src/cairo-wideint-private.h
index b9f8dae..53d2546 100644
--- a/src/cairo-wideint-private.h
+++ b/src/cairo-wideint-private.h
@@ -54,6 +54,8 @@
 cairo_uquorem64_t I
 _cairo_uint64_divrem (cairo_uint64_t num, cairo_uint64_t den);
 
+cairo_uint64_t I	_cairo_double_to_uint64 (double i);
+double	       I	_cairo_uint64_to_double (uint64_t i);
 cairo_uint64_t I	_cairo_uint32_to_uint64 (uint32_t i);
 #define			_cairo_uint64_to_uint32(a)  ((a).lo)
 cairo_uint64_t I	_cairo_uint64_add (cairo_uint64_t a, cairo_uint64_t b);
@@ -103,6 +105,16 @@ _cairo_uint64_divrem (cairo_uint64_t num, cairo_uint64_t den)
     return qr;
 }
 
+/*
+ * These need to be functions or gcc will complain when used on the
+ * result of a function:
+ *
+ * warning: cast from function call of type ‘#cairo_uint64_t’ to
+ * non-matching type ‘double’
+ */
+static cairo_always_inline cairo_uint64_t I _cairo_double_to_uint64 (double i) { return i; }
+static cairo_always_inline double I _cairo_uint64_to_double (cairo_uint64_t i) { return i; }
+
 #define			_cairo_uint32_to_uint64(i)  ((uint64_t) (i))
 #define			_cairo_uint64_to_uint32(i)  ((uint32_t) (i))
 #define			_cairo_uint64_add(a,b)	    ((a) + (b))
diff --git a/src/cairo-wideint.c b/src/cairo-wideint.c
index 78dedcd..b6e2280 100644
--- a/src/cairo-wideint.c
+++ b/src/cairo-wideint.c
@@ -84,6 +84,22 @@ uint64_shift32 (cairo_uint64_t i)
 static const cairo_uint64_t uint64_carry32 = { 0, 1 };
 
 cairo_uint64_t
+_cairo_double_to_uint64 (double i)
+{
+    cairo_uint64_t	q;
+
+    q.hi = i * (1. / 4294967296.);
+    q.lo = i - q.hi * 4294967296.;
+    return q;
+}
+
+double
+_cairo_uint64_to_double (cairo_uint64_t i)
+{
+    return i.hi * 4294967296. + i.lo;
+}
+
+cairo_uint64_t
 _cairo_uint32_to_uint64 (uint32_t i)
 {
     cairo_uint64_t	q;
commit e7204a3631d29d334511f291db8c31ce0026e2ce
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Thu Sep 1 07:16:43 2011 -0700

    win32: Fix compilation
    
    cairo-image-surface-private.h is needed in order to access
    cairo_image_surface_t fields.
    
    Fixes multiple build errors:
    
    error C2037: left of '...' specifies undefined struct/union
    '_cairo_image_surface'

diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c
index 18b837d..fb01665 100644
--- a/src/cairo-win32-font.c
+++ b/src/cairo-win32-font.c
@@ -46,6 +46,7 @@
 
 #include "cairo-win32-private.h"
 #include "cairo-error-private.h"
+#include "cairo-image-surface-private.h"
 #include "cairo-pattern-private.h"
 #include "cairo-scaled-font-subsets-private.h"
 
diff --git a/src/cairo-win32-printing-surface.c b/src/cairo-win32-printing-surface.c
index a91805e..99aca4a 100644
--- a/src/cairo-win32-printing-surface.c
+++ b/src/cairo-win32-printing-surface.c
@@ -55,6 +55,7 @@
 #include "cairo-recording-surface-private.h"
 #include "cairo-scaled-font-subsets-private.h"
 #include "cairo-image-info-private.h"
+#include "cairo-image-surface-private.h"
 #include "cairo-surface-clipper-private.h"
 
 #include <windows.h>
diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index d137562..b1d1c61 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -51,6 +51,7 @@
 #include "cairo-composite-rectangles-private.h"
 #include "cairo-default-context-private.h"
 #include "cairo-error-private.h"
+#include "cairo-image-surface-private.h"
 #include "cairo-paginated-private.h"
 #include "cairo-pattern-private.h"
 #include "cairo-win32-private.h"
commit 0c620080afa892f7bb642cc90fb72aafbebad16d
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Tue Aug 30 16:15:57 2011 +0200

    quartz: Fix compilation
    
    cairo-image-surface-private.h is needed in order to access
    cairo_image_surface_t fields.
    
    Fixes multiple build errors: dereferencing pointer to incomplete type

diff --git a/src/cairo-quartz-font.c b/src/cairo-quartz-font.c
index a50dc40..9e2298a 100644
--- a/src/cairo-quartz-font.c
+++ b/src/cairo-quartz-font.c
@@ -38,6 +38,7 @@
 
 #include <dlfcn.h>
 
+#include "cairo-image-surface-private.h"
 #include "cairo-quartz.h"
 #include "cairo-quartz-private.h"
 
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index 23b2b33..0f015c8 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -41,6 +41,7 @@
 
 #include "cairo-default-context-private.h"
 #include "cairo-error-private.h"
+#include "cairo-image-surface-private.h"
 #include "cairo-pattern-private.h"
 #include "cairo-surface-clipper-private.h"
 
commit 6fd174b4233f92fd4a2f490728cbff824c8d404a
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Wed Aug 31 18:29:40 2011 +0200

    perf: Silence gcc warning
    
    Silence:
    
    dragon.c: In function 'do_dragon_solid':
    dragon.c:167: warning: unused variable 'r'

diff --git a/perf/micro/dragon.c b/perf/micro/dragon.c
index 4b16f38..cd5ad9b 100644
--- a/perf/micro/dragon.c
+++ b/perf/micro/dragon.c
@@ -164,7 +164,7 @@ do_dragon (cairo_t *cr, int width, int height, int loops)
 static cairo_perf_ticks_t
 do_dragon_solid (cairo_t *cr, int width, int height, int loops)
 {
-    double cx, cy, r;
+    double cx, cy;
 
     cx = cy = .5 * MAX (width, height);
 


More information about the cairo-commit mailing list