diff options
author | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2018-02-02 09:55:45 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2018-02-02 09:55:45 +0530 |
commit | 3dfcbfa1a4bfa39344e8d945ed1bd697c4c9fe96 (patch) | |
tree | 10aa8a2045fa9230e46e2532ecf0dcac91567779 /benchtests/bench-memcmp.c | |
parent | 39f898c69205ea4dc3ca2e817f797df95d928347 (diff) | |
download | glibc-3dfcbfa1a4bfa39344e8d945ed1bd697c4c9fe96.zip glibc-3dfcbfa1a4bfa39344e8d945ed1bd697c4c9fe96.tar.gz glibc-3dfcbfa1a4bfa39344e8d945ed1bd697c4c9fe96.tar.bz2 |
benchtests: Reallocate buffers for every test run
Keeping the buffers the same across test runs gives later invocations
the advantage since they access cached data. Reallocate so that all
test runs are on equal grounds.
* benchtests/bench-memcmp.c (do_test): Call realloc_buf for
every test run.
Diffstat (limited to 'benchtests/bench-memcmp.c')
-rw-r--r-- | benchtests/bench-memcmp.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/benchtests/bench-memcmp.c b/benchtests/bench-memcmp.c index 38cbdf8..c7255a5 100644 --- a/benchtests/bench-memcmp.c +++ b/benchtests/bench-memcmp.c @@ -110,20 +110,23 @@ do_test (size_t align1, size_t align2, size_t len, int exp_result) if (align2 + (len + 1) * CHARBYTES >= page_size) return; - s1 = (CHAR *) (buf1 + align1); - s2 = (CHAR *) (buf2 + align2); + printf ("Length %4zd, alignment %2zd/%2zd:", len, align1, align2); - for (i = 0; i < len; i++) - s1[i] = s2[i] = 1 + (23 << ((CHARBYTES - 1) * 8)) * i % CHAR__MAX; + FOR_EACH_IMPL (impl, 0) + { + s1 = (CHAR *) (buf1 + align1); + s2 = (CHAR *) (buf2 + align2); - s1[len] = align1; - s2[len] = align2; - s2[len - 1] -= exp_result; + for (i = 0; i < len; i++) + s1[i] = s2[i] = 1 + (23 << ((CHARBYTES - 1) * 8)) * i % CHAR__MAX; - printf ("Length %4zd, alignment %2zd/%2zd:", len, align1, align2); + s1[len] = align1; + s2[len] = align2; + s2[len - 1] -= exp_result; - FOR_EACH_IMPL (impl, 0) - do_one_test (impl, s1, s2, len, exp_result); + do_one_test (impl, s1, s2, len, exp_result); + realloc_bufs (); + } putchar ('\n'); } |