diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-08-03 22:23:19 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-08-06 10:15:40 +0100 |
commit | 0db9e010fa70c65451d324cc9c0ade989f77fedd (patch) | |
tree | e249038d900a7afd7e3ede351517b74fd4be5764 /perf/box-outline.c | |
parent | 60c574ad062f3d8526056942bb7c9e71610a2773 (diff) | |
download | cairo-0db9e010fa70c65451d324cc9c0ade989f77fedd.tar.gz |
[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.
Diffstat (limited to 'perf/box-outline.c')
-rw-r--r-- | perf/box-outline.c | 14 |
1 files changed, 10 insertions, 4 deletions
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 (); } |