Commit graph

219 commits

Author SHA1 Message Date
Elliott Hughes
68ae6ad12e Changes for #inclusivefixit.
Test: treehugger
Change-Id: I7ff0496c5c2792a41781e74634247f55b0548213
2020-07-21 16:34:58 -07:00
Elliott Hughes
8c936b4e6c Use more inclusive language.
One turns out not to be used at all, and the pylintrc even uses the more
intention-revealing term in the machine readable part, just not the
comment!

Test: treehugger
Change-Id: I4db7f1cf4fa1aa8ee601857e4e4c400e2119887c
2020-06-15 11:18:43 -07:00
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
Jake Weinstein
4b11192d8a benchmarks: add 16 and 32 bytes to common sizes
Per Wilco Dijkstra at ARM, 16 and 32 byte copies are much more common
than 8 or 64.

Change-Id: I3699d8bcd5f9dd8a8ccd8564a6cf58d2bd7089f5
Suggested-By: Wilco Dijkstra <wilco.dijkstra@arm.com>
2020-02-19 17:18:25 +01:00
Tom Cherry
bdb678c9bd Merge "Add an end-to-end property benchmark." 2020-02-03 13:58:11 +00:00
Christopher Ferris
89379355c4 Add a couple of new benchmarks.
Add a calloc benchmark to make sure that a native allocator isn't
doing anything incorrectly when zero'ing memory.

Also add a fork call benchmark to verify that the time to make a
fork call isn't increasing.

Test: Ran benchmarks on walleye and verified that the numbers are not
Test: too variable between runs.
Change-Id: I61d289d277f85ac432a315e539cf6391ea036866
2020-01-29 16:36:14 -08:00
Ryan Prichard
f82e39f1d9 Add a liblog dependency
Modules with a libbase dependency also need a liblog dependency now.

Fixes the linker-reloc-bench build target.

Bug: b/147779981
Test: manual
Change-Id: I41dd35717b665524a26a92a0c268e42c93a383b7
2020-01-15 19:59:04 -08:00
Ryan Prichard
41f19708c8 Add a linker relocation benchmark
The benchmark creates a set of DSOs that mimic the work involved in
loading the current version of libandroid_servers.so. The synthetic
benchmark has roughly the same number of libraries with roughly the same
relocations.

Currently, on a local aosp_walleye build that includes recent performance
improvements (including the Neon-based CL
I3983bca1dddc9241bb70290ad3651d895f046660), using the "performance"
governor, the benchmark reports these scores:

$ adb shell taskset 10 \
  /data/benchmarktest64/linker-reloc-bench/linker-reloc-bench \
  --benchmark_repetitions=20 --benchmark_display_aggregates_only=true
...
--------------------------------------------------------------------------------
Benchmark                                      Time             CPU   Iterations
--------------------------------------------------------------------------------
BM_linker_relocation/real_time_mean        70048 us          465 us           20
BM_linker_relocation/real_time_median      70091 us          466 us           20
BM_linker_relocation/real_time_stddev        329 us         8.29 us           20

$ adb shell taskset 10 \
  /data/benchmarktest/linker-reloc-bench/linker-reloc-bench \
  --benchmark_repetitions=20 --benchmark_display_aggregates_only=true
...
--------------------------------------------------------------------------------
Benchmark                                      Time             CPU   Iterations
--------------------------------------------------------------------------------
BM_linker_relocation/real_time_mean        83051 us          462 us           20
BM_linker_relocation/real_time_median      83069 us          464 us           20
BM_linker_relocation/real_time_stddev        184 us         8.91 us           20

Test: manual
Bug: none
Change-Id: I6dac66978f8666f95c76387093bda6be0151bfce
2020-01-14 13:12:56 -08:00
Tom Cherry
2f95d19a69 Add liblog as a dependency where libbase is used.
(Also fix issues found from bpfmt)

Bug: 119867234
Test: build
Change-Id: I16e93ad7c26dadfb625acbe514abe0c0084f84b6
2020-01-09 10:07:12 -08: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
Christopher Ferris
ae57a6b641 Remove unused code.
Test: Compiles.
Change-Id: I92095bd0ee59a3b98ee8deba1c3efc4685389a1b
2019-11-13 12:50:50 -08:00
Raman Tenneti
b481a2e743 Revert "Revert "Make system property reads wait-free""
This reverts commit de39d9242a.

Reason for revert: This revert is not needed

Change-Id: I34af8e5d75c724f6c4066fafbfc6bc7d58377601
2019-11-12 20:41:55 +00:00
Raman Tenneti
de39d9242a Revert "Make system property reads wait-free"
This reverts commit 0cf90556de.

Reason for revert: Device boot failures - 144355953

Change-Id: Icd4fc8c7a1d06d688a6d37e6f1c1aa45563f711b
2019-11-12 18:24:06 +00:00
Daniel Colascione
0cf90556de Make system property reads wait-free
Right now, when we read a system property, we first (assuming we've
already looked up the property's prop_info) read the property's serial
number; if we find that the low bit (the dirty bit) in the serial
number is set, we futex-wait for that serial number to become
non-dirty. By doing so, we spare readers from seeing partially-updated
property values if they race with the property service's non-atomic
memcpy to the property value slot. (The futex-wait here isn't
essential to the algorithm: spinning while dirty would suffice,
although it'd be somewhat less efficient.)

The problem with this approach is that readers can wait on the
property service process, potentially causing delays due to scheduling
variance. Property reads are not guaranteed to complete in finite time
right now.

This change makes property reads wait-free and ensures that they
complete in finite time in all cases. In the new approach, we prevent
value tearing by backing up each property we're about to modify and
directing readers to the backup copy if they try to read a property
with the dirty bit set.

(The wait freedom is limited to the case of readers racing against
*one* property update. A writer can still delay readers by rapidly
updating a property --- but after this change, readers can't hang due
to PID 1 scheduling delays.)

I considered adding explicit atomic access to short property values,
but between binary compatibility with the existing property database
and the need to carefully handle transitions of property values
between "short" (compatible with atomics) and "long" (incompatible
with atomics) length domains, I figured the complexity wasn't worth it
and that making property reads wait-free would be adequate.

Test: boots
Bug: 143561649
Change-Id: Ifd3108aedba5a4b157b66af6ca0a4ed084bd5982
2019-11-11 11:17:00 -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
a4959aa6f8 Reimplement the <ctype.h> is* functions.
Following on from the towlower()/towupper() changes, add benchmarks for
most of <ctype.h>, rewrite the tests to cover the entire defined range
for all of these functions, and then reimplement most of the functions.

The old table-based implementation is mostly a bad idea on modern
hardware, with only ispunct() showing a significant benefit compared to
any other way I could think of writing it, and isalnum() a marginal but
still convincingly genuine benefit.

My new benchmarks make an effort to test an example from each relevant
range of characters to avoid, say, accidentally optimizing the behavior
of `isalnum('0')` at the expense of `isalnum('z')`.

Interestingly, clang is able to generate what I believe to be the
optimal implementations from the most readable code, which is
impressive. It certainly matched or beat all my attempts to be clever!

The BSD table-based implementations made a special case of EOF despite
having a `_ctype_` table that's offset by 1 to include EOF at index 0.
I'm not sure why they didn't take advantage of that, but removing the
explicit check for EOF measurably improves the generated code on arm and
arm64, so even the two functions that still use the table benefit from
this rewrite.

Here are the benchmark results:

arm64 before:
  BM_ctype_isalnum_n                 3.73 ns         3.73 ns    183727137
  BM_ctype_isalnum_y1                3.82 ns         3.81 ns    186383058
  BM_ctype_isalnum_y2                3.73 ns         3.72 ns    187809830
  BM_ctype_isalnum_y3                3.78 ns         3.77 ns    181383055
  BM_ctype_isalpha_n                 3.75 ns         3.75 ns    189453927
  BM_ctype_isalpha_y1                3.76 ns         3.75 ns    184854043
  BM_ctype_isalpha_y2                4.32 ns         3.78 ns    186326931
  BM_ctype_isascii_n                 2.49 ns         2.48 ns    275583822
  BM_ctype_isascii_y                 2.51 ns         2.51 ns    282123915
  BM_ctype_isblank_n                 3.11 ns         3.10 ns    220472044
  BM_ctype_isblank_y1                3.20 ns         3.19 ns    226088868
  BM_ctype_isblank_y2                3.11 ns         3.11 ns    220809122
  BM_ctype_iscntrl_n                 3.79 ns         3.78 ns    188719938
  BM_ctype_iscntrl_y1                3.72 ns         3.71 ns    186209237
  BM_ctype_iscntrl_y2                3.80 ns         3.80 ns    184315749
  BM_ctype_isdigit_n                 3.76 ns         3.74 ns    188334682
  BM_ctype_isdigit_y                 3.78 ns         3.77 ns    186249335
  BM_ctype_isgraph_n                 3.99 ns         3.98 ns    177814143
  BM_ctype_isgraph_y1                3.98 ns         3.95 ns    175140090
  BM_ctype_isgraph_y2                4.01 ns         4.00 ns    178320453
  BM_ctype_isgraph_y3                3.96 ns         3.95 ns    175412814
  BM_ctype_isgraph_y4                4.01 ns         4.00 ns    175711174
  BM_ctype_islower_n                 3.75 ns         3.74 ns    188604818
  BM_ctype_islower_y                 3.79 ns         3.78 ns    154738238
  BM_ctype_isprint_n                 3.96 ns         3.95 ns    177607734
  BM_ctype_isprint_y1                3.94 ns         3.93 ns    174877244
  BM_ctype_isprint_y2                4.02 ns         4.01 ns    178206135
  BM_ctype_isprint_y3                3.94 ns         3.93 ns    175959069
  BM_ctype_isprint_y4                4.03 ns         4.02 ns    176158314
  BM_ctype_isprint_y5                3.95 ns         3.94 ns    178745462
  BM_ctype_ispunct_n                 3.78 ns         3.77 ns    184727184
  BM_ctype_ispunct_y                 3.76 ns         3.75 ns    187947503
  BM_ctype_isspace_n                 3.74 ns         3.74 ns    185300285
  BM_ctype_isspace_y1                3.77 ns         3.76 ns    187202066
  BM_ctype_isspace_y2                3.73 ns         3.73 ns    184105959
  BM_ctype_isupper_n                 3.81 ns         3.80 ns    185038761
  BM_ctype_isupper_y                 3.71 ns         3.71 ns    185885793
  BM_ctype_isxdigit_n                3.79 ns         3.79 ns    184965673
  BM_ctype_isxdigit_y1               3.76 ns         3.75 ns    188251672
  BM_ctype_isxdigit_y2               3.79 ns         3.78 ns    184187481
  BM_ctype_isxdigit_y3               3.77 ns         3.76 ns    187635540

arm64 after:
  BM_ctype_isalnum_n                 3.37 ns         3.37 ns    205613810
  BM_ctype_isalnum_y1                3.40 ns         3.39 ns    204806361
  BM_ctype_isalnum_y2                3.43 ns         3.43 ns    205066077
  BM_ctype_isalnum_y3                3.50 ns         3.50 ns    200057128
  BM_ctype_isalpha_n                 2.97 ns         2.97 ns    236084076
  BM_ctype_isalpha_y1                2.97 ns         2.97 ns    236083626
  BM_ctype_isalpha_y2                2.97 ns         2.97 ns    236084246
  BM_ctype_isascii_n                 2.55 ns         2.55 ns    272879994
  BM_ctype_isascii_y                 2.46 ns         2.45 ns    286522323
  BM_ctype_isblank_n                 3.18 ns         3.18 ns    220431175
  BM_ctype_isblank_y1                3.18 ns         3.18 ns    220345602
  BM_ctype_isblank_y2                3.18 ns         3.18 ns    220308509
  BM_ctype_iscntrl_n                 3.10 ns         3.10 ns    220344270
  BM_ctype_iscntrl_y1                3.10 ns         3.07 ns    228973615
  BM_ctype_iscntrl_y2                3.07 ns         3.07 ns    229192626
  BM_ctype_isdigit_n                 3.07 ns         3.07 ns    228925676
  BM_ctype_isdigit_y                 3.07 ns         3.07 ns    229182934
  BM_ctype_isgraph_n                 2.66 ns         2.66 ns    264268737
  BM_ctype_isgraph_y1                2.66 ns         2.66 ns    264445277
  BM_ctype_isgraph_y2                2.66 ns         2.66 ns    264327427
  BM_ctype_isgraph_y3                2.66 ns         2.66 ns    264427480
  BM_ctype_isgraph_y4                2.66 ns         2.66 ns    264155250
  BM_ctype_islower_n                 2.66 ns         2.66 ns    264421600
  BM_ctype_islower_y                 2.66 ns         2.66 ns    264341148
  BM_ctype_isprint_n                 2.66 ns         2.66 ns    264415198
  BM_ctype_isprint_y1                2.66 ns         2.66 ns    264268793
  BM_ctype_isprint_y2                2.66 ns         2.66 ns    264419205
  BM_ctype_isprint_y3                2.66 ns         2.66 ns    264205886
  BM_ctype_isprint_y4                2.66 ns         2.66 ns    264440797
  BM_ctype_isprint_y5                2.72 ns         2.72 ns    264333293
  BM_ctype_ispunct_n                 3.52 ns         3.51 ns    198956572
  BM_ctype_ispunct_y                 3.38 ns         3.38 ns    201661792
  BM_ctype_isspace_n                 3.39 ns         3.39 ns    206896620
  BM_ctype_isspace_y1                3.39 ns         3.39 ns    206569020
  BM_ctype_isspace_y2                3.39 ns         3.39 ns    206564415
  BM_ctype_isupper_n                 2.76 ns         2.75 ns    254227134
  BM_ctype_isupper_y                 2.76 ns         2.75 ns    254235314
  BM_ctype_isxdigit_n                3.60 ns         3.60 ns    194418653
  BM_ctype_isxdigit_y1               2.97 ns         2.97 ns    236082424
  BM_ctype_isxdigit_y2               3.48 ns         3.48 ns    200390011
  BM_ctype_isxdigit_y3               3.48 ns         3.48 ns    202255815

arm32 before:
  BM_ctype_isalnum_n                 4.77 ns         4.76 ns    129230464
  BM_ctype_isalnum_y1                4.88 ns         4.87 ns    147939321
  BM_ctype_isalnum_y2                4.74 ns         4.73 ns    145508054
  BM_ctype_isalnum_y3                4.81 ns         4.80 ns    144968914
  BM_ctype_isalpha_n                 4.80 ns         4.79 ns    148262579
  BM_ctype_isalpha_y1                4.74 ns         4.73 ns    145061326
  BM_ctype_isalpha_y2                4.83 ns         4.82 ns    147642546
  BM_ctype_isascii_n                 3.74 ns         3.72 ns    186711139
  BM_ctype_isascii_y                 3.79 ns         3.78 ns    183654780
  BM_ctype_isblank_n                 4.20 ns         4.19 ns    169733252
  BM_ctype_isblank_y1                4.19 ns         4.18 ns    165713363
  BM_ctype_isblank_y2                4.22 ns         4.21 ns    168776265
  BM_ctype_iscntrl_n                 4.75 ns         4.74 ns    145417484
  BM_ctype_iscntrl_y1                4.82 ns         4.81 ns    146283250
  BM_ctype_iscntrl_y2                4.79 ns         4.78 ns    148662453
  BM_ctype_isdigit_n                 4.77 ns         4.76 ns    145789210
  BM_ctype_isdigit_y                 4.84 ns         4.84 ns    146909458
  BM_ctype_isgraph_n                 4.72 ns         4.71 ns    145874663
  BM_ctype_isgraph_y1                4.86 ns         4.85 ns    142037606
  BM_ctype_isgraph_y2                4.79 ns         4.78 ns    145109612
  BM_ctype_isgraph_y3                4.75 ns         4.75 ns    144829039
  BM_ctype_isgraph_y4                4.86 ns         4.85 ns    146769899
  BM_ctype_islower_n                 4.76 ns         4.75 ns    147537637
  BM_ctype_islower_y                 4.79 ns         4.78 ns    145648017
  BM_ctype_isprint_n                 4.82 ns         4.81 ns    147154780
  BM_ctype_isprint_y1                4.76 ns         4.76 ns    145117604
  BM_ctype_isprint_y2                4.87 ns         4.86 ns    145801406
  BM_ctype_isprint_y3                4.79 ns         4.78 ns    148043446
  BM_ctype_isprint_y4                4.77 ns         4.76 ns    145157619
  BM_ctype_isprint_y5                4.91 ns         4.90 ns    147810800
  BM_ctype_ispunct_n                 4.74 ns         4.73 ns    145588611
  BM_ctype_ispunct_y                 4.82 ns         4.81 ns    144065436
  BM_ctype_isspace_n                 4.78 ns         4.77 ns    147153712
  BM_ctype_isspace_y1                4.73 ns         4.72 ns    145252863
  BM_ctype_isspace_y2                4.84 ns         4.83 ns    148615797
  BM_ctype_isupper_n                 4.75 ns         4.74 ns    148276631
  BM_ctype_isupper_y                 4.80 ns         4.79 ns    145529893
  BM_ctype_isxdigit_n                4.78 ns         4.77 ns    147271646
  BM_ctype_isxdigit_y1               4.74 ns         4.74 ns    145142209
  BM_ctype_isxdigit_y2               4.83 ns         4.82 ns    146398497
  BM_ctype_isxdigit_y3               4.78 ns         4.77 ns    147617686

arm32 after:
  BM_ctype_isalnum_n                 4.35 ns         4.35 ns    161086146
  BM_ctype_isalnum_y1                4.36 ns         4.35 ns    160961111
  BM_ctype_isalnum_y2                4.36 ns         4.36 ns    160733210
  BM_ctype_isalnum_y3                4.35 ns         4.35 ns    160897524
  BM_ctype_isalpha_n                 3.67 ns         3.67 ns    189377208
  BM_ctype_isalpha_y1                3.68 ns         3.67 ns    189438146
  BM_ctype_isalpha_y2                3.75 ns         3.69 ns    190971186
  BM_ctype_isascii_n                 3.69 ns         3.68 ns    191029191
  BM_ctype_isascii_y                 3.68 ns         3.68 ns    191011817
  BM_ctype_isblank_n                 4.09 ns         4.09 ns    171887541
  BM_ctype_isblank_y1                4.09 ns         4.09 ns    171829345
  BM_ctype_isblank_y2                4.08 ns         4.07 ns    170585590
  BM_ctype_iscntrl_n                 4.08 ns         4.07 ns    170614383
  BM_ctype_iscntrl_y1                4.13 ns         4.11 ns    171495899
  BM_ctype_iscntrl_y2                4.19 ns         4.18 ns    165255578
  BM_ctype_isdigit_n                 4.25 ns         4.24 ns    165237008
  BM_ctype_isdigit_y                 4.24 ns         4.24 ns    165256149
  BM_ctype_isgraph_n                 3.82 ns         3.81 ns    183610114
  BM_ctype_isgraph_y1                3.82 ns         3.81 ns    183614131
  BM_ctype_isgraph_y2                3.82 ns         3.81 ns    183616840
  BM_ctype_isgraph_y3                3.79 ns         3.79 ns    183620182
  BM_ctype_isgraph_y4                3.82 ns         3.81 ns    185740009
  BM_ctype_islower_n                 3.75 ns         3.74 ns    183619502
  BM_ctype_islower_y                 3.68 ns         3.68 ns    190999901
  BM_ctype_isprint_n                 3.69 ns         3.68 ns    190899544
  BM_ctype_isprint_y1                3.68 ns         3.67 ns    190192384
  BM_ctype_isprint_y2                3.67 ns         3.67 ns    189351466
  BM_ctype_isprint_y3                3.67 ns         3.67 ns    189430348
  BM_ctype_isprint_y4                3.68 ns         3.68 ns    189430161
  BM_ctype_isprint_y5                3.69 ns         3.68 ns    190962419
  BM_ctype_ispunct_n                 4.14 ns         4.14 ns    171034861
  BM_ctype_ispunct_y                 4.19 ns         4.19 ns    168308152
  BM_ctype_isspace_n                 4.50 ns         4.50 ns    156250887
  BM_ctype_isspace_y1                4.48 ns         4.48 ns    155124476
  BM_ctype_isspace_y2                4.50 ns         4.50 ns    155077504
  BM_ctype_isupper_n                 3.68 ns         3.68 ns    191020583
  BM_ctype_isupper_y                 3.68 ns         3.68 ns    191015669
  BM_ctype_isxdigit_n                4.50 ns         4.50 ns    156276745
  BM_ctype_isxdigit_y1               3.28 ns         3.27 ns    214729725
  BM_ctype_isxdigit_y2               4.48 ns         4.48 ns    155265129
  BM_ctype_isxdigit_y3               4.48 ns         4.48 ns    155216846

I've also corrected a small mistake in the documentation for isxdigit().

Test: tests and benchmarks
Change-Id: I4a77859f826c3fc8f0e327e847886882f29ec4a3
2019-10-08 12:04:09 -07:00
Ryan Prichard
41488b79c4 Merge "Revert "Revert "Add benchmarks that run simple programs""" 2019-09-27 19:59:50 +00: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
Ryan Prichard
2c236bc506 Revert "Revert "Add benchmarks that run simple programs""
This reverts commit 3bf27c86d1.

Disable the 32-bit glibc target. We're not interested in benchmarking that
target, and the bench_noop_nostl executable doesn't build when ASAN is
turned on, because the libclang_rt.asan_cxx-i386.a lib contains
ubsan_type_hash_itanium.cc.o, which needs __dynamic_cast and various
STL typeinfo variables. The equivalent libclang_rt.asan_cxx-x86_64.a
lib doesn't have ubsan_type_hash_itanium.cc.o in it.

Bug: http://b/141693636
Test: m bench_noop_nostl bench_noop bench_noop_static ASAN_OPTIONS=detect_leaks=0 SANITIZE_HOST=address
Change-Id: Id6de17e622682f3a166367ad670cba5bfa6aee47
2019-09-26 16:18:37 -07:00
Elliott Hughes
f5b44a5ea6 Merge "benchmarks: remove more boilerplate." 2019-09-26 21:38:52 +00:00
Raman Tenneti
0878ac991a Merge "Revert "Add benchmarks that run simple programs"" 2019-09-26 17:54:33 +00:00
Raman Tenneti
3bf27c86d1 Revert "Add benchmarks that run simple programs"
This reverts commit aa85ac2b08.

Reason for revert: builds are broken - Bug: 141693636

Change-Id: I7502813ae519719c578a05676a0adf9537019bd3
2019-09-26 17:52:48 +00:00
Elliott Hughes
96705e3712 benchmarks: remove more boilerplate.
Many of our benchmarks are basically just "call one function with a
fixed argument". We don't need to keep repeating all the boilerplate for
that.

This also ensures we don't forget the benchmark::DoNotOptimize, which --
in addition to being a good idea in general -- specifically solves the
problem with gettid benchmark and provides a more accurate result by
removing the indirection through a function pointer.

Test: ran benchmarks
Change-Id: Id67535243678cd0d48f51cf25141e2040da9af03
2019-09-26 07:42:23 -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
Ryan Prichard
ef0adb1275 Merge "run-on-host fixes" 2019-09-25 19:48:35 +00:00
Ryan Prichard
aa85ac2b08 Add benchmarks that run simple programs
Specifically, test the wall-clock time for running:
 * a C program that does nothing (i.e. no STL)
 * a C++ program that does nothing
 * a statically-linked C++ program
 * toybox true (in /system/bin and /vendor/bin)
 * mksh -c true (in /system/bin and /vendor/bin)

Test: bionic-spawn-benchmarks
Change-Id: I961850ec90004cac83088feab5783f4f27768be1
2019-09-25 09:35:43 +00:00
Ryan Prichard
3cfb89d451 run-on-host fixes
* Fix the path to bionic-benchmarks-glibc

 * Add symlinks for the toybox symlink commands. Each symlink bypasses the
   intermediate symlink in ${OUT}/system/bin and points to the final
   toybox binary. Suppress a bunch of warnings by skipping symlinks for
   non-existent files.

   The new spawn benchmarks try to run /system/bin/true. (They also try to
   run /vendor/bin/true and print an error.)

 * Quote "$@"

 * Use soong_ui.bash --dumpvars-mode to set a bunch of variables, rather
   than get_build_var, which invokes Soong once per variable. This reduces
   the "build/run-on-host.sh" runtime from 4s to 1.3s.

 * build/run-on-host.sh isn't executable and is only useful when it's
   sourced into another shell, so remove its shebang to reduce confusion.

Bug: none
Test: \
  . build/envsetup.sh
  lunch aosp_x86_64-userdebug
  . bionic/build/run-on-host.sh
  prepare MODULES-IN-bionic MODULES-IN-external-toybox
  /system/bin/true

Change-Id: I59e9a6aca77d35b16bdf51759c5fc7e725bfc67c
2019-09-24 15:36:31 -07:00
Elliott Hughes
dfa3231fae Merge "Fix running tests/benchmarks on the host." 2019-04-27 16:15:21 +00:00
Elliott Hughes
4da99ffe5e Fix running tests/benchmarks on the host.
This was broken by all the mainline modules stuff. It's quite a bit
hairier to set up now, given that we don't have an apexd on the host.
An alternative might be to actually set up a fake /apex that points to
the bootstrap directories?

Test: ./benchmarks/run-on-host.sh 64
Test: ./tests/run-on-host.sh 64
Change-Id: If2c277ba492c7c443cdf51526ea42f56568e2ea6
2019-04-26 17:45:17 -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
7ec2c8a9b6 Add malloc benchmarks.
Adding some benchmarks that keep a certain number of allocation
around. This benchmark should not be used as an absolute for determining
what is a good/bad native allocator. However, it should be used to make
sure that numbers are not completely changed between allocator versions.

Also update the malloc sql benchmark to match the same style as these
new benchmarks.

Bug: 129743239

Test: Ran these benchmarks.
Change-Id: I1995d98fd269b61d9c96efed6eff3ed278e24c97
2019-04-05 14:45:15 -07:00
Yi Kong
358603a409 Modernise code to use override specifier
Generated by clang-tidy.

Test: m checkbuild
Change-Id: I8e23da6b8af31b291be2eefe9937ca222ea8a8c3
2019-03-29 14:27:27 -07:00
Chih-Hung Hsieh
770032ddfa Fix/suppress bionic google-explicit-constructor warnings
* Add explicit to conversion constructors/operators

Bug: 28341362
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,google-explicit-constructor
Change-Id: Id1ad0327c1b8c6f094bcbb3ae599bc1f716b3f2f
2019-01-02 11:04:05 -08:00
Mark Salyzyn
ba1a723ad1 switch to using android-base/file.h instead of android-base/test_utils.h
Test: compile
Bug: 119313545
Change-Id: I664fb32522d01909c603d7b903475c4e9aea9223
2018-11-14 15:46:49 -08:00
Christopher Ferris
9ac0cd5f85 Fix test failures.
- Fix the help output for new benchmarks help output.
- Fix incorrect regex for sanitizing output.

Test: Ran unit tests and they pass.
Change-Id: I227eef3ce8c4ce639321e5ab8a57d0877063ede1
2018-11-07 14:30:55 -08: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
efaa60ff6c Merge "Only use NDK libraries in the benchmarks." 2018-09-25 22:13:09 +00: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
4fae703029 Touch the memory when doing malloc/free benchmark.
Also, update the benchmark loop for modern C++.

Test: Ran benchmarks.
Change-Id: I925446b893793eb8c2c6759716cdd3dbbcf1e7c1
2018-09-20 15:03:49 -07:00
Peter Collingbourne
ed16b344e7 Merge "benchmarks: Fix the benchmark tests." 2018-09-14 02:16:52 +00:00
Peter Collingbourne
62011c27a7 benchmarks: Update the documentation.
Update the locations of the benchmark binaries to match where they
are currently installed.
2018-09-13 16:08:18 -07:00
Peter Collingbourne
c282ca9f44 benchmarks: Fix the benchmark tests.
Update the list of benchmarks to include the recently added strncmp
benchmarks.
2018-09-13 16:06:01 -07:00
Haibo Huang
e466cc0d55 Add benchmark for strncmp
Test: run benchmark
Change-Id: Id99d81fe4d2a72a7f22414c7eea3ef3d873022ab
2018-08-21 21:04:43 +00: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
Adhemerval Zanella
43f2b77c8b Add new strcmp/strncmp benchmark
This patch adds a new strcmp/strcmp benchmark with different set of
inputs.  It cover all pre-defined range values (small, medium, large)
for aligned inputs and also small range for unaligned ones.

Test: Ran new string test suite with a single bionic iteration.
Change-Id: Ice78d74c3583a33158eaba3309c10df54044aa28
2018-08-11 07:20:53 +00:00
Adhemerval Zanella
0e4fd755a0 Add new memcmp benchmark
This patch adds a new memcmp benchmark with different set of inputs.
It covers all pre-defined range values (small, medium, large) for
aligned inputs and also medium range for unaligned ones.

Test: Ran new string test suite with a single bionic iteration.
Change-Id: Icdb95220a62d46bd71fa6ffbbf4567a9a05b7685
2018-08-11 07:20:13 +00:00
Adhemerval Zanella
eda94aa1ae Add option to define ranges sets for benchmarks
This patch add an option to use the pre-define set of ranges along
with macros AT_ONEBUF_MANUAL_ALIGN_* and AT_TWOBUF_MANUAL_ALIGN1_*.

The size argument can be either a number or a string representing
the sets of values:

  * SMALL for values between 1 and 256.
  * MEDIUM for values between 512 and 128KB.
  * LARGE for values between 256KB and 2048KB.

Test: Ran new string test suite with a single bionic iteration.
Change-Id: Ieda81ee9a5019991b0b2f97d4ca3a237127c5848
2018-08-11 00:27:27 +00:00
Adhemerval Zanella
72fe1c8df6 Add pow benchmark
As for exp/exp2 benchmark, this patch add two benchmark for pow:
one which measures thoughput and one which measures latency.

The input data is the same as powf.

Test: ran 32-bit and 64-bit x86 tests on host
Change-Id: I04335fac9e76fb3f39935323dacf6b7be6a6f917
2018-08-08 18:04:48 -03:00
Adhemerval Zanella
56f4511c39 Add log and log2 benchmark
Similar to exp/exp2, this patch add two benchmarks for log and log2:
one which measures thoughput and one which measures latency.

The input data is based on logf/log2f one (reduced trace based on 2.8
billion samples extracted from specpu2017 521.wrf_r benchmark).

Test: ran 32-bit and 64-bit x86 tests on host

Change-Id: I51a9e2960e45d5619585e685eaa7634cc7be901b
2018-08-08 18:04:48 -03:00
Adhemerval Zanella
10d330af34 Add exp and exp2 benchmark
This patch add two benchmarks for both exp and exp2, one which measures
thoughput and one which measures latency. The latency benchmark works by
creating a dependency on the previous iteration and with a zero multiply
to avoid changing the input value.

The input is based on expf/exp2f benchmark (reduced trace based on 2.4
billion samples extracted from specpu2017 521.wrf_r benchmark).

Test: ran 32-bit and 64-bit x86 tests on host
2018-08-08 15:06:09 -03:00
Yi Kong
32bc0fcf69 Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.

Test: m
Bug: 68236239
Change-Id: I5b4123bc6709641315120a191e36cc57541349b2
2018-08-02 18:09:44 -07:00
Haibo Huang
d5ee4c5fb7 Change args to int64_t
The new benchmark framework uses int64_t for args.

Related benchmark change:
9913418d32 (diff-b9f55422dc0bd52759c6aaa25c305bb0R757)

Upgrade benchmark framework:
https://android-review.googlesource.com/c/platform/external/google-benchmark/+/714118

Test: compile and run bionic benchmark
Change-Id: I1b81c853c28abbead1816bf0be7a20a35e036619
2018-07-07 04:14:22 +00:00
Adhemerval Zanella
7871ca1075 Add sinf/cosf/sincosf benchmark
Similar to expf/exp2f, this patch add two benchmarks for sinf, cosf, and
sincosf: one which measures thoughput as default and one which measures
latency.

The input in 512 random value divided in 8 ranges:

  1. 0.0 <= x < 0.1
  2. 0.1 <= x < 0.7
  3. 0.7 <= x < 3.1
  4. -3.1 <= x < 3.1
  5. 3.3 <= x < 33.3
  6. 100.0 <= x < 1000.0
  7. 1e6 <= x < 1e32
  8. 1e32 < x < FLT_MAX

Test: ran 32-bit and 64-bit x86 tests on host
Change-Id: I92bc2f1fac911c573c5122911d08ca590311578a
2018-06-19 11:34:54 -03:00
Adhemerval Zanella
ff5a353112 Add logf and log2f benchmark
Similar to expf/exp2f, this patch add two benchmarks for logf and log2f:
one which measures thoughput and one which measures latency.

The input data is based on a reduced trace based on 2.8 billion samples
extracted from specpu2017 521.wrf_r benchmark.

Test: ran 32-bit and 64-bit x86 tests on host
Change-Id: If4fbd7eb3d40f8e155935149a82f162b222d5506
2018-06-19 11:34:54 -03:00
Adhemerval Zanella
872c8b5133 Add powf benchmark
As for expf/exp2f benchmark, this patch add two benchmark for powf:
one which measures thoughput and one which measures latency.

The input data is based on a reduced trace from 2.3 billion samples
extracted from specpu2017 521.wrf_r benchmark.

Test: ran 32-bit and 64-bit x86 tests on host
Change-Id: Id8943d90dd5452146e55fb75708daaf7bf0e25fa
2018-06-19 11:34:54 -03:00
Adhemerval Zanella
357f6c1b47 Add expf and exp2f benchmark
This patch add two benchmarks for both expf and exp2f, one which
measures thoughput, as default, and one which measures latency. The
latency benchmark works by creating a dependency on the previous
iteration and with a zero multiply to avoid changing the input value.

The input is based on a reduced trace based on 2.4 billion samples
extracted from specpu2017 521.wrf_r benchmark.

Test: ran 32-bit and 64-bit x86 tests on host
Change-Id: Ic0d40cc4977dd6875fb7431146fc38ea0e6e0bc2
2018-06-19 11:34:54 -03:00
Elliott Hughes
e332f658e0 Switch to FreeBSD's actual sincos.
Before:
  BM_math_sin_fast                48 ns         48 ns   14693053
  BM_math_sincos                  61 ns         61 ns   11470219

After:
  BM_math_sin_fast                48 ns         48 ns   14725120
  BM_math_sincos                  43 ns         43 ns   16329843

Bug: N/A
Test: ran tests, benchmarks
Change-Id: I8693c64135233c0641af5302c38748f47ac76737
2018-05-09 12:25:12 -07:00
Christopher Ferris
bfb7c761d4 Fix bug in --bionic_cpu option handling.
Make sure that all the variables are properly initialized.

Remove the code that verifies the core to enable using get_schedaffinity
since that make it impossible to change the cpu for different tests.

Change the cpu_to_lock to an int, it really didn't need to be a long.

Fix a few missing tests.

Test: Ran unit tests.
Test: Built the tests and ran on different cpus, verifying that the
Test: chosen cpu was correct.
Test: Created an xml file that had different cpus for different tests
Test: and verified that it locked to each cpu properly.
Change-Id: Ie7b4ad8f306f13d6e968d118e71bb5dc0221552a
2018-05-04 17:34:35 -07:00
Tom Cherry
ee8e3dd67c Remove non-trivial constructors/destructors from SystemProperties
With the goal of disallowing exit time destructors, SystemProperties's
non-trivial destructor needs to be removed.  This means replacing the
union hack with yet another hack as we don't want to allocate anything
despite relying on some polymorphism.

Bug: 73485611
Test: boot bullhead
Change-Id: I64223714c9b26c9724bfb8f3e2b0168e47b56bc8
2018-02-21 15:10:17 -08:00
Elliott Hughes
cbc80ba9d8 Switch the rest of our internal headers to #pragma once.
We've been using #pragma once for new internal files, but let's be more bold.

Bug: N/A
Test: builds
Change-Id: I7e2ee2730043bd884f9571cdbd8b524043030c07
2018-02-13 14:27:17 -08:00
Elliott Hughes
d50a1de565 Run bpfmt manually.
Bug: N/A
Test: builds
Change-Id: I0cf145c3b699ac8ef170a63366832f63a9cc1a91
2018-02-05 17:30:57 -08:00
Yabin Cui
5a00ba7c1c Support priority inheritance mutex in 32-bit programs.
Add fast path calling PIMutexTryLock() in pthread_mutex_lock.
Add trace for pi mutex waiting.

Bug: http://b/29177606
Test: run bionic-unit-tests.
Test: run bionic-benchmarks.

Change-Id: I30b6436692d5ea6b63ca9905df745edb843b5528
2018-02-01 16:01:46 -08:00
Yabin Cui
6b9c85b36d Support priority inheritance mutex in 64bit programs.
Bug: http://b/29177606
Test: run bionic-unit-tests on walleye.
Test: run bionic-unit-tests-glibc on host.
Change-Id: Iac349284aa73515f384e7509445f87434757f59e
2018-01-24 16:11:07 -08:00
Elliott Hughes
5cec377f49 Address a bunch of clang-tidy complaints.
There were a bunch more unreasonable/incorrect ones, but these ones
seemed legit. Nothing very interesting, though.

Bug: N/A
Test: ran tests, benchmarks
Change-Id: If66971194d4a7b4bf6d0251bedb88e8cdc88a76f
2018-01-19 15:56:12 -08:00
Christopher Ferris
4c5fde0e5e Remove workaround for running property tests.
Also fix the tests for some missing benchmarks that have been
added recently.

Test: Ran bionic benchmarks tests and all pass.
Test: Ran bionic benchmarks to verify that there are no crashes.
Change-Id: I8501553e8a229c0c6ea81e894e91ac2f5f2fe26c
2018-01-08 16:13:14 -08:00
Elliott Hughes
811a1dd868 Merge "More benchmarks." 2017-12-19 20:23:39 +00:00
Tom Cherry
64d03a287e Add an end-to-end property benchmark.
This change adds an end-to-end property benchmark that finds each
property currently accessible on the system via
__system_property_find().

Test: run this benchmark
Change-Id: I7d20cc9caf36bf3650c3bb3f58500b7df09a908a
2017-12-19 11:25:42 -08: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
Elliott Hughes
3b644e932a Trivial scanf benchmarks.
Bug: http://b/68672236
Test: ran benchmarks
Change-Id: I96514be5e67969b65205e953051c524be3626ec4
2017-12-11 14:46:22 -08:00
Mark Salyzyn
6f9c35ded2 bionic: benchmark: add clock_getres performance tests
Provide a means to check vdso kernel performance for all reasoned
combinations of clock_getres, same set of ids as clock_gettime.

Add to suites/vdso.xml

Test: /data/nativetest{64}/bionic-benchmarks-tests/bionic-benchmarks-tests
      /data/benchmarktest{64}/bionic-benchmarks/bionic-benchmarks \
        --bionic_xml=vdso.xml --benchmark_filter=BM_time_clock_getres*
Bug: 63737556
Change-Id: I11ea200f67aec2a2f6ad9284960f2941298da222
2017-12-07 09:41:31 -08:00
Mark Salyzyn
6ffa10f483 bionic: benchmark: additional clock_gettime performance tests
Provide a means to check vdso kernel performance for each of
CLOCK_MONOTONIC (current), CLOCK_MONOTONIC_COARSE,
CLOCK_MONOTONIC_RAW, CLOCK_REALTIME, CLOCK_REALTIME_COARSE,
CLOCK_BOOTTIME.

Add a suites/vdso.xml to select subset of tests impacted by
vdso implementations.

Test: /data/nativetest{64}/bionic-benchmarks-tests/bionic-benchmarks-tests
      /data/benchmarktest{64}/bionic-benchmarks/bionic-benchmarks \
        --bionic_xml=vdso.xml --benchmark_filter=BM_time_clock_gettime*
Bug: 63737556
Change-Id: Ibc48e838e50929527ce8d221dd1a608bf185cbc2
2017-12-07 09:41:13 -08:00
Christopher Ferris
e2188d460b Add new benchmark options.
Add a bunch of extra options to allow greater flexibility for creating
benchmarks. Add a pattern option that can be used to represent any
one buffer or two buffer possibility. This should fully replace the
functionality of microbench.

Add a single option for one buffer benchmarks and two buffer benchmarks
that represents all of the possible options to run a string benchmark.

Add a string test suite that includes all string benchmarks using the
above option.

Test: New unit tests to cover all the new options, and all pass.
Test: Ran new string test suite with a single bionic iteration.
Change-Id: Idb13ea15e44cec626e9f46672ccd648d7ca72ba6
2017-11-30 15:49:45 -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
Christopher Ferris
ad05730143 Fix bionic benchmark unit tests.
Test: Ran unit tests.
Change-Id: I729572b101c7011cde5e7da4a72af7ede719b76b
2017-11-07 15:18:33 -08:00
Elliott Hughes
5305a4d4a7 10x printf speedup.
Android is UTF-8. Don't make everyone pay to convert UTF-8 to ASCII just
so we can recognize '%'. With UTF-8 we can just strchr forwards.

Before:

  ---------------------------------------------------------------
  Benchmark                        Time           CPU Iterations
  ---------------------------------------------------------------
  BM_stdio_printf_literal       1290 ns       1290 ns     442554
  BM_stdio_printf_s             1204 ns       1204 ns     582446
  BM_stdio_printf_d             1206 ns       1206 ns     578311
  BM_stdio_printf_1$s           2263 ns       2263 ns     310002

After:

  ---------------------------------------------------------------
  Benchmark                        Time           CPU Iterations
  ---------------------------------------------------------------
  BM_stdio_printf_literal        178 ns        178 ns    3394001
  BM_stdio_printf_s              246 ns        246 ns    2850284
  BM_stdio_printf_d              252 ns        252 ns    2778610
  BM_stdio_printf_1$s            363 ns        363 ns    1929011

Add missing __find_arguments error checking to the wide variant to match
the regular one.

Also replace various char/wchar_t differences with the macro.

Bug: http://b/67371539
Test: ran tests
Change-Id: I18f122009c22699943ab5d666a98ea594a972c40
2017-11-03 14:19:00 -07:00
Elliott Hughes
928059907b Add basic printf benchmarks.
Bug: http://b/67371539
Test: ran benchmarks
Change-Id: I6ad05540079776b2df4cc8d9c02440c61e42037d
2017-10-26 15:43:34 -07:00
Josh Gao
286b3a8b2d Fix pthread benchmarks.
PauseTiming and ResumeTiming are thread-local, and unbalanced calls to
them leads to obviously bogus results like:

    Benchmark                          Time            CPU Iterations
    -----------------------------------------------------------------
    BM_pthread_exit_and_join      212600 ns    59981418 ns         12
    BM_pthread_create_and_run  212997341 ns -1569132344 ns       1000

Bug: http://b/68170209
Test: ran bionic benchmarks
Change-Id: Ia88cd6af9ff524443850d834a96cf5dd9c7f3ed9
2017-10-24 14:02:54 -07:00
Elliott Hughes
5c6a7bf0dc Remove some legacy declarations from <math.h>.
These are still needed for backwards compatibility with code built by old
versions of the NDK, but we don't need to pollute the headers with them.

Also lose the hand-written code for these. The compiler-generated code
is either the same or better, and no new code is calling these functions
anyway.

Bug: N/A
Test: ran tests
Change-Id: Ib01ad9805034433e0105aec882608cc8e6526f78
2017-10-19 14:15:31 -07: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
Elliott Hughes
0bfcbaf4d0 Add new status document, based on internal wiki.
Also start breaking up the monolithic top level README.md, pulling the
32-bit ABI stuff out into its own file, and moving the remaining benchmark
documentation in with the rest of the benchmark documentation.

Bug: N/A
Test: N/A
Change-Id: Ic1b9995e27b5044199ed34883cc0b8faa894df0e
2017-08-29 11:07:36 -07:00
Anders Lewis
814359a880 Update the bionic benchmarks documentation.
Test: NA
Change-Id: I6b804a1655b5cb76f189366070d478680f40c5d1
2017-08-25 10:41:38 -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
Christopher Ferris
8e410a73d4 Merge "Fix local path assumption in interface_test." 2017-08-24 17:01:56 +00:00
Elliott Hughes
938bece9e0 Benchmark fgetln(3) and getline(3) as well as fgets(3).
On Pixel 2016, there's about 1us overhead for getline versus
fgets. fgetln(3) is worse still because of the intermediate buffering
(though it might actually be better if you were only reading one line
whose length was less than BUFSIZ).

Also use somewhat realistic input for these benchmarks: /dev/zero makes
no sense at all.

Bug: N/A
Test: ran benchmarks
Change-Id: I4a319825a37ac3849014c4c6b31523c1e200c641
2017-08-23 14:03:43 -07:00
Elliott Hughes
d706fe5f9e Fix the stdio fwrite benchmark.
Can't write to a read-only file. (Mode "rw" isn't meaningful, but isn't
considered an error by any libc I know of.)

Bug: http://b/64585477
Test: ran benchmarks
Change-Id: Ifec1d68414bfc8f3cc8d7f912cb135dccb2e7a41
2017-08-23 00:05:21 +00: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
Christopher Ferris
30438e4cea Merge "Improve error handling and fix minor bugs in bionic benchmarks." 2017-08-11 02:04:47 +00:00
Christopher Ferris
73c3be2219 Merge "Add musl benchmarks." 2017-08-10 23:44:04 +00:00
Anders Lewis
a98a5fb63e Improve error handling and fix minor bugs in bionic benchmarks.
Test: Unit tests.
Change-Id: I224ae4c7f195176eb8a87deddb2debcbf0f24ba3
2017-08-09 17:24:13 -07:00
Anders Lewis
ac4f4b43a3 Add musl benchmarks.
Test: Unit tests.
Change-Id: Ifb2911825f84b95fe64a803bfabd32fb81210eae
2017-08-09 15:26:37 -07:00
Elliott Hughes
c2223f746c Track tinyxml2 API change.
Bug: http://b/64459264
Test: builds
Change-Id: I02206b9d40571f306ce712345a36c2754ac73a97
2017-08-08 11:23:27 -07:00
Anders Lewis
a7b0f88997 Implement interface for bionic benchmarks.
Test: Unit tests.
Change-Id: Ic61932f61ddd572e2f045b601f9da6e090cdc45d
2017-08-07 13:16:09 -07:00
Christopher Ferris
5fc1f6e887 Really fix the mac build.
I forgot an underscore.

Test: Builds.
Change-Id: Ib7da13dea315822af89c53a569fb0a0c2fd5d321
2017-07-12 23:10:07 -07:00
Christopher Ferris
bad43c7af4 Fix max build.
Test: Built properly.
Change-Id: I37b8ac7d42653617be6611b640a883066257214c
2017-07-12 19:33:54 -07:00
Christopher Ferris
61b7e114dd Merge "Support memory alignment tests for string_benchmark.cpp" 2017-07-12 22:56:13 +00: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
George Burgess IV
705910094d bionic: fix assorted static analyzer warnings
Warnings:

bionic/libc/bionic/fts.c:722:5: warning: Null passed to a callee that
requires a non-null 1st parameter

bionic/libc/bionic/sched_cpualloc.c:34:25: warning: Result of 'malloc'
is converted to a pointer of type 'cpu_set_t', which is incompatible
with sizeof operand type 'unsigned long'

bionic/linker/linker_main.cpp:315:7: warning: Access to field 'e_type'
results in a dereference of a null pointer (loaded from variable
'elf_hdr')

bionic/linker/linker_main.cpp:493:66: warning: Access to field 'e_phoff'
results in a dereference of a null pointer (loaded from variable
'elf_hdr')

bionic/linker/linker_main.cpp:90:14: warning: Access to field 'next'
results in a dereference of a null pointer (loaded from variable 'prev')

Bug: None
Test: mma; analyzer warnings are gone. CtsBionicTestCases pass.
Change-Id: I699a60c2c6f64c50b9ea06848a680c98a8abb44a
2017-06-28 15:03:15 -07:00