From 0db9e010fa70c65451d324cc9c0ade989f77fedd Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 3 Aug 2009 22:23:19 +0100 Subject: [perf] Calibrate tests to run for at least 2 seconds By ensuring that tests take longer than a couple of seconds we eliminate systematic errors in our measurements. However, we also effectively eliminate the synchronisation overhead. To compensate, we attempt to estimate the overhead by reporting the difference between a single instance and the minimum averaged instance. --- perf/box-outline.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'perf/box-outline.c') diff --git a/perf/box-outline.c b/perf/box-outline.c index 2d826e683..6b97b0816 100644 --- a/perf/box-outline.c +++ b/perf/box-outline.c @@ -41,7 +41,7 @@ */ static cairo_perf_ticks_t -box_outline_stroke (cairo_t *cr, int width, int height) +box_outline_stroke (cairo_t *cr, int width, int height, int loops) { cairo_set_source_rgb (cr, 0, 0, 1); /* blue */ cairo_paint (cr); @@ -54,15 +54,18 @@ box_outline_stroke (cairo_t *cr, int width, int height) cairo_perf_timer_start (); - cairo_stroke (cr); + while (loops--) + cairo_stroke_preserve (cr); cairo_perf_timer_stop (); + cairo_new_path (cr); + return cairo_perf_timer_elapsed (); } static cairo_perf_ticks_t -box_outline_fill (cairo_t *cr, int width, int height) +box_outline_fill (cairo_t *cr, int width, int height, int loops) { cairo_set_source_rgb (cr, 0, 0, 1); /* blue */ cairo_paint (cr); @@ -78,10 +81,13 @@ box_outline_fill (cairo_t *cr, int width, int height) cairo_perf_timer_start (); - cairo_fill (cr); + while (loops--) + cairo_fill_preserve (cr); cairo_perf_timer_stop (); + cairo_new_path (cr); + return cairo_perf_timer_elapsed (); } -- cgit v1.2.1