To fix BZ #18675, use __fstatvfs64 in __fpathconf.
[glibc.git] / benchtests / bench-strtod.c
blobae951a72b750db42de1ca65e6254e97c545a547e
1 /* Measure strtod implementation.
2 Copyright (C) 2013-2015 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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/>. */
19 #define TEST_MAIN
20 #define TEST_NAME "strtod"
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include "bench-timing.h"
26 #undef INNER_LOOP_ITERS
27 #define INNER_LOOP_ITERS 65536
29 static const char *inputs[] =
31 "1e308",
32 "100000000e300",
33 "0x1p1023",
34 "0x1000p1011",
35 "0x1p1020",
36 "0x0.00001p1040" "1e-307",
37 "0.000001e-301",
38 "0.0000001e-300",
39 "0.00000001e-299",
40 "1000000e-313",
41 "10000000e-314",
42 "100000000e-315",
43 "0x1p-1021",
44 "0x1000p-1033",
45 "0x10000p-1037",
46 "0x0.001p-1009",
47 "0x0.0001p-1005",
48 "12.345",
49 "12.345e19",
50 "-.1e+9",
51 ".125",
52 "1e20",
53 "0e-19",
54 "4\00012",
55 "5.9e-76",
56 "0x1.4p+3",
57 "0xAp0",
58 "0x0Ap0",
59 "0x0A",
60 "0xA0",
61 "0x0.A0p8",
62 "0x0.50p9",
63 "0x0.28p10",
64 "0x0.14p11",
65 "0x0.0A0p12",
66 "0x0.050p13",
67 "0x0.028p14",
68 "0x0.014p15",
69 "0x00.00A0p16",
70 "0x00.0050p17",
71 "0x00.0028p18",
72 "0x00.0014p19",
73 "0x1p-1023",
74 "0x0.8p-1022",
75 "Inf",
76 "-Inf",
77 "+InFiNiTy",
78 "0x80000Ap-23",
79 "1e-324",
80 "0x100000000000008p0",
81 "0x100000000000008.p0",
82 "0x100000000000008.00p0",
83 "0x10000000000000800p0",
84 "0x10000000000000801p0",
85 NULL
88 int
89 do_bench (void)
91 const size_t iters = INNER_LOOP_ITERS;
92 timing_t res __attribute__ ((unused));
94 TIMING_INIT (res);
96 for (size_t i = 0; inputs[i] != NULL; ++i)
98 char *ep;
99 timing_t start, stop, cur;
101 printf ("Input %-24s:", inputs[i]);
102 TIMING_NOW (start);
103 for (size_t j = 0; j < iters; ++j)
104 strtod (inputs[i], &ep);
105 TIMING_NOW (stop);
107 TIMING_DIFF (cur, start, stop);
108 TIMING_PRINT_MEAN ((double) cur, (double) iters);
109 putchar ('\n');
112 return 0;
115 #define TEST_FUNCTION do_bench ()
117 /* On slower platforms this test needs more than the default 2 seconds. */
118 #define TIMEOUT 10
120 #include "../test-skeleton.c"