aboutsummaryrefslogtreecommitdiff
path: root/benchtests/bench-memset.c
diff options
context:
space:
mode:
Diffstat (limited to 'benchtests/bench-memset.c')
-rw-r--r--benchtests/bench-memset.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/benchtests/bench-memset.c b/benchtests/bench-memset.c
index ea29cf37fc..e45807c0ee 100644
--- a/benchtests/bench-memset.c
+++ b/benchtests/bench-memset.c
@@ -75,6 +75,8 @@ simple_memset (char *s, int c, size_t n)
static void
do_one_test (impl_t *impl, char *s, int c __attribute ((unused)), size_t n)
{
+ size_t i, iters = INNER_LOOP_ITERS;
+ timing_t start, stop, cur;
char tstbuf[n];
#ifdef TEST_BZERO
simple_bzero (tstbuf, n);
@@ -92,28 +94,20 @@ do_one_test (impl_t *impl, char *s, int c __attribute ((unused)), size_t n)
return;
}
- if (HP_TIMING_AVAIL)
+ TIMING_NOW (start);
+ for (i = 0; i < iters; ++i)
{
- 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);
+ CALL (impl, s, n);
#else
- CALL (impl, s, c, n);
+ CALL (impl, s, c, n);
#endif
+ }
+ TIMING_NOW (stop);
- HP_TIMING_NOW (stop);
- HP_TIMING_BEST (best_time, start, stop);
- }
+ TIMING_DIFF (cur, start, stop);
- printf ("\t%zd", (size_t) best_time);
- }
+ TIMING_PRINT_MEAN ((double) cur, (double) iters);
}
static void
@@ -123,14 +117,12 @@ 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);
+ 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');
+ putchar ('\n');
}
int