about summary refs log tree commit diff
path: root/benchtests/bench-memset-walk.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2017-11-20 17:55:59 +0530
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2017-11-20 18:03:32 +0530
commit4d7632ff687dc60fb9ed38bae682d395017b61a8 (patch)
tree3ee504482bd103ea4adb3cf2368451b133c9266a /benchtests/bench-memset-walk.c
parenta465b89ee82642c193cfd7deb6eb5d999ffaa5b7 (diff)
downloadglibc-4d7632ff687dc60fb9ed38bae682d395017b61a8.tar.gz
glibc-4d7632ff687dc60fb9ed38bae682d395017b61a8.tar.xz
glibc-4d7632ff687dc60fb9ed38bae682d395017b61a8.zip
benchtests: Fix walking sizes and directions for *-walk benchmarks
Make the walking benchmarks walk only backwards since copying both
ways is biased in favour of implementations that use non-temporal
stores for larger sizes; falkor is one of them.  This also fixes up
bugs in computation of the result which ended up multiplying the
length with the timing result unnecessarily.

	* benchtests/bench-memcpy-walk.c (do_one_test): Copy only
	backwards.  Fix timing computation.
	* benchtests/bench-memmove-walk.c (do_one_test): Likewise.
	* benchtests/bench-memset-walk.c (do_one_test): Walk backwards
	on memset by N at a time.  Fix timing computation.
Diffstat (limited to 'benchtests/bench-memset-walk.c')
-rw-r--r--benchtests/bench-memset-walk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/benchtests/bench-memset-walk.c b/benchtests/bench-memset-walk.c
index 59d2626f46..80fbe092b8 100644
--- a/benchtests/bench-memset-walk.c
+++ b/benchtests/bench-memset-walk.c
@@ -66,14 +66,14 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, CHAR *s_end,
   timing_t start, stop, cur;
 
   TIMING_NOW (start);
-  for (i = 0; i < iters && s <= s_end; s++, i++)
+  for (i = 0; i < iters && s <= s_end; s_end -= n, i++)
     CALL (impl, s, c, n);
   TIMING_NOW (stop);
 
   TIMING_DIFF (cur, start, stop);
 
   /* Get time taken per function call.  */
-  json_element_double (json_ctx, (double) cur * n / i);
+  json_element_double (json_ctx, (double) cur / i);
 }
 
 static void