summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>2015-06-10 13:54:01 +0300
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2015-07-06 12:04:50 +0300
commite2d211ac491cd9884aae7ccaf18e5b3042469cf2 (patch)
tree9ec605e37c6b0b0d38b6f5cc8065b437b8471efc
parent31cb0d4267f4f358b62f75fd42c4b1ae625be7ee (diff)
lowlevel-blt-bench: add option to skip memcpy measurement
The memcpy speed measurement takes several seconds. When you are running single tests in a harness that iterates dozens or hundreds of times, the repeated measurements are redundant and take a lot of time. It is also an open question whether the measured speed changes over long test runs due to unidentified platform reasons (Raspberry Pi). Add a command line option to set the reference memcpy speed, skipping the measuring. The speed is mainly used to compute how many iterations do run inside the bench_*() functions, so for repeated testing on the same hardware, it makes sense to lock that number to a constant. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Ben Avison <bavison@riscosopen.org>
-rw-r--r--test/lowlevel-blt-bench.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/lowlevel-blt-bench.c b/test/lowlevel-blt-bench.c
index 17e5ec4..fc7472f 100644
--- a/test/lowlevel-blt-bench.c
+++ b/test/lowlevel-blt-bench.c
@@ -55,7 +55,7 @@ uint32_t *dst;
uint32_t *src;
uint32_t *mask;
-double bandwidth = 0;
+double bandwidth = 0.0;
double
bench_memcpy ()
@@ -1086,10 +1086,11 @@ print_speed_scaling (double bw)
static void
usage (const char *progname)
{
- printf ("Usage: %s [-b] [-n] [-c] pattern\n", progname);
+ printf ("Usage: %s [-b] [-n] [-c] [-m M] pattern\n", progname);
printf (" -n : benchmark nearest scaling\n");
printf (" -b : benchmark bilinear scaling\n");
printf (" -c : print output as CSV data\n");
+ printf (" -m M : set reference memcpy speed to M MB/s instead of measuring it\n");
}
int
@@ -1115,6 +1116,9 @@ main (int argc, char *argv[])
if (strchr (argv[i] + 1, 'c'))
use_csv_output = TRUE;
+
+ if (strcmp (argv[i], "-m") == 0 && i + 1 < argc)
+ bandwidth = atof (argv[++i]) * 1e6;
}
else
{
@@ -1138,7 +1142,8 @@ main (int argc, char *argv[])
if (!use_csv_output)
print_explanation ();
- bandwidth = bench_memcpy ();
+ if (bandwidth < 1.0)
+ bandwidth = bench_memcpy ();
if (!use_csv_output)
print_speed_scaling (bandwidth);