NameDateSize

..10-Aug-20184 KiB

Android.bp10-Aug-20183 KiB

atomic_benchmark.cpp10-Aug-20184.4 KiB

bionic_benchmarks.cpp10-Aug-201817.8 KiB

inttypes_benchmark.cpp10-Aug-20181 KiB

math_benchmark.cpp10-Aug-20185.2 KiB

property_benchmark.cpp10-Aug-20185.3 KiB

pthread_benchmark.cpp10-Aug-20185.9 KiB

README.md10-Aug-20182.9 KiB

run-on-host.sh10-Aug-2018946

semaphore_benchmark.cpp10-Aug-20184.9 KiB

stdio_benchmark.cpp10-Aug-20188.9 KiB

stdlib_benchmark.cpp10-Aug-20184.7 KiB

string_benchmark.cpp10-Aug-20189.9 KiB

suites/10-Aug-20184 KiB

test_suites/10-Aug-20184 KiB

tests/10-Aug-20184 KiB

time_benchmark.cpp10-Aug-20185.3 KiB

unistd_benchmark.cpp10-Aug-20181.5 KiB

util.cpp10-Aug-20183.1 KiB

util.h10-Aug-20182.1 KiB

README.md

1Bionic Benchmarks
2=================
3
4Bionic benchmarks is a command line tool for measuring the runtimes of libc functions. It is built
5on top of [Google benchmarks](https://github.com/google/benchmark) with some additions to organize
6tests into suites.
7
8Running the benchmarks
9----------------------
10
11### Device benchmarks
12
13    $ mma
14    $ adb remount
15    $ adb sync
16    $ adb shell /data/nativetest/bionic-benchmarks/bionic-benchmarks
17    $ adb shell /data/nativetest64/bionic-benchmarks/bionic-benchmarks
18
19When operated without specifying an xml file, the default is to run all
20of the benchmarks in alphabetical order.
21
22You can use `--benchmark_filter=getpid` to just run benchmarks with "getpid"
23in their name.
24
25### Host benchmarks
26
27See the benchmarks/run-on-host.sh script. The host benchmarks can be run
28with 32 bit or 64 bit bionic, or the host glibc.
29
30## Suites
31
32Suites are stored in the `suites/` directory and can be chosen with the command line flag
33'--bionic_xml'.
34
35To choose a specific xml file, use the `--bionic_xml=FILE.XML` option. By default, this
36option searches for the xml file in the `suites/` directory. If it doesn't exist
37in that directory then the file will be found as relative to the current
38directory. If the option specifies the full path to an xml file such as
39`/data/nativetest/suites/example.xml`, it will be used as is.
40
41If no xml file is specified through the command-line option, the default is to use `suites/full.xml`.
42However, for the host bionic benchmarks (bionic-benchmarks-glibc), the default
43is to use `suites/host.xml`.
44
45### Format
46
47The format for a benchmark is:
48
49```
50<fn>
51    <name>BM_sample_benchmark</name>
52    <cpu><optional_cpu_to_lock></cpu>
53    <iterations><optional_iterations_to_run></iterations>
54    <args><space separated list of function args|shorthand></args>
55</fn>
56```
57
58xml-specified values for iterations and cpu take precedence over those specified via command line
59(via '--bionic_iterations' and '--bionic_cpu', respectively.)
60
61To make small changes in runs, you can also schedule benchmarks by passing in their name and a
62space-separated list of arguments via the 'bionic_extra' command line flag, e.g.
63'--bionic_extra="BM_string_memcpy AT_COMMON_SIZES"' or '--bionic_extra="BM_string_memcmp 32 8 8"'
64
65Note that benchmarks will run normally if extra arguments are passed in, and it will fail
66with a segfault if too few are passed in.
67
68### Shorthand
69
70For the sake of brevity, multiple runs can be scheduled in one xml element by putting one of the
71following in the args field:
72
73    NUM_PROPS
74    MATH_COMMON
75    AT_ALIGNED_<ONE|TWO>BUF
76    AT_<any power of two between 2 and 16384>_ALIGNED_<ONE|TWO>BUF
77    AT_COMMON_SIZES
78
79Definitions for these can be found in bionic_benchmarks.cpp, and example usages can be found in
80the suites directory.
81
82### Unit Tests
83
84Bionic benchmarks also has its own set of unit tests, which can be run from the binary in
85`/data/nativetest[64]/bionic-benchmarks-tests`
86