diff options
author | Siddhesh Poyarekar <siddhesh@redhat.com> | 2013-06-04 18:11:43 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@redhat.com> | 2013-06-11 15:08:13 +0530 |
commit | fec799f823100646f535c5e24128c648cba4c2c5 (patch) | |
tree | 879cc54a136654f9fc77d4a43ad9666730e1e63b | |
parent | 9702047480d9002522936c5e1e1ebe16f696880d (diff) | |
download | glibc-fec799f823100646f535c5e24128c648cba4c2c5.tar.gz glibc-fec799f823100646f535c5e24128c648cba4c2c5.tar.xz glibc-fec799f823100646f535c5e24128c648cba4c2c5.zip |
Remove performance-related bits from string tests
-rw-r--r-- | ChangeLog | 53 | ||||
-rw-r--r-- | string/test-memccpy.c | 24 | ||||
-rw-r--r-- | string/test-memchr.c | 24 | ||||
-rw-r--r-- | string/test-memcmp.c | 24 | ||||
-rw-r--r-- | string/test-memcpy.c | 24 | ||||
-rw-r--r-- | string/test-memmem.c | 30 | ||||
-rw-r--r-- | string/test-memmove.c | 28 | ||||
-rw-r--r-- | string/test-memset.c | 29 | ||||
-rw-r--r-- | string/test-rawmemchr.c | 24 | ||||
-rw-r--r-- | string/test-strcasecmp.c | 24 | ||||
-rw-r--r-- | string/test-strcasestr.c | 25 | ||||
-rw-r--r-- | string/test-strcat.c | 25 | ||||
-rw-r--r-- | string/test-strchr.c | 25 | ||||
-rw-r--r-- | string/test-strcmp.c | 24 | ||||
-rw-r--r-- | string/test-strcpy.c | 24 | ||||
-rw-r--r-- | string/test-string.h | 14 | ||||
-rw-r--r-- | string/test-strlen.c | 24 | ||||
-rw-r--r-- | string/test-strncasecmp.c | 24 | ||||
-rw-r--r-- | string/test-strncat.c | 25 | ||||
-rw-r--r-- | string/test-strncmp.c | 35 | ||||
-rw-r--r-- | string/test-strncpy.c | 24 | ||||
-rw-r--r-- | string/test-strnlen.c | 24 | ||||
-rw-r--r-- | string/test-strpbrk.c | 24 | ||||
-rw-r--r-- | string/test-strrchr.c | 24 | ||||
-rw-r--r-- | string/test-strspn.c | 24 | ||||
-rw-r--r-- | string/test-strstr.c | 24 |
26 files changed, 53 insertions, 620 deletions
diff --git a/ChangeLog b/ChangeLog index 21b17aa324..5ef08f2422 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,58 @@ 2013-06-11 Siddhesh Poyarekar <siddhesh@redhat.com> + * string/test-memccpy.c (do_one_test): Remove HP_TIMING code. + (do_test): Likewise. + * string/test-memchr.c (do_one_test): Likewise. + (do_test): Likewise. + * string/test-memcmp.c (do_one_test): Likewise. + (do_test): Likewise. + * string/test-memcpy.c (do_one_test): Likewise. + (do_test): Likewise. + * string/test-memmem.c (do_one_test): Likewise. + (do_test): Likewise. + (do_random_tests): Likewise. + * string/test-memmove.c (do_one_test): Likewise. + (do_test): Likewise. + * string/test-memset.c (do_one_test): Likewise. + (do_test): Likewise. + * string/test-rawmemchr.c (do_one_test): Likewise. + (do_test): Likewise. + * string/test-strcasecmp.c (do_one_test): Likewise. + (do_test): Likewise. + * string/test-strcasestr.c (do_one_test): Likewise. + (do_test): Likewise. + * string/test-strcat.c (do_one_test): Likewise. + (do_test): Likewise. + * string/test-strchr.c (do_one_test): Likewise. + (do_test): Likewise. + * string/test-strcmp.c (do_one_test): Likewise. + (do_test): Likewise. + * string/test-strcpy.c (do_one_test): Likewise. + (do_test): Likewise. + * string/test-string.h: Likewise. + (test_init): Likewise. + * string/test-strlen.c (do_one_test): Likewise. + (do_test): Likewise. + * string/test-strncasecmp.c (do_one_test): Likewise. + (do_test): Likewise. + * string/test-strncat.c (do_one_test): Likewise. + (do_test): Likewise. + * string/test-strncmp.c (do_one_test): Likewise. + (do_test_limit): Likewise. + (do_test): Likewise. + * string/test-strncpy.c (do_one_test): Likewise. + (do_test): Likewise. + * string/test-strnlen.c (do_one_test): Likewise. + (do_test): Likewise. + * string/test-strpbrk.c (do_one_test): Likewise. + (do_test): Likewise. + * string/test-strrchr.c (do_one_test): Likewise. + (do_test): Likewise. + * string/test-strspn.c (do_one_test): Likewise. + (do_test): Likewise. + * string/test-strstr.c (do_one_test): Likewise. + (do_test): Likewise. + * benchtests/Makefile (string-bench): Add string benchmarks. * benchtests/bench-bcopy-ifunc.c: New file. * benchtests/bench-bcopy.c: New file. diff --git a/string/test-memccpy.c b/string/test-memccpy.c index 577a82efe0..a3f20a8c48 100644 --- a/string/test-memccpy.c +++ b/string/test-memccpy.c @@ -74,24 +74,6 @@ do_one_test (impl_t *impl, void *dst, const void *src, int c, size_t len, ret = 1; return; } - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute__ ((unused)); - hp_timing_t stop __attribute__ ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); - CALL (impl, dst, src, c, n); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -122,14 +104,8 @@ do_test (size_t align1, size_t align2, int c, size_t len, size_t n, for (i = len; i + align1 < page_size && i < len + 64; ++i) s1[i] = 32 + 32 * i % (max_char - 32); - if (HP_TIMING_AVAIL) - printf ("Length %4zd, n %4zd, char %d, alignment %2zd/%2zd:", len, n, c, align1, align2); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, s2, s1, c, len, n); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-memchr.c b/string/test-memchr.c index dffc858624..bc1767c692 100644 --- a/string/test-memchr.c +++ b/string/test-memchr.c @@ -47,24 +47,6 @@ do_one_test (impl_t *impl, const char *s, int c, size_t n, char *exp_res) ret = 1; return; } - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); - CALL (impl, s, c, n); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -97,14 +79,8 @@ do_test (size_t align, size_t pos, size_t len, int seek_char) buf1[align + len] = seek_char; } - if (HP_TIMING_AVAIL) - printf ("Length %4zd, alignment %2zd:", pos, align); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, (char *) (buf1 + align), seek_char, len, result); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-memcmp.c b/string/test-memcmp.c index 654dfa22f3..b30e34d0e4 100644 --- a/string/test-memcmp.c +++ b/string/test-memcmp.c @@ -100,24 +100,6 @@ do_one_test (impl_t *impl, const CHAR *s1, const CHAR *s2, size_t len, { if (check_result (impl, s1, s2, len, exp_result) < 0) return; - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); - CALL (impl, s1, s2, len); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -147,14 +129,8 @@ do_test (size_t align1, size_t align2, size_t len, int exp_result) s2[len] = align2; s2[len - 1] -= exp_result; - if (HP_TIMING_AVAIL) - printf ("Length %4zd, alignment %2zd/%2zd:", len, align1, align2); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, s1, s2, len, exp_result); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-memcpy.c b/string/test-memcpy.c index eb9c308059..d121ef02a5 100644 --- a/string/test-memcpy.c +++ b/string/test-memcpy.c @@ -68,24 +68,6 @@ do_one_test (impl_t *impl, char *dst, const char *src, ret = 1; return; } - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); - CALL (impl, dst, src, len); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -108,14 +90,8 @@ do_test (size_t align1, size_t align2, size_t len) for (i = 0, j = 1; i < len; i++, j += 23) s1[i] = j; - if (HP_TIMING_AVAIL) - printf ("Length %4zd, alignment %2zd/%2zd:", len, align1, align2); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, s2, s1, len); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-memmem.c b/string/test-memmem.c index fec8b55990..d98ede79e3 100644 --- a/string/test-memmem.c +++ b/string/test-memmem.c @@ -82,24 +82,6 @@ do_one_test (impl_t *impl, const void *haystack, size_t haystack_len, if (check_result (impl, haystack, haystack_len, needle, needle_len, expected) < 0) return; - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); - CALL (impl, haystack, haystack_len, needle, needle_len); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -110,16 +92,10 @@ do_test (const char *str, size_t len, size_t idx) memcpy (tmpbuf, buf1 + idx, len); memcpy (buf1 + idx, str, len); - if (HP_TIMING_AVAIL) - printf ("String %s, offset %zd:", str, idx); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, buf1, BUF1PAGES * page_size, str, len, buf1 + idx); memcpy (buf1 + idx, tmpbuf, len); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void @@ -143,16 +119,10 @@ do_random_tests (void) buf1[idx + off] = ch; } - if (HP_TIMING_AVAIL) - printf ("String %.*s, offset %zd:", (int) len, buf1 + idx, idx); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, buf1, BUF1PAGES * page_size, buf1 + idx, len, buf1 + idx); - if (HP_TIMING_AVAIL) - putchar ('\n'); - memcpy (buf1 + idx, tmpbuf, len); } } diff --git a/string/test-memmove.c b/string/test-memmove.c index e47446cece..4ec55b2fcc 100644 --- a/string/test-memmove.c +++ b/string/test-memmove.c @@ -90,28 +90,6 @@ do_one_test (impl_t *impl, char *dst, char *src, const char *orig_src, ret = 1; return; } - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); -#ifdef TEST_BCOPY - CALL (impl, src, dst, len); -#else - CALL (impl, dst, src, len); -#endif - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -134,14 +112,8 @@ do_test (size_t align1, size_t align2, size_t len) for (i = 0, j = 1; i < len; i++, j += 23) s1[i] = j; - if (HP_TIMING_AVAIL) - printf ("Length %4zd, alignment %2zd/%2zd:", len, align1, align2); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, s2, (char *) (buf2 + align1), s1, len); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-memset.c b/string/test-memset.c index 969772dec7..9981fcef46 100644 --- a/string/test-memset.c +++ b/string/test-memset.c @@ -91,29 +91,6 @@ do_one_test (impl_t *impl, char *s, int c __attribute ((unused)), size_t n) ret = 1; return; } - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); -#ifdef TEST_BZERO - CALL (impl, s, n); -#else - CALL (impl, s, c, n); -#endif - - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -123,14 +100,8 @@ do_test (size_t align, int c, size_t len) if (align + len > page_size) return; - if (HP_TIMING_AVAIL) - printf ("Length %4zd, alignment %2zd, c %2d:", len, align, c); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, (char *) buf1 + align, c, len); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } #ifndef TEST_BZERO diff --git a/string/test-rawmemchr.c b/string/test-rawmemchr.c index ebfd678328..9e4952f7c7 100644 --- a/string/test-rawmemchr.c +++ b/string/test-rawmemchr.c @@ -49,24 +49,6 @@ do_one_test (impl_t *impl, const char *s, int c, char *exp_res) ret = 1; return; } - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); - CALL (impl, s, c); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -93,14 +75,8 @@ do_test (size_t align, size_t pos, size_t len, int seek_char) buf1[align + len] = -seek_char; result = (char *) (buf1 + align + pos); - if (HP_TIMING_AVAIL) - printf ("Length %4zd, alignment %2zd:", pos, align); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, (char *) (buf1 + align), seek_char, result); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-strcasecmp.c b/string/test-strcasecmp.c index ed49733fd6..f32150198f 100644 --- a/string/test-strcasecmp.c +++ b/string/test-strcasecmp.c @@ -73,24 +73,6 @@ do_one_test (impl_t *impl, const char *s1, const char *s2, int exp_result) ret = 1; return; } - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); - CALL (impl, s1, s2); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -129,14 +111,8 @@ do_test (size_t align1, size_t align2, size_t len, int max_char, else s2[len - 1] -= exp_result; - if (HP_TIMING_AVAIL) - printf ("Length %4zd, alignment %2zd/%2zd:", len, align1, align2); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, s1, s2, exp_result); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-strcasestr.c b/string/test-strcasestr.c index 85e65fad5c..5b1d827a05 100644 --- a/string/test-strcasestr.c +++ b/string/test-strcasestr.c @@ -78,24 +78,6 @@ do_one_test (impl_t *impl, const char *s1, const char *s2, char *exp_result) { if (check_result (impl, s1, s2, exp_result) < 0) return; - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~(hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); - CALL (impl, s1, s2); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } @@ -135,15 +117,8 @@ do_test (size_t align1, size_t align2, size_t len1, size_t len2, } s1[len1] = '\0'; - if (HP_TIMING_AVAIL) - printf ("Length %4zd/%zd, alignment %2zd/%2zd, %s:", - len1, len2, align1, align2, fail ? "fail" : "found"); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, s1, s2, fail ? NULL : s1 + len1 - len2); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-strcat.c b/string/test-strcat.c index 7a47a4b96c..89fc90d1d0 100644 --- a/string/test-strcat.c +++ b/string/test-strcat.c @@ -56,25 +56,6 @@ do_one_test (impl_t *impl, char *dst, const char *src) ret = 1; return; } - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - dst[k] = '\0'; - HP_TIMING_NOW (start); - CALL (impl, dst, src); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -101,17 +82,11 @@ do_test (size_t align1, size_t align2, size_t len1, size_t len2, int max_char) for (i = 0; i < len2; i++) s2[i] = 32 + 23 * i % (max_char - 32); - if (HP_TIMING_AVAIL) - printf ("Length %4zd/%4zd, alignment %2zd/%2zd:", len1, len2, align1, align2); - FOR_EACH_IMPL (impl, 0) { s2[len2] = '\0'; do_one_test (impl, s2, s1); } - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-strchr.c b/string/test-strchr.c index deca51692c..cbcf53ef80 100644 --- a/string/test-strchr.c +++ b/string/test-strchr.c @@ -107,24 +107,6 @@ do_one_test (impl_t *impl, const CHAR *s, int c, const CHAR *exp_res) { if (check_result (impl, s, c, exp_res) < 0) return; - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); - CALL (impl, s, c); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -160,15 +142,8 @@ do_test (size_t align, size_t pos, size_t len, int seek_char, int max_char) else result = NULLRET (buf + align + len); - if (HP_TIMING_AVAIL) - printf ("Length %4zd, alignment in bytes %2zd:", - pos, align * sizeof (CHAR)); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, buf + align, seek_char, result); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-strcmp.c b/string/test-strcmp.c index d9b69fa830..f666993929 100644 --- a/string/test-strcmp.c +++ b/string/test-strcmp.c @@ -161,24 +161,6 @@ do_one_test (impl_t *impl, { if (check_result (impl, s1, s2, exp_result) < 0) return; - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); - CALL (impl, s1, s2); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -214,14 +196,8 @@ do_test (size_t align1, size_t align2, size_t len, int max_char, s2[len + 1] = 24 + exp_result; s2[len - 1] -= exp_result; - if (HP_TIMING_AVAIL) - printf ("Length %4zd, alignment %2zd/%2zd:", len, align1, align2); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, s1, s2, exp_result); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-strcpy.c b/string/test-strcpy.c index a48ccbca8c..d97326795b 100644 --- a/string/test-strcpy.c +++ b/string/test-strcpy.c @@ -92,24 +92,6 @@ do_one_test (impl_t *impl, CHAR *dst, const CHAR *src, ret = 1; return; } - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused));; - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); - CALL (impl, dst, src); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -135,14 +117,8 @@ do_test (size_t align1, size_t align2, size_t len, int max_char) s1[i] = 32 + 23 * i % (max_char - 32); s1[len] = 0; - if (HP_TIMING_AVAIL) - printf ("Length %4zd, alignments in bytes %2zd/%2zd:", len, align1 * sizeof(CHAR), align2 * sizeof(CHAR)); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, s2, s1, len); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-string.h b/string/test-string.h index 47659d0804..afb6980d59 100644 --- a/string/test-string.h +++ b/string/test-string.h @@ -53,7 +53,6 @@ extern impl_t __start_impls[], __stop_impls[]; #include <ifunc-impl-list.h> #define GL(x) _##x #define GLRO(x) _##x -#include <hp-timing.h> # define TEST_FUNCTION test_main () @@ -67,8 +66,6 @@ int ret, do_srandom; unsigned int seed; size_t page_size; -hp_timing_t _dl_hp_timing_overhead; - # ifndef ITERATIONS size_t iterations = 100000; # define ITERATIONS_OPTIONS \ @@ -159,16 +156,6 @@ static impl_t *impl_array; if (!notall || impl->test) #endif -#define HP_TIMING_BEST(best_time, start, end) \ - do \ - { \ - hp_timing_t tmptime; \ - HP_TIMING_DIFF (tmptime, start + _dl_hp_timing_overhead, end); \ - if (best_time > tmptime) \ - best_time = tmptime; \ - } \ - while (0) - #ifndef BUF1PAGES # define BUF1PAGES 1 #endif @@ -199,7 +186,6 @@ test_init (void) error (EXIT_FAILURE, errno, "mmap failed"); if (mprotect (buf2 + page_size, page_size, PROT_NONE)) error (EXIT_FAILURE, errno, "mprotect failed"); - HP_TIMING_DIFF_INIT (); if (do_srandom) { printf ("Setting seed to 0x%x\n", seed); diff --git a/string/test-strlen.c b/string/test-strlen.c index be2a7f930d..f8b791d0f2 100644 --- a/string/test-strlen.c +++ b/string/test-strlen.c @@ -72,24 +72,6 @@ do_one_test (impl_t *impl, const CHAR *s, size_t exp_len) ret = 1; return; } - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); - CALL (impl, s); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -107,14 +89,8 @@ do_test (size_t align, size_t len) buf[align + i] = 1 + 11111 * i % MAX_CHAR; buf[align + len] = 0; - if (HP_TIMING_AVAIL) - printf ("Length %4zd, alignment %2zd:", len, align); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, (CHAR *) (buf + align), len); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-strncasecmp.c b/string/test-strncasecmp.c index 3b39085985..4eedd3d022 100644 --- a/string/test-strncasecmp.c +++ b/string/test-strncasecmp.c @@ -94,24 +94,6 @@ do_one_test (impl_t *impl, const char *s1, const char *s2, size_t n, { if (check_result (impl, s1, s2, n, exp_result) < 0) return; - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); - CALL (impl, s1, s2, n); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -150,14 +132,8 @@ do_test (size_t align1, size_t align2, size_t n, size_t len, int max_char, else s2[len - 1] -= exp_result; - if (HP_TIMING_AVAIL) - printf ("Length %4zd, alignment %2zd/%2zd:", len, align1, align2); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, s1, s2, n, exp_result); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-strncat.c b/string/test-strncat.c index 41d409b043..6cdd5e723e 100644 --- a/string/test-strncat.c +++ b/string/test-strncat.c @@ -67,24 +67,6 @@ do_one_test (impl_t *impl, char *dst, const char *src, size_t n) ret = 1; return; } - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - dst[k] = '\0'; - HP_TIMING_NOW (start); - CALL (impl, dst, src, n); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -114,18 +96,11 @@ do_test (size_t align1, size_t align2, size_t len1, size_t len2, for (i = 0; i < len2; i++) s2[i] = 32 + 23 * i % (max_char - 32); - if (HP_TIMING_AVAIL) - printf ("Length %4zd/%4zd, alignment %2zd/%2zd, N %4zd:", - len1, len2, align1, align2, n); - FOR_EACH_IMPL (impl, 0) { s2[len2] = '\0'; do_one_test (impl, s2, s1, n); } - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-strncmp.c b/string/test-strncmp.c index 74b0dd4db6..47c33e33b4 100644 --- a/string/test-strncmp.c +++ b/string/test-strncmp.c @@ -75,24 +75,6 @@ do_one_test (impl_t *impl, const char *s1, const char *s2, size_t n, { if (check_result (impl, s1, s2, n, exp_result) < 0) return; - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); - CALL (impl, s1, s2, n); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -106,15 +88,10 @@ do_test_limit (size_t align1, size_t align2, size_t len, size_t n, int max_char, { s1 = (char*)(buf1 + page_size); s2 = (char*)(buf2 + page_size); - if (HP_TIMING_AVAIL) - printf ("Length %4zd/%4zd:", len, n); FOR_EACH_IMPL (impl, 0) do_one_test (impl, s1, s2, n, 0); - if (HP_TIMING_AVAIL) - putchar ('\n'); - return; } @@ -144,14 +121,8 @@ do_test_limit (size_t align1, size_t align2, size_t len, size_t n, int max_char, s1[len] = 64; } - if (HP_TIMING_AVAIL) - printf ("Length %4zd/%4zd, alignment %2zd/%2zd:", len, n, align1, align2); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, s1, s2, n, exp_result); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void @@ -189,14 +160,8 @@ do_test (size_t align1, size_t align2, size_t len, size_t n, int max_char, if (len >= n) s2[n - 1] -= exp_result; - if (HP_TIMING_AVAIL) - printf ("Length %4zd/%4zd, alignment %2zd/%2zd:", len, n, align1, align2); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, (char*)s1, (char*)s2, n, exp_result); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-strncpy.c b/string/test-strncpy.c index 107daadb9b..ac0e0004db 100644 --- a/string/test-strncpy.c +++ b/string/test-strncpy.c @@ -90,24 +90,6 @@ do_one_test (impl_t *impl, char *dst, const char *src, size_t len, size_t n) return; } } - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute__ ((unused)); - hp_timing_t stop __attribute__ ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); - CALL (impl, dst, src, n); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -133,14 +115,8 @@ do_test (size_t align1, size_t align2, size_t len, size_t n, int max_char) for (i = len + 1; i + align1 < page_size && i < len + 64; ++i) s1[i] = 32 + 32 * i % (max_char - 32); - if (HP_TIMING_AVAIL) - printf ("Length %4zd, n %4zd, alignment %2zd/%2zd:", len, n, align1, align2); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, s2, s1, len, n); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-strnlen.c b/string/test-strnlen.c index 27411fb77d..bc7459bbe0 100644 --- a/string/test-strnlen.c +++ b/string/test-strnlen.c @@ -47,24 +47,6 @@ do_one_test (impl_t *impl, const char *s, size_t maxlen, size_t exp_len) ret = 1; return; } - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); - CALL (impl, s, maxlen); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -80,14 +62,8 @@ do_test (size_t align, size_t len, size_t maxlen, int max_char) buf1[align + i] = 1 + 7 * i % max_char; buf1[align + len] = 0; - if (HP_TIMING_AVAIL) - printf ("Length %4zd, alignment %2zd:", len, align); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, (char *) (buf1 + align), maxlen, MIN (len, maxlen)); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-strpbrk.c b/string/test-strpbrk.c index d580bac445..9f1b4a769b 100644 --- a/string/test-strpbrk.c +++ b/string/test-strpbrk.c @@ -70,24 +70,6 @@ do_one_test (impl_t *impl, const char *s, const char *rej, RES_TYPE exp_res) ret = 1; return; } - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); - CALL (impl, s, rej); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -137,14 +119,8 @@ do_test (size_t align, size_t pos, size_t len) } result = STRPBRK_RESULT (s, pos); - if (HP_TIMING_AVAIL) - printf ("Length %4zd, alignment %2zd, rej len %2zd:", pos, align, len); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, s, rej, result); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-strrchr.c b/string/test-strrchr.c index 984561d8fa..f5afe75399 100644 --- a/string/test-strrchr.c +++ b/string/test-strrchr.c @@ -73,24 +73,6 @@ do_one_test (impl_t *impl, const CHAR *s, int c, CHAR *exp_res) ret = 1; return; } - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); - CALL (impl, s, c); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -129,14 +111,8 @@ do_test (size_t align, size_t pos, size_t len, int seek_char, int max_char) else result = NULL; - if (HP_TIMING_AVAIL) - printf ("Length %4zd, alignment in bytes %2zd:", pos, align * sizeof(CHAR)); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, (CHAR *) (buf + align), seek_char, result); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-strspn.c b/string/test-strspn.c index 92d0191c73..4943faaeda 100644 --- a/string/test-strspn.c +++ b/string/test-strspn.c @@ -74,24 +74,6 @@ do_one_test (impl_t *impl, const char *s, const char *acc, size_t exp_res) ret = 1; return; } - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~ (hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); - CALL (impl, s, acc); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } static void @@ -129,14 +111,8 @@ do_test (size_t align, size_t pos, size_t len) s[i] = '\0'; } - if (HP_TIMING_AVAIL) - printf ("Length %4zd, alignment %2zd, acc len %2zd:", pos, align, len); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, s, acc, pos); - - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void diff --git a/string/test-strstr.c b/string/test-strstr.c index e788be95d9..4e49007f34 100644 --- a/string/test-strstr.c +++ b/string/test-strstr.c @@ -77,24 +77,6 @@ do_one_test (impl_t *impl, const char *s1, const char *s2, char *exp_result) { if (check_result (impl, s1, s2, exp_result) < 0) return; - - if (HP_TIMING_AVAIL) - { - hp_timing_t start __attribute ((unused)); - hp_timing_t stop __attribute ((unused)); - hp_timing_t best_time = ~(hp_timing_t) 0; - size_t i; - - for (i = 0; i < 32; ++i) - { - HP_TIMING_NOW (start); - CALL (impl, s1, s2); - HP_TIMING_NOW (stop); - HP_TIMING_BEST (best_time, start, stop); - } - - printf ("\t%zd", (size_t) best_time); - } } @@ -133,15 +115,9 @@ do_test (size_t align1, size_t align2, size_t len1, size_t len2, } s1[len1] = '\0'; - if (HP_TIMING_AVAIL) - printf ("Length %4zd/%zd, alignment %2zd/%2zd, %s:", - len1, len2, align1, align2, fail ? "fail" : "found"); - FOR_EACH_IMPL (impl, 0) do_one_test (impl, s1, s2, fail ? NULL : s1 + len1 - len2); - if (HP_TIMING_AVAIL) - putchar ('\n'); } static void |