lowlevel-blt-bench: all bench funcs to return pix_cnt
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Wed, 10 Jun 2015 09:53:09 +0000 (12:53 +0300)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Mon, 6 Jul 2015 09:04:22 +0000 (12:04 +0300)
The bench_* functions, that did not already do it, are modified to
return the number of pixels processed during the benchmark. This moves
the computation to the site that actually determines the number, and
simplifies bench_composite() a bit.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ben Avison <bavison@riscosopen.org>
test/lowlevel-blt-bench.c

index 8ad4ebbe407cb63091520ed4d6362071a906f20d..99f83526d758b9bfb5d108ab7e9cec16b264b5d7 100644 (file)
@@ -165,7 +165,7 @@ call_func (pixman_composite_func_t func,
     func (0, &info);
 }
 
-void
+double
 noinline
 bench_L  (pixman_op_t              op,
           pixman_image_t *         src_img,
@@ -204,9 +204,11 @@ bench_L  (pixman_op_t              op,
        call_func (func, op, src_img, mask_img, dst_img, x, 0, x, 0, 63 - x, 0, width, lines_count);
     }
     qx = q;
+
+    return (double)n * lines_count * width;
 }
 
-void
+double
 noinline
 bench_M (pixman_op_t              op,
          pixman_image_t *         src_img,
@@ -224,6 +226,8 @@ bench_M (pixman_op_t              op,
            x = 0;
        call_func (func, op, src_img, mask_img, dst_img, x, 0, x, 0, 1, 0, WIDTH - 64, HEIGHT);
     }
+
+    return (double)n * (WIDTH - 64) * HEIGHT;
 }
 
 double
@@ -476,13 +480,12 @@ bench_composite (const char *testname,
     n = 1 + npix / (l1test_width * 8);
     t1 = gettime ();
 #if EXCLUDE_OVERHEAD
-    bench_L (op, src_img, mask_img, dst_img, n, pixman_image_composite_empty, l1test_width, 1);
+    pix_cnt = bench_L (op, src_img, mask_img, dst_img, n, pixman_image_composite_empty, l1test_width, 1);
 #endif
     t2 = gettime ();
-    bench_L (op, src_img, mask_img, dst_img, n, func, l1test_width, 1);
+    pix_cnt = bench_L (op, src_img, mask_img, dst_img, n, func, l1test_width, 1);
     t3 = gettime ();
-    printf ("  L1:%7.2f", (double)n * l1test_width * 1 /
-            ((t3 - t2) - (t2 - t1)) / 1000000.);
+    printf ("  L1:%7.2f", pix_cnt / ((t3 - t2) - (t2 - t1)) / 1000000.);
     fflush (stdout);
 
     memcpy (dst, src, BUFSIZE);
@@ -495,13 +498,12 @@ bench_composite (const char *testname,
     n = 1 + npix / (l1test_width * nlines);
     t1 = gettime ();
 #if EXCLUDE_OVERHEAD
-    bench_L (op, src_img, mask_img, dst_img, n, pixman_image_composite_empty, l1test_width, nlines);
+    pix_cnt = bench_L (op, src_img, mask_img, dst_img, n, pixman_image_composite_empty, l1test_width, nlines);
 #endif
     t2 = gettime ();
-    bench_L (op, src_img, mask_img, dst_img, n, func, l1test_width, nlines);
+    pix_cnt = bench_L (op, src_img, mask_img, dst_img, n, func, l1test_width, nlines);
     t3 = gettime ();
-    printf ("  L2:%7.2f", (double)n * l1test_width * nlines /
-            ((t3 - t2) - (t2 - t1)) / 1000000.);
+    printf ("  L2:%7.2f", pix_cnt / ((t3 - t2) - (t2 - t1)) / 1000000.);
     fflush (stdout);
 
     memcpy (dst, src, BUFSIZE);
@@ -510,14 +512,14 @@ bench_composite (const char *testname,
     n = 1 + npix / (WIDTH * HEIGHT);
     t1 = gettime ();
 #if EXCLUDE_OVERHEAD
-    bench_M (op, src_img, mask_img, dst_img, n, pixman_image_composite_empty);
+    pix_cnt = bench_M (op, src_img, mask_img, dst_img, n, pixman_image_composite_empty);
 #endif
     t2 = gettime ();
-    bench_M (op, src_img, mask_img, dst_img, n, func);
+    pix_cnt = bench_M (op, src_img, mask_img, dst_img, n, func);
     t3 = gettime ();
     printf ("  M:%6.2f (%6.2f%%)",
-        ((double)n * (WIDTH - 64) * HEIGHT / ((t3 - t2) - (t2 - t1))) / 1000000.,
-        ((double)n * (WIDTH - 64) * HEIGHT / ((t3 - t2) - (t2 - t1)) * bytes_per_pix) * (100.0 / bandwidth) );
+        (pix_cnt / ((t3 - t2) - (t2 - t1))) / 1000000.,
+        (pix_cnt / ((t3 - t2) - (t2 - t1)) * bytes_per_pix) * (100.0 / bandwidth) );
     fflush (stdout);
 
     memcpy (dst, src, BUFSIZE);