about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilco Dijkstra <wilco.dijkstra@arm.com>2023-03-21 14:00:22 +0000
committerWilco Dijkstra <wilco.dijkstra@arm.com>2023-04-17 13:00:38 +0100
commit2623479105a7e11ccd1e504b3f549cadbb875a42 (patch)
tree6d06b43c729909296a27f7f8638b32b32bc5a02d
parente2756903329365134089d23548e9083d23bc3dd9 (diff)
downloadglibc-2623479105a7e11ccd1e504b3f549cadbb875a42.tar.gz
glibc-2623479105a7e11ccd1e504b3f549cadbb875a42.tar.xz
glibc-2623479105a7e11ccd1e504b3f549cadbb875a42.zip
Benchtests: Adjust timing
Adjust iteration counts so benchmarks don't run too slowly or quickly.
Ensure benchmarks take less than 10 seconds on older, slower cores and
more than 0.5 seconds on fast cores.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
-rw-r--r--benchtests/bench-bzero.c2
-rw-r--r--benchtests/bench-hash-funcs.c2
-rw-r--r--benchtests/bench-memccpy.c2
-rw-r--r--benchtests/bench-memchr.c2
-rw-r--r--benchtests/bench-memcpy-random.c2
-rw-r--r--benchtests/bench-memcpy.c2
-rw-r--r--benchtests/bench-memset.c2
-rw-r--r--benchtests/bench-strcat.c2
-rw-r--r--benchtests/bench-strcmp.c2
-rw-r--r--benchtests/bench-strlen.c2
-rw-r--r--benchtests/bench-strncpy.c2
11 files changed, 11 insertions, 11 deletions
diff --git a/benchtests/bench-bzero.c b/benchtests/bench-bzero.c
index 7ff04f2d2f..5e891ce875 100644
--- a/benchtests/bench-bzero.c
+++ b/benchtests/bench-bzero.c
@@ -51,7 +51,7 @@ IMPL (memset_zero, 0)
 static void
 do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, size_t n)
 {
-  size_t i, iters = INNER_LOOP_ITERS_LARGE;
+  size_t i, iters = INNER_LOOP_ITERS8;
   timing_t start, stop, cur;
 
   TIMING_NOW (start);
diff --git a/benchtests/bench-hash-funcs.c b/benchtests/bench-hash-funcs.c
index 5e7e502230..4a6858c021 100644
--- a/benchtests/bench-hash-funcs.c
+++ b/benchtests/bench-hash-funcs.c
@@ -42,7 +42,7 @@ enum
 {
   NFIXED_ITERS = 1048576,
   NRAND_BUFS = 16384,
-  NRAND_ITERS = 2048,
+  NRAND_ITERS = 256,
   RAND_BENCH_MAX_LEN = 128
 };
 
diff --git a/benchtests/bench-memccpy.c b/benchtests/bench-memccpy.c
index 51ed8dad2f..a26ed7eee2 100644
--- a/benchtests/bench-memccpy.c
+++ b/benchtests/bench-memccpy.c
@@ -41,7 +41,7 @@ static void
 do_one_test (impl_t *impl, void *dst, const void *src, int c, size_t len,
 	     size_t n)
 {
-  size_t i, iters = INNER_LOOP_ITERS_LARGE;
+  size_t i, iters = INNER_LOOP_ITERS_LARGE * 4;
   timing_t start, stop, cur;
 
   TIMING_NOW (start);
diff --git a/benchtests/bench-memchr.c b/benchtests/bench-memchr.c
index 90bd3879e3..1a9bf51118 100644
--- a/benchtests/bench-memchr.c
+++ b/benchtests/bench-memchr.c
@@ -51,7 +51,7 @@ static void
 do_one_test (json_ctx_t *json_ctx, impl_t *impl, const CHAR *s, int c,
 	     size_t n)
 {
-  size_t i, iters = INNER_LOOP_ITERS;
+  size_t i, iters = INNER_LOOP_ITERS8 / 2;
   timing_t start, stop, cur;
 
   TIMING_NOW (start);
diff --git a/benchtests/bench-memcpy-random.c b/benchtests/bench-memcpy-random.c
index a0753b60e0..48cb64d533 100644
--- a/benchtests/bench-memcpy-random.c
+++ b/benchtests/bench-memcpy-random.c
@@ -127,7 +127,7 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, char *src,
 	     copy_t *copy, size_t n)
 {
   timing_t start, stop, cur;
-  size_t iters = INNER_LOOP_ITERS_MEDIUM;
+  size_t iters = INNER_LOOP_ITERS_MEDIUM / 2;
 
   for (int j = 0; j < n; j++)
     CALL (impl, dst + copy[j].dst, src + copy[j].src, copy[j].len);
diff --git a/benchtests/bench-memcpy.c b/benchtests/bench-memcpy.c
index 1fd41c035f..5be09966e0 100644
--- a/benchtests/bench-memcpy.c
+++ b/benchtests/bench-memcpy.c
@@ -38,7 +38,7 @@ static void
 do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, const char *src,
 	     size_t len)
 {
-  size_t i, iters = INNER_LOOP_ITERS;
+  size_t i, iters = INNER_LOOP_ITERS / 2;
   timing_t start, stop, cur;
   for (i = 0; i < iters / 64; ++i)
     {
diff --git a/benchtests/bench-memset.c b/benchtests/bench-memset.c
index 1e785e6c8f..e68b14201e 100644
--- a/benchtests/bench-memset.c
+++ b/benchtests/bench-memset.c
@@ -43,7 +43,7 @@ static void
 do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s,
 	     int c __attribute ((unused)), size_t n)
 {
-  size_t i, iters = INNER_LOOP_ITERS_LARGE;
+  size_t i, iters = INNER_LOOP_ITERS;
   timing_t start, stop, cur;
 
   TIMING_NOW (start);
diff --git a/benchtests/bench-strcat.c b/benchtests/bench-strcat.c
index 96383ce06a..08a19e53c9 100644
--- a/benchtests/bench-strcat.c
+++ b/benchtests/bench-strcat.c
@@ -52,7 +52,7 @@ IMPL (generic_strcat, 0)
 static void
 do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *dst, const CHAR *src)
 {
-  size_t k = STRLEN (dst), i, iters = INNER_LOOP_ITERS_LARGE;
+  size_t k = STRLEN (dst), i, iters = INNER_LOOP_ITERS_LARGE / CHARBYTES;
   timing_t start, stop, cur;
 
   if (CALL (impl, dst, src) != dst)
diff --git a/benchtests/bench-strcmp.c b/benchtests/bench-strcmp.c
index 65fd04b43a..f696f074fc 100644
--- a/benchtests/bench-strcmp.c
+++ b/benchtests/bench-strcmp.c
@@ -50,7 +50,7 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl,
 	     const CHAR *s1, const CHAR *s2,
 	     int exp_result)
 {
-  size_t i, iters = INNER_LOOP_ITERS;
+  size_t i, iters = INNER_LOOP_ITERS8 / 2;
   timing_t start, stop, cur;
 
   TIMING_NOW (start);
diff --git a/benchtests/bench-strlen.c b/benchtests/bench-strlen.c
index 9b91f8a10e..cae88dd6ec 100644
--- a/benchtests/bench-strlen.c
+++ b/benchtests/bench-strlen.c
@@ -48,7 +48,7 @@ IMPL (STRLEN, 1)
 static void
 do_one_test (json_ctx_t *json_ctx, impl_t *impl, const CHAR *s, size_t exp_len)
 {
-  size_t len = CALL (impl, s), i, iters = INNER_LOOP_ITERS8;
+  size_t len = CALL (impl, s), i, iters = INNER_LOOP_ITERS_LARGE;
   timing_t start, stop, cur;
 
   if (len != exp_len)
diff --git a/benchtests/bench-strncpy.c b/benchtests/bench-strncpy.c
index 83a88f6583..d90e3c55e2 100644
--- a/benchtests/bench-strncpy.c
+++ b/benchtests/bench-strncpy.c
@@ -57,7 +57,7 @@ static void
 do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *dst, const CHAR *src,
 	     size_t len, size_t n)
 {
-  size_t i, iters = INNER_LOOP_ITERS_LARGE * (4 / CHARBYTES);
+  size_t i, iters = INNER_LOOP_ITERS_LARGE / CHARBYTES;
   timing_t start, stop, cur;
 
   if (CALL (impl, dst, src, n) != STRNCPY_RESULT (dst, len, n))