1 Bionic Benchmarks 2 ================= 3 4 Bionic benchmarks is a command line tool for measuring the runtimes of libc functions. It is built 5 on top of [Google benchmarks](https://github.com/google/benchmark) with some additions to organize 6 tests into suites. 7 8 Running the benchmarks 9 ---------------------- 10 11 ### Device benchmarks 12 13 $ mma 14 $ adb remount 15 $ adb sync 16 $ adb shell /data/benchmarktest/bionic-benchmarks/bionic-benchmarks 17 $ adb shell /data/benchmarktest64/bionic-benchmarks/bionic-benchmarks 18 19 When operated without specifying an xml file, the default is to run all 20 of the benchmarks in alphabetical order. 21 22 You can use `--benchmark_filter=getpid` to just run benchmarks with "getpid" 23 in their name. 24 25 ### Host benchmarks 26 27 See the benchmarks/run-on-host.sh script. The host benchmarks can be run 28 with 32 bit or 64 bit bionic, or the host glibc. 29 30 ## Suites 31 32 Suites are stored in the `suites/` directory and can be chosen with the command line flag 33 '--bionic_xml'. 34 35 To choose a specific xml file, use the `--bionic_xml=FILE.XML` option. By default, this 36 option searches for the xml file in the `suites/` directory. If it doesn't exist 37 in that directory then the file will be found as relative to the current 38 directory. 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 41 If no xml file is specified through the command-line option, the default is to use `suites/full.xml`. 42 However, for the host bionic benchmarks (bionic-benchmarks-glibc), the default 43 is to use `suites/host.xml`. 44 45 ### Format 46 47 The 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 58 xml-specified values for iterations and cpu take precedence over those specified via command line 59 (via '--bionic_iterations' and '--bionic_cpu', respectively.) 60 61 To make small changes in runs, you can also schedule benchmarks by passing in their name and a 62 space-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 65 Note that benchmarks will run normally if extra arguments are passed in, and it will fail 66 with a segfault if too few are passed in. 67 68 ### Shorthand 69 70 For the sake of brevity, multiple runs can be scheduled in one xml element by putting one of the 71 following 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 79 Definitions for these can be found in bionic_benchmarks.cpp, and example usages can be found in 80 the suites directory. 81 82 ### Unit Tests 83 84 Bionic 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