You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Junxian Zhu 0a4d6c8254 benchtests: Add more benchtests for rounding functions. 2 years ago
..
libmvec benchtests: Move libmvec benchtest inputs to benchtests directory 3 years ago
scripts Update copyright dates with scripts/update-copyrights 2 years ago
strcoll-inputs Remove sysdeps/*/tls-macros.h 5 years ago
Makefile benchtests: Add more benchtests for rounding functions. 2 years ago
README benchtests: Add benchtests for dl_elf_hash, dl_new_hash and nss_hash 4 years ago
acos-inputs Remove obsolete comments/name from acos-inputs, since slow path was removed. 5 years ago
acosh-inputs benchmark inputs for asinh and acosh 12 years ago
asin-inputs Remove obsolete comments/name from several benchtest input files. 5 years ago
asinh-inputs benchmark inputs for asinh and acosh 12 years ago
atan-inputs Remove obsolete comments/name from several benchtest input files. 5 years ago
atan2-inputs add workload traces for missing functions (double format) 5 years ago
atanh-inputs benchmark inputs for tanh and atanh 12 years ago
bench-arc4random.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-bzero-large.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-bzero-walk.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-bzero.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-dl-elf-hash.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-dl-new-hash.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-hash-funcs-kernel.h Update copyright dates with scripts/update-copyrights 2 years ago
bench-hash-funcs.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-libmvec-skeleton.c Benchtests: Increase benchmark iterations 2 years ago
bench-malloc-simple.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-malloc-thread.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-math-inlines.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-memccpy.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-memchr.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-memcmp.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-memcmpeq.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-memcpy-large.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-memcpy-random.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-memcpy-walk.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-memcpy.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-memmem.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-memmove-large.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-memmove-walk.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-memmove.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-mempcpy.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-memrchr.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-memset-large.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-memset-walk.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-memset-zero-large.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-memset-zero-walk.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-memset-zero.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-memset.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-nss-hash.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-pthread-lock-base.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-pthread-locks.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-pthread-mutex-lock.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-pthread-mutex-trylock.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-pthread-spin-lock.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-pthread-spin-trylock.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-rawmemchr.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-skeleton.c Benchtests: Increase benchmark iterations 2 years ago
bench-stpcpy.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-stpcpy_chk.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-stpncpy.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strcasecmp.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strcasestr.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strcat.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strchr.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strchrnul.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strcmp.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strcoll.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strcpy.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strcpy_chk.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strcspn.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-string.h Update copyright dates with scripts/update-copyrights 2 years ago
bench-strlen.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strncasecmp.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strncat.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strncmp.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strncpy.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strnlen.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strpbrk.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strrchr.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strsep.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strspn.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strstr.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strtod.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-strtok.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-timing-type.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-timing.h Update copyright dates with scripts/update-copyrights 2 years ago
bench-util.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-util.h Update copyright dates with scripts/update-copyrights 2 years ago
bench-wcpcpy.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-wcpncpy.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-wcrtomb.c benchtests: Add wcrtomb microbenchmark 4 years ago
bench-wcscat.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-wcschr.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-wcschrnul.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-wcscmp.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-wcscpy.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-wcscspn.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-wcslen.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-wcsncat.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-wcsncmp.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-wcsncpy.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-wcsnlen.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-wcspbrk.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-wcsrchr.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-wcsspn.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-wmemchr.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-wmemcmp.c Update copyright dates with scripts/update-copyrights 2 years ago
bench-wmemset.c Update copyright dates with scripts/update-copyrights 2 years ago
cbrt-inputs add workload traces for missing functions (double format) 5 years ago
cbrtl-inputs add workload traces for cbrtl 5 years ago
ceil-inputs benchtests: Add more benchtests for rounding functions. 2 years ago
ceilf-inputs benchtests: Add more benchtests for rounding functions. 2 years ago
cos-inputs Remove obsolete comments/name from several benchtest input files. 5 years ago
cosf-inputs benchtests: Add workload name for cosf 4 years ago
cosh-inputs benchmark inputs for sinh and cosh 12 years ago
erf-inputs add workload traces for missing functions (double format) 5 years ago
erfc-inputs add workload traces for missing functions (double format) 5 years ago
exp-inputs benchtests: Add "workload" traces for exp 6 years ago
exp2-inputs benchmark inputs for exp2, log2, log and tan 12 years ago
exp2f-inputs Add exp2f and log2f benchmark trace 9 years ago
exp10-inputs add workload traces for missing functions (double format) 5 years ago
exp10f-inputs benchtests: Fix name of exp10f benchmark variant 5 years ago
expf-inputs Add expf trace 9 years ago
expf128-inputs benchtests: Run _Float128 tests only on architectures that support it 6 years ago
expm1-inputs add workload traces for missing functions (double format) 5 years ago
ffs-inputs benchtests: Add benchtests for ffs and ffsll 12 years ago
ffsll-inputs benchtests: Add benchtests for ffs and ffsll 12 years ago
floor-inputs benchtests: Add more benchtests for rounding functions. 2 years ago
floorf-inputs benchtests: Add more benchtests for rounding functions. 2 years ago
fmax-inputs benchtests: Add fmax/fmin benchmarks 9 years ago
fmaxf-inputs benchtests: Add fmaxf/fminf benchmarks 9 years ago
fmin-inputs benchtests: Add fmax/fmin benchmarks 9 years ago
fminf-inputs benchtests: Add fmaxf/fminf benchmarks 9 years ago
fmod-inputs benchtests: Add fmod benchmark 3 years ago
fmodf-inputs benchtests: Add fmodf benchmark 3 years ago
hypot-inputs benchtests: Make hypot input random 4 years ago
hypotf-inputs benchtests: Add hypotf 4 years ago
ilogb-inputs benchtests: Add ilogb* tests 5 years ago
ilogbf-inputs benchtests: Add ilogb* tests 5 years ago
ilogbf128-inputs benchtests: Add ilogb* tests 5 years ago
isfinite-inputs benchtests: Add isnan/isinf/isfinite benchmark 7 years ago
isinf-inputs benchtests: Add isnan/isinf/isfinite benchmark 7 years ago
isnan-inputs benchtests: Add isnan/isinf/isfinite benchmark 7 years ago
j0-inputs add workload traces for missing functions (double format) 5 years ago
j1-inputs add workload traces for missing functions (double format) 5 years ago
json-lib.c Update copyright dates with scripts/update-copyrights 2 years ago
json-lib.h Update copyright dates with scripts/update-copyrights 2 years ago
lgamma-inputs add workload traces for missing functions (double format) 5 years ago
llrint-inputs benchtests: Add more benchtests for rounding functions. 2 years ago
llrintf-inputs benchtests: Add more benchtests for rounding functions. 2 years ago
log-inputs benchmark inputs for exp2, log2, log and tan 12 years ago
log1p-inputs add workload traces for missing functions (double format) 5 years ago
log2-inputs benchmark inputs for exp2, log2, log and tan 12 years ago
log2f-inputs Add exp2f and log2f benchmark trace 9 years ago
log10-inputs add workload traces for missing functions (double format) 5 years ago
logb-inputs benchtests: Add logb{f} benchmark 7 years ago
logbf-inputs benchtests: Add logb{f} benchmark 7 years ago
logf-inputs Add logf trace 9 years ago
lrint-inputs benchtests: Add more benchtests for rounding functions. 2 years ago
lrintf-inputs benchtests: Add more benchtests for rounding functions. 2 years ago
modf-inputs [benchtests] Use inputs file for modf 12 years ago
nearbyint-inputs benchtests: Add more benchtests for rounding functions. 2 years ago
nearbyintf-inputs benchtests: Add more benchtests for rounding functions. 2 years ago
pow-inputs Remove obsolete comments/name from several benchtest input files. 5 years ago
powf-inputs Add powf trace 9 years ago
powf128-inputs benchtests: Run _Float128 tests only on architectures that support it 6 years ago
pthread_once-inputs benchtests: Add pthread_once common-case test. 12 years ago
pthread_once-source.c Update copyright dates with scripts/update-copyrights 2 years ago
rint-inputs Add more directives to benchmark input files 13 years ago
rintf-inputs benchtests: Add more benchtests for rounding functions. 2 years ago
roundeven-inputs Add benchtests for roundeven and roundevenf. 6 years ago
roundevenf-inputs Add benchtests for roundeven and roundevenf. 6 years ago
sin-inputs Remove obsolete comments/name from several benchtest input files. 5 years ago
sincos-inputs benchtests: Add inputs from sin and cos to sincos 10 years ago
sincosf-inputs benchtests: Add workload name for sincosf 4 years ago
sinf-inputs benchtests: Add "workload" traces for sinf 6 years ago
sinf128-inputs benchtests: Run _Float128 tests only on architectures that support it 6 years ago
sinh-inputs benchmark inputs for sinh and cosh 12 years ago
sprintf-inputs Add sprintf benchmark. 11 years ago
sprintf-source.c Add sprintf benchmark. 11 years ago
sqrt-inputs Benchmark test for sqrt function. 13 years ago
tan-inputs Remove obsolete comments/name from several benchtest input files. 5 years ago
tanh-inputs benchmark inputs for tanh and atanh 12 years ago
tgamma-inputs add workload traces for missing functions (double format) 5 years ago
thread_create-inputs nptl: Invert the mmap/mprotect logic on allocated stacks (BZ#18988) 9 years ago
thread_create-source.c Update copyright dates with scripts/update-copyrights 2 years ago
trunc-inputs Add benchtests for trunc and truncf. 9 years ago
truncf-inputs Add benchtests for trunc and truncf. 9 years ago
y0-inputs add workload traces for missing functions (double format) 5 years ago
y1-inputs add workload traces for missing functions (double format) 5 years ago

README

Using the glibc microbenchmark suite
====================================

The glibc microbenchmark suite automatically generates code for specified
functions, builds and calls them repeatedly for given inputs to give some
basic performance properties of the function.

Running the benchmark:
=====================

The benchmark needs python 2.7 or later in addition to the
dependencies required to build the GNU C Library. One may run the
benchmark by invoking make as follows:

$ make bench

This runs each function for 10 seconds and appends its output to
benchtests/bench.out. To ensure that the tests are rebuilt, one could run:

$ make bench-clean

The duration of each test can be configured setting the BENCH_DURATION variable
in the call to make. One should run `make bench-clean' before changing
BENCH_DURATION.

$ make BENCH_DURATION=1 bench

The benchmark suite does function call measurements using architecture-specific
high precision timing instructions whenever available. When such support is
not available, it uses clock_gettime (CLOCK_MONOTONIC). One can force the
benchmark to use clock_gettime by invoking make as follows:

$ make USE_CLOCK_GETTIME=1 bench

Again, one must run `make bench-clean' before changing the measurement method.

On x86 processors, RDTSCP instruction provides more precise timing data
than RDTSC instruction. All x86 processors since 2010 support RDTSCP
instruction. One can force the benchmark to use RDTSCP by invoking make
as follows:

$ make USE_RDTSCP=1 bench

One must run `make bench-clean' before changing the measurement method.

Running benchmarks on another target:
====================================

If the target where you want to run benchmarks is not capable of building the
code or you're cross-building, you could build and execute the benchmark in
separate steps. On the build system run:

$ make bench-build

and then copy the source and build directories to the target and run the
benchmarks from the build directory as usual:

$ make bench

make sure the copy preserves timestamps by using either rsync or scp -p
otherwise the above command may try to build the benchmark again. Benchmarks
that require generated code to be executed during the build are skipped when
cross-building.

Building benchmarks as static executables:
=========================================

To build benchmarks as static executables, on the build system, run:

$ make STATIC-BENCHTESTS=yes bench-build

You can copy benchmark executables to another machine and run them
without copying the source nor build directories.

Running subsets of benchmarks:
==============================

To run only a subset of benchmarks, one may invoke make as follows

$ make bench BENCHSET="bench-pthread bench-math malloc-thread"

where BENCHSET may be a space-separated list of the following values:

bench-math
bench-pthread
bench-string
hash-benchset
malloc-thread
math-benchset
stdio-common-benchset
stdlib-benchset
string-benchset
wcsmbs-benchset

Adding a function to benchtests:
===============================

If the name of the function is `foo', then the following procedure should allow
one to add `foo' to the bench tests:

- Append the function name to the bench variable in the Makefile.

- Make a file called `foo-inputs` to provide the definition and input for the
function. The file should have some directives telling the parser script
about the function and then one input per line. Directives are lines that
have a special meaning for the parser and they begin with two hashes '##'.
The following directives are recognized:

- args: This should be assigned a colon separated list of types of the input
arguments. This directive may be skipped if the function does not take any
inputs. One may identify output arguments by nesting them in <>. The
generator will create variables to get outputs from the calling function.
- ret: This should be assigned the type that the function returns. This
directive may be skipped if the function does not return a value.
- includes: This should be assigned a comma-separated list of headers that
need to be included to provide declarations for the function and types it
may need (specifically, this includes using "#include <header>").
- include-sources: This should be assigned a comma-separated list of source
files that need to be included to provide definitions of global variables
and functions (specifically, this includes using "#include "source").
See pthread_once-inputs and pthreads_once-source.c for an example of how
to use this to benchmark a function that needs state across several calls.
- init: Name of an initializer function to call to initialize the benchtest.
- name: See following section for instructions on how to use this directive.

Lines beginning with a single hash '#' are treated as comments. See
pow-inputs for an example of an input file.

Multiple execution units per function:
=====================================

Some functions have distinct performance characteristics for different input
domains and it may be necessary to measure those separately. For example, some
math functions perform computations at different levels of precision (64-bit vs
240-bit vs 768-bit) and mixing them does not give a very useful picture of the
performance of these functions. One could separate inputs for these domains in
the same file by using the `name' directive that looks something like this:

##name: 240bits

All inputs after the ##name: 240bits directive and until the next `name'
directive (or the end of file) are part of the "240bits" benchmark and
will be output separately in benchtests/bench.out. See the pow-inputs file
for an example of what such a partitioned input file would look like.

It is also possible to measure latency and reciprocal throughput of a
(partial) trace extracted from a real workload. In this case the whole trace
is iterated over multiple times rather than repeating every input multiple
times. This can be done via:

##name: workload-<name>

where <name> is simply used to distinguish between different traces in the
same file. To create such a trace, you can simply extract using printf()
values uses for a specific application, or generate random values in some
interval. See the expf-inputs file for an example of this workload mechanism.

Benchmark Sets:
==============

In addition to standard benchmarking of functions, one may also generate
custom outputs for a set of functions. This is currently used by string
function benchmarks where the aim is to compare performance between
implementations at various alignments and for various sizes.

To add a benchset for `foo':

- Add `foo' to the benchset variable.
- Write your bench-foo.c that prints out the measurements to stdout.
- On execution, a bench-foo.out is created in $(objpfx) with the contents of
stdout.

Reading String Benchmark Results:
================================

Some of the string benchmark results are now in JSON to make it easier to read
in scripts. Use the benchtests/compare_strings.py script to show the results
in a tabular format, generate graphs and more. Run

benchtests/scripts/compare_strings.py -h

for usage information.