From fe610d559c70ab67f782b122437908ac80788611 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 31 Mar 2010 09:33:30 +0100 Subject: [PATCH] perf/micro: Show megapixel fill rate during paint. --- perf/micro/paint-with-alpha.c | 9 ++++++++- perf/micro/paint.c | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/perf/micro/paint-with-alpha.c b/perf/micro/paint-with-alpha.c index 048cdb010..051d653d3 100644 --- a/perf/micro/paint-with-alpha.c +++ b/perf/micro/paint-with-alpha.c @@ -38,6 +38,12 @@ do_paint_with_alpha (cairo_t *cr, int width, int height, int loops) return cairo_perf_timer_elapsed (); } +static double +count_paint_with_alpha (cairo_t *cr, int width, int height) +{ + return width * height / 1e6; /* Mpix/s */ +} + void paint_with_alpha (cairo_perf_t *perf, cairo_t *cr, int width, int height) { @@ -45,5 +51,6 @@ paint_with_alpha (cairo_perf_t *perf, cairo_t *cr, int width, int height) return; cairo_perf_cover_sources_and_operators (perf, "paint-with-alpha", - do_paint_with_alpha, NULL); + do_paint_with_alpha, + count_paint_with_alpha); } diff --git a/perf/micro/paint.c b/perf/micro/paint.c index ce8cfd370..1ba108fb7 100644 --- a/perf/micro/paint.c +++ b/perf/micro/paint.c @@ -38,11 +38,17 @@ do_paint (cairo_t *cr, int width, int height, int loops) return cairo_perf_timer_elapsed (); } +static double +count_paint (cairo_t *cr, int width, int height) +{ + return width * height / 1e6; /* Mpix/s */ +} + void paint (cairo_perf_t *perf, cairo_t *cr, int width, int height) { if (! cairo_perf_can_run (perf, "paint", NULL)) return; - cairo_perf_cover_sources_and_operators (perf, "paint", do_paint, NULL); + cairo_perf_cover_sources_and_operators (perf, "paint", do_paint, count_paint); }