]> git.ipfire.org Git - thirdparty/glibc.git/blame - benchtests/bench-memmove-large.c
benchtests: Remove verification runs from benchmark tests
[thirdparty/glibc.git] / benchtests / bench-memmove-large.c
CommitLineData
a25322f4 1/* Measure memmove functions with large data sizes.
bfff8b1b 2 Copyright (C) 2016-2017 Free Software Foundation, Inc.
a25322f4
L
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19#define BASE_PAGE_SIZE (1024 * 1024)
20#define START_SIZE (4 * 1024)
21#define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
22#define TEST_MAIN
23#define TEST_NAME "memmove"
24#define TIMEOUT (20 * 60)
25#include "bench-string.h"
26
27IMPL (memmove, 1)
28
29typedef char *(*proto_t) (char *, const char *, size_t);
30
31static void
32do_one_test (impl_t *impl, char *dst, char *src, const char *orig_src,
33 size_t len)
34{
35 size_t i, iters = 16;
36 timing_t start, stop, cur;
37
a25322f4
L
38 TIMING_NOW (start);
39 for (i = 0; i < iters; ++i)
40 {
41 CALL (impl, dst, src, len);
42 }
43 TIMING_NOW (stop);
44
45 TIMING_DIFF (cur, start, stop);
46
47 TIMING_PRINT_MEAN ((double) cur, (double) iters);
48}
49
50static void
51do_test (size_t align1, size_t align2, size_t len)
52{
53 size_t i, j;
54 char *s1, *s2;
55
56 align1 &= 127;
57 if (align1 + len >= page_size)
58 return;
59
60 align2 &= 127;
61 if (align2 + len >= page_size)
62 return;
63
64 s1 = (char *) (buf1 + align1);
65 s2 = (char *) (buf2 + align2);
66
67 for (i = 0, j = 1; i < len; i++, j += 23)
68 s1[i] = j;
69
70 printf ("Length %4zd, alignment %2zd/%2zd:", len, align1, align2);
71
72 FOR_EACH_IMPL (impl, 0)
73 do_one_test (impl, s2, (char *) (buf2 + align1), s1, len);
74
75 putchar ('\n');
76}
77
78int
79test_main (void)
80{
81 size_t i;
82
83 test_init ();
84
85 printf ("%23s", "");
86 FOR_EACH_IMPL (impl, 0)
87 printf ("\t%s", impl->name);
88 putchar ('\n');
89
90 for (i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1)
91 {
92 do_test (0, 64, i + 7);
93 do_test (0, 3, i + 15);
94 do_test (3, 0, i + 31);
95 do_test (3, 7, i + 63);
96 do_test (9, 5, i + 127);
97 }
98
99 return ret;
100}
101
b598e134 102#include <support/test-driver.c>