diff options
author | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2015-06-10 12:41:57 +0300 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2015-07-06 12:04:27 +0300 |
commit | 9a7e0bc6d08c0324f09d6440270cd07201929f3f (patch) | |
tree | a273ac20bb0b4eb7af93f50def27dff59c044de5 /test/lowlevel-blt-bench.c | |
parent | 6e9c48c579e3325506234fa2ee7635f08f2c5a33 (diff) | |
download | pixman-9a7e0bc6d08c0324f09d6440270cd07201929f3f.tar.gz |
lowlevel-blt-bench: refactor to Mpx_per_sec()
Refactor the Mpixels/s computations into a function. Easier to read and
better documents what is being computed.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ben Avison <bavison@riscosopen.org>
Diffstat (limited to 'test/lowlevel-blt-bench.c')
-rw-r--r-- | test/lowlevel-blt-bench.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/test/lowlevel-blt-bench.c b/test/lowlevel-blt-bench.c index 99f8352..33d3ba2 100644 --- a/test/lowlevel-blt-bench.c +++ b/test/lowlevel-blt-bench.c @@ -370,6 +370,15 @@ bench_RT (pixman_op_t op, return pix_cnt; } +static double +Mpx_per_sec (double pix_cnt, double t1, double t2, double t3) +{ + double overhead = t2 - t1; + double testtime = t3 - t2; + + return pix_cnt / (testtime - overhead) / 1e6; +} + void bench_composite (const char *testname, int src_fmt, @@ -485,7 +494,7 @@ bench_composite (const char *testname, t2 = gettime (); pix_cnt = bench_L (op, src_img, mask_img, dst_img, n, func, l1test_width, 1); t3 = gettime (); - printf (" L1:%7.2f", pix_cnt / ((t3 - t2) - (t2 - t1)) / 1000000.); + printf (" L1:%7.2f", Mpx_per_sec (pix_cnt, t1, t2, t3)); fflush (stdout); memcpy (dst, src, BUFSIZE); @@ -503,7 +512,7 @@ bench_composite (const char *testname, t2 = gettime (); pix_cnt = bench_L (op, src_img, mask_img, dst_img, n, func, l1test_width, nlines); t3 = gettime (); - printf (" L2:%7.2f", pix_cnt / ((t3 - t2) - (t2 - t1)) / 1000000.); + printf (" L2:%7.2f", Mpx_per_sec (pix_cnt, t1, t2, t3)); fflush (stdout); memcpy (dst, src, BUFSIZE); @@ -518,7 +527,7 @@ bench_composite (const char *testname, pix_cnt = bench_M (op, src_img, mask_img, dst_img, n, func); t3 = gettime (); printf (" M:%6.2f (%6.2f%%)", - (pix_cnt / ((t3 - t2) - (t2 - t1))) / 1000000., + Mpx_per_sec (pix_cnt, t1, t2, t3), (pix_cnt / ((t3 - t2) - (t2 - t1)) * bytes_per_pix) * (100.0 / bandwidth) ); fflush (stdout); @@ -533,7 +542,7 @@ bench_composite (const char *testname, t2 = gettime (); pix_cnt = bench_HT (op, src_img, mask_img, dst_img, n, func); t3 = gettime (); - printf (" HT:%6.2f", (double)pix_cnt / ((t3 - t2) - (t2 - t1)) / 1000000.); + printf (" HT:%6.2f", Mpx_per_sec (pix_cnt, t1, t2, t3)); fflush (stdout); memcpy (dst, src, BUFSIZE); @@ -547,7 +556,7 @@ bench_composite (const char *testname, t2 = gettime (); pix_cnt = bench_VT (op, src_img, mask_img, dst_img, n, func); t3 = gettime (); - printf (" VT:%6.2f", (double)pix_cnt / ((t3 - t2) - (t2 - t1)) / 1000000.); + printf (" VT:%6.2f", Mpx_per_sec (pix_cnt, t1, t2, t3)); fflush (stdout); memcpy (dst, src, BUFSIZE); @@ -561,7 +570,7 @@ bench_composite (const char *testname, t2 = gettime (); pix_cnt = bench_R (op, src_img, mask_img, dst_img, n, func, WIDTH, HEIGHT); t3 = gettime (); - printf (" R:%6.2f", (double)pix_cnt / ((t3 - t2) - (t2 - t1)) / 1000000.); + printf (" R:%6.2f", Mpx_per_sec (pix_cnt, t1, t2, t3)); fflush (stdout); memcpy (dst, src, BUFSIZE); @@ -575,7 +584,7 @@ bench_composite (const char *testname, t2 = gettime (); pix_cnt = bench_RT (op, src_img, mask_img, dst_img, n, func, WIDTH, HEIGHT); t3 = gettime (); - printf (" RT:%6.2f (%4.0fKops/s)\n", (double)pix_cnt / ((t3 - t2) - (t2 - t1)) / 1000000., (double) n / ((t3 - t2) * 1000)); + printf (" RT:%6.2f (%4.0fKops/s)\n", Mpx_per_sec (pix_cnt, t1, t2, t3), (double) n / ((t3 - t2) * 1000)); if (mask_img) { pixman_image_unref (mask_img); |