Commit graph

24 commits

Author SHA1 Message Date
Christopher Ferris
d613f89bf0 Add a std::map, std::unordered_map benchmark.
This benchmark also includes the measuring of RSS.

Bug: 137795072

Test: Ran different iterations and verified the RSS_MB value is nearly
Test: identical no matter the number of iterations.
Change-Id: I465a0eae9dcff2e1fb739c35623a26291680951f
2020-02-22 14:43:41 +00:00
Christopher Ferris
5a3c920051 Add mallopt M_PURGE benchmark.
Update the native allocator documentation to include running of this
benchmark.

Move the malloc_benchmark.cpp to malloc_sql_benchmark.cpp and use
malloc_benchmark.cpp for benchmarking functions from malloc.h.

Bug: 137795072

Test: Ran new benchmark.
Change-Id: I76856de833032da324ad0bc0b6bd85a4ea8c253d
2019-12-05 15:46:22 -08:00
Steven Moreland
c4e727bff3 Add dladdr benchmark.
Bug: 142684469
Test: adb shell /data/benchmarktest64/bionic-benchmarks/bionic-benchmarks --benchmark_filter="BM_dladdr.*"
-------------------------------------------------------------------
Benchmark                         Time             CPU   Iterations
-------------------------------------------------------------------
BM_dladdr_libbase_split        92.6 ns         92.4 ns      6673841
BM_dladdr_libc_printf          8690 ns         8667 ns        80916
BM_dladdr_libdl_dladdr          133 ns          132 ns      5342791
BM_dladdr_local_function       93.0 ns         92.7 ns      7625562

Change-Id: I259dd8f64ccc288835576a2eb08b8b8132777a4b
2019-10-16 08:59:06 -07:00
Elliott Hughes
9ff7d09643 Add trivial <ctype.h> benchmarks.
Just to sanity check that toupper/tolower and towupper/towlower are in
the same ballpark for the ASCII range.

Test: ran benchmarks
Change-Id: I1ddc3f4f4478b4075107831f27bf4d4b4a3bc5e8
2019-09-26 21:47:01 -07:00
Elliott Hughes
bab9cfd99a Add trivial towlower/towupper benchmarks.
Currently 11ns for both ascii and unicode in 64-bit, 15ns for 32-bit.

Test: ran benchmarks
Change-Id: Ie810b324c855b52b66a96889a194bc5b5b55653f
2019-09-25 22:13:32 -07:00
Elliott Hughes
d655bc6dfa Update doc comment about running the benchmarks.
Test: N/A
Change-Id: Idf1f8c38aa90478b861358677e1d12b96809377d
2019-04-23 11:49:13 -07:00
Christopher Ferris
18cbed7008 Make the test less specific.
Remove the need to add every benchmark to the list of all benchmarks.

Also, add some hard-coding of the location of the benchmark executable.
Add a test to make sure the benchmark exists so it's possible to detect
if the executable changes location.

Finally, make the tests isolated so that they finish in half the time.

Test: Ran unit tests.
Change-Id: I1e59eb283e31d29b14e54c44ac865827c9704127
2018-10-19 14:05:14 -07:00
Hans Boehm
3e5754c6ad Add benchmarks for heap size retrieval
Add benchmarks for mallinfo, and for retrieving RSS from
/proc/self/statm, since we're considering using these for GC
triggering.

Add some static linkage specifiers, after running into a build
problem due to a spurious conflict.

Bug: 111447610

Test: Ran benchmarks
Change-Id: Ie50d512294993882728c63ce51ec507590257d80
2018-10-18 17:56:58 -07:00
Elliott Hughes
627329915a Only use NDK libraries in the benchmarks.
It should be possible to run the benchmarks on any device, including
past and future ones, and sticking to NDK libraries ensures that.

Bug: N/A
Test: `readelf -aW`
Change-Id: I15a7a4104fa30263136bc3033d2bd9022cd8ff7b
2018-09-24 16:45:13 -07:00
Christopher Ferris
0dc784431b Add new malloc benchmarks.
This runs through the trace of the allocations in a sql benchmark app
executed in the benchmark thread.

Add one benchmark with decay time set to 0 and another with decay time
set to 1.

Include a script that can generate a header file that can be used to
regenerate the data.

Bug: 112317428

Test: Builds, ran unit tests, ran benchmarks.
Change-Id: I62e287cc06b74b74bcc5a4bbee71b0fac0a196fd
2018-08-14 16:01:58 -07:00
Haibo Huang
510dda3ea1 Fix benchmark-tests
1. fix all_benchmarks. Some new benchmarks were added.
2. move some benchmark suites to the right place.
3. add unit test for https://android-review.googlesource.com/c/platform/bionic/+/724785

Test: compile and run bionic-benchmarks-tests on device.
Change-Id: I2b686b51910a422b664f9ea968199f37944039c0
2018-08-11 23:43:03 -07:00
Elliott Hughes
d50a1de565 Run bpfmt manually.
Bug: N/A
Test: builds
Change-Id: I0cf145c3b699ac8ef170a63366832f63a9cc1a91
2018-02-05 17:30:57 -08:00
Elliott Hughes
811a1dd868 Merge "More benchmarks." 2017-12-19 20:23:39 +00:00
Elliott Hughes
7063a838be More benchmarks.
Add a hand-rolled maps line parser as something to compare our realistic
sscanf benchmark against. Also add benchmarks for the ato*/strto* family.

This patch doesn't fix the tests, which seem to have been broken by
the recent google-benchmark upgrade despite the benchmarks themselves
all working just fine. To me that's a final strike against these tests
which are hard to maintain and not obviously useful, but we can worry
about what to do with them -- whether to just delete them or to try to
turn them into tests that actually have some value -- in a separate CL.

Bug: N/A
Test: ran benchmarks
Change-Id: I6c9a77ece98d624baeb049b360876ef5c35ea7f2
2017-12-19 08:55:40 -08:00
Tom Cherry
e275d6d72d Split properties into their own class to make testing better
Reinitializing system properties can result in crashes later in the
program, and is generally not recommended or even supported.  This
change moves the actual logic for system properties into a class that
can be tested in isolation, without reinitializing the actual system
property area used in libc.

Bug: 62197783
Test: boot devices, ensure properties work
Test: system property unit tests and benchmarks
Change-Id: I9ae6e1b56c62f51a4d3fdb5b62b8926cef545649
2017-12-18 15:17:55 -08:00
Christopher Ferris
858e33698d Generate all the benchmarks to run.
Instead of requiring the need to maintain a list of all the benchmarks,
add a programmatic way to generate all of the benchmarks.

This generation runs the benchmarks in alphabetical order.

Add a new macro BIONIC_BENCHMARK_WITH_ARG that will be the default argument
to pass to the benchmark. Change the benchmarks that require default arguments.

Add a small example xml file, and remove the full.xml/host.xml files.

Update readme.

Test: Ran new unit tests, verified all tests are added.
Change-Id: I8036daeae7635393222a7a92d18f34119adba745
2017-11-30 09:09:41 -08:00
Dan Willemsen
ae407e522a Remove default libraries
libdl is part of system_shared_libs now. -ldl -lpthread -lm are now defaults
for host_ldlibs on Linux and Darwin. -lrt is a default for host_ldlibs on
Linux.

Test: m host
Test: mmma bionic
Change-Id: I966e2f88c24fba5e412bee6b6382045a2026a8e4
2017-09-28 16:16:14 -07:00
Christopher Ferris
d9d39be0f0 A few small fix ups.
- Add a default xml file to run if nothing is specified on the command-line.
- Add a way to specify a xml file in suites without having to specify the
  full path name.
- Move all of the test xml files into their own directory.
- Add the suites directory for to glibc benchmarks.
- Add a new test for help data.
- Modify the full suite test to verify the default xml is chosen and use
  the real full.xml instead of the test one. Delete the test_full.xml.
- Move the property tests to the end of the suite.
- Add skipping of xml comments.

Test: Ran the unit tests and ran the bionic benchmarks.
Change-Id: Ie99965f86fe915af0175de46c7780ab79e2b0843
2017-08-24 14:50:03 -07:00
Anders Lewis
4b26f71778 Fix local path assumption in interface_test.
Also fix a couple of other issues with the tests.

Test: Unit tests.
Change-Id: I6c2b2b5fad487460441487cc231a0e4a8d3897c7
2017-08-15 11:04:44 -07:00
Anders Lewis
ac4f4b43a3 Add musl benchmarks.
Test: Unit tests.
Change-Id: Ifb2911825f84b95fe64a803bfabd32fb81210eae
2017-08-09 15:26:37 -07:00
Anders Lewis
a7b0f88997 Implement interface for bionic benchmarks.
Test: Unit tests.
Change-Id: Ic61932f61ddd572e2f045b601f9da6e090cdc45d
2017-08-07 13:16:09 -07:00
Anders Lewis
f4447b9105 Support memory alignment tests for string_benchmark.cpp
Test: Manually verify that benchmark times are similar and add a unit test.
Change-Id: Idaaeb4c8c3629f797ffd8d0c86c8d7b7b9653181
2017-07-12 13:42:23 -07:00
Hans Boehm
3f5578708d Add "benchmark" to time atomic operations
The intent here is to confirm that the compiler behaves as expected,
and to guide optimization efforts, particularly where there is a
choice between primitives.

Test: Built and ran benchmark on Angler repeatedly. Manually confirmed
that the compiler behaves roughly as expected.

Change-Id: I059b245d1ba8296e9b28602559b53eafafe0a30f
2017-01-31 10:20:26 -08:00
Colin Cross
2722ebb30b Convert bionic benchmarks and tests to Android.bp
The compile-time tests and a few custom libraries for dynamic linker
testing are still compiled in make.

Also converts the make rules to run tests on the host to shell scripts
in tests/run-on-host.sh and benchmarks/run-on-host.sh

Change-Id: I6f174b3a69d58c4ed74d29f4e79332d483681534
2016-07-14 12:30:12 -07:00