Remove performance-related bits from string tests

This commit is contained in:
Siddhesh Poyarekar 2013-06-04 18:11:43 +05:30
parent 9702047480
commit fec799f823
26 changed files with 53 additions and 620 deletions

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);
}
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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