We can (and should) use `inline` in C++ but not in C headers that
need to support ANSI/C89/C90. `__inline__` works everywhere, but
traditionally we've used the BSD `__inline` in public headers.
Change-Id: I920e0a1f5fcd01cf8ddd89240ef66b25c50378d7
Change the AT_All_XXX to AT_ALL_XXX.
Change the name of the from_prot and to_prot parameters to be more
descriptive.
Add a few extra large page sizes. Without this, it jumps from a
relatively small size to an extreme large size and nothing in
between.
Clang-format modified the args_shorthand initialization.
Test: Ran benchmarks on device.
Change-Id: I5105788cbf05793fcb4d86c26037ec435635631e
Specific parameters were chosen based on the frequency of their use in
Android.
Bug: 327496587
Test: local build and run
Change-Id: Iec225109f62e1e9cde133863d3cee8103172a6c8
Signed-off-by: Carlos Galo <carlosgalo@google.com>
Apparently we hadn't looked at the disassembly of these benchmarks since
implementing the various <ctype.h> functions inline, because they've all
been optimized away to literal loads of 0 or 1.
Obviously, this is not helpful when trying to judge further
optimizations.
Test: objdump and ran the benchmarks (on both arm64 and arm32)
Change-Id: Id66c4f7f4c92d9eee8937d31546158eda62ef3ba
This file no longer covers only mmap benchmarking, but also additional
memory related syscalls. Adjusting the name of this file to reflect the
broader utilization.
Bug: 327496587
Test: local build and run
Change-Id: I988e949589f9731fb1d85f489cd46ae64bf0a74c
Signed-off-by: Carlos Galo <carlosgalo@google.com>
This CL is created as a best effort to migrate test targets to the new Android ownership model.
It is based on historical data from repository history and insights from git blame.
Given the nature of this effort, there may be instances of incorrect attribution. If you find incorrect or unnecessary
attribution in this CL, please create a new CL to fix that.
For detailed guidelines and further information on the migration please refer to the link below,
go/new-android-ownership-model
Bug: 304529413
Test: N/A
Change-Id: Ie36b2a3245d9901323affcc5e51dafbb87af9248
A small refactor of the mmap benchmarks to make it easier to benchmark
the mmap and munmap separately. Add a mmap only and munmap only benchmark.
Add new madvise benchmarks.
Clean-up fixed mmap benchmarks to properly create the initial map.
Test: Ran benchmarks on host and on device.
Change-Id: I2fc306dd3eba151cff066da8df8f0168df0ade69
Benchmark added to test an optimization I'll send round next, test added
when an even bigger refactoring (as part of a more interesting
optimization) broke strtol() in a way the strtol() tests didn't notice.
Test: treehugger
Change-Id: Ic974900021107938dbbbe98648960adb102d9595
The property_benchmark needs to use the `load_default_path` parameter in
when writing its test, which is necessary now. Also, the benchmark
seemed to retry infinitely when the initialization failed, so it has now
been modified to exit when the initialization fails, and send a message
as it does so.
Bug: 305838406
Test: adb shell /data/benchmarktest/bionic-benchmarks/bionic-benchmarks --benchmark_filter=BM_property
Change-Id: Idb235b0e7c119fa08ace5b814d7f7404dd0eaeb3
The bionic benchmarks set the decay time in various ways, but
don't necessarily restore it properly. Add a new method for
getting the current decay time and then a way to restore it.
Right now the assumption is that the decay time defaults to zero,
but in the near future that assumption might be incorrect. Therefore
using this method will future proof the code.
Bug: 302212507
Test: Unit tests pass for both static and dynamic executables.
Test: Ran bionic benchmarks that were modified.
Change-Id: Ia77ff9ffee3081c5c1c02cb4309880f33b284e82
Add benchmarks to monitor performance of the syscalls which are frequently
used in Android. These benchmarks will help Android kernel team to catch
syscall performance regressions and flagging them early. They can also
be used to compare different kernel versions.
Add mmap/munmap syscall benchmarks as a starting point. mmap and munmap
are among most frequently used syscall in Andoird. Specific parameters
were also chosen based on the frequency of their use in Android.
Bug: 283058897
Test: local build and run
Change-Id: If8e53305174532dd698706ccd20e4b800d8720d7
err() not only adds its own newline, it'll add the strerror() output
first, so this stray newline messes up the error message. (Seen running
bionic benchmarks not as root, which causes the std_map benchmarks to
fail, which is especially annoying because it ends the whole benchmark
run, not just the specific benchmark, but that's a less obvious fix, so
I'm just fixing the trivial part here!)
Test: treehugger
Change-Id: I7e87ea4385c410942fbdd14e6fdfddbf7320082a
This is used to monitor the impact of different lock granularity in a
memory allocator. It creates different memory alloc/dealloc patterns
across different threads but keep the same amount of bytes to be
processed.
Bug: 288126442
Test: run benchmark with --benchmark_filter=BM_malloc_threads_throughput*
Change-Id: I24eea617a6346480524dcb8c0bdbe9bd8e90dd72
The lseek64, lstat64, pread64 and pwrite64 symbols have been removed
from musl 1.2.4.
Bug: 286415000
Test: builds
Change-Id: Icba9e92e1ccbb5b52d6c60e554ab411c9e5c1954
Currently, if a test is created like this:
BIONIC_BENCHMARK_WITH_ARG(BM_bench, "16");
Everything works as expected, a benchmark is created of BM_bench/16.
However, it is not possible to specify a benchmark should be called with
one argument, but iterate over different values. The example:
BIONIC_BENCHMARK_WITH_ARG(BM_bench, "16 32");
Creates a single benchmark run with two arguments:
BM_bench/16/32
This change modifies the algorithm to make it possible to create multiple
instances of the benchmark iterating over each argument as a single
argument. After this change, two benchmarks are executed:
BM_bench/16
BM_bench/32
To do the previous behavior, use:
BIONIC_BENCHMARK_WITH_ARG(BM_bench, "16/32");
This will create a single benchmark with two args. This format does
not support spaces in the args, so "16 / 32" is not valid.
Modified the test_small.xml to use the new format.
Test: All unit tests pass.
Change-Id: I6f486e1d4a90580c3dace0581ea65f439911ef5a
Add benchmark file dependency in tests instead of using hard-coded
path to bionic-benchmarks.
In addition, add a TEST_MAPPING file so the tests run when benchmark files change.
Test: All unit tests pass.
Test: Ran atest bionic-benchmarks-tests.
Change-Id: I95608f5b5e75d9d74930960a2431c9896b621ce8
This is a new mallopt option that will force purge absolutely
everything no matter how long it takes to purge.
Wrote a unit test for the new mallopt, and added a test to help
verify that new mallopt parameters do not conflict with each other.
Modified some benchmarks to use this new parameter so that we can
get better RSS data.
Added a new M_PURGE_ALL benchmark.
Bug: 243851006
Test: All unit tests pass.
Test: Ran changed benchmarks.
Change-Id: I1b46a5e6253538108e052d11ee46fd513568adec
The behavior of this benchmark includes three steps:
1. Use up to 16 MB by allocating blocks with given size in each thread.
2. Release the all blocks in random order.
3. Use up to 1.6 MB by allocating blocks with given size in each thread.
This is used to see how the allocator manages the free blocks and we can
measure the impact of randomization property used by the allocator.
Test: Run malloc-rss-benchmark $NUM_THREADS $ALLOC_SIZE
Change-Id: Ib68562996905839ee4367b1b059714e2325ca03e
Use /data/local/tests/unrestricted as on-device test path so that
debuggerd can generate proper back traces.
Bug: 199904562
Bug: 184739644
Test: treehugger
Change-Id: I4ae1fb3182dde081121179f1b099374119205dd3
For convenience, builds against musl libc currently use the
linux_glibc properties because they are almost always linux-specific
and not glibc-specific. In preparation for removing this hack,
tweak the linux_glibc properties by either moving them to host_linux,
which will apply to linux_glibc, linux_musl and linux_bionic, or
by setting appropriate musl or linux_musl properties. Properties
that must not be repeated while musl uses linux_musl and also still
uses the linux_glibc properties are moved to glibc properties, which
don't apply to musl. Whether these stay as glibc properties or get
moved back to linux_glibc later once the musl hack is removed is TBD.
Bug: 223257095
Test: m checkbuild
Test: m USE_HOST_MUSL=true host-native
Change-Id: I809bf1ba783dff02f6491d87fbdc9fa7fc0975b0
Fix references to symbols that don't exist in musl in the bionic
benchmarks, and disable the header tests for musl.
Bug: 190084016
Test: m USE_HOST_MUSL=true host-native
Change-Id: I6b1964afa4a7b6e6a4812e9f2605fcfc2fae9691
A decent chunk of the logcat profile is spent formatting the timestamps
for each line, and most of that time was going to snprintf(3). We should
find all the places that could benefit from a lighter-weight "format an
integer" and share something between them, but this is easy for now.
Before:
-----------------------------------------------------------
Benchmark Time CPU Iterations
-----------------------------------------------------------
BM_time_strftime 781 ns 775 ns 893102
After:
-----------------------------------------------------------
Benchmark Time CPU Iterations
-----------------------------------------------------------
BM_time_strftime 149 ns 147 ns 4750782
Much of the remaining time is in tzset() which seems unfortunate.
Test: treehugger
Change-Id: Ie0f7ee462ff1b1abea6f87d4a9a996d768e51056
I don't think the old benchmarks made any sense; going through all the
characters might have made sense as a unit test, but I'm not sure how
actionable they were for realistic cases. In particular, "all ASCII" is
a common special case that's worth measuring separately. I'm still not
hugely convinced, but at least separating the "ASCII" and "wide" paths
is an improvement. I can't think of a case where we did optimization
work on this kind of code without considering those two paths
separately.
I've added to the single-character benchmarks by splitting out the
separate cases instead --- one benchmark each for single-byte up to
4-byte characters.
Bug: http://b/206523398
Test: treehugger
Change-Id: I58cbfedb4b497a55580857eff307a024938cf006
Auto-generate NOTICE files for all the directories, and for each one
individually rather than mixing libc and libm together.
Test: N/A
Change-Id: I7e251194a8805c4ca78fcc5675c3321bcd5abf0a
This makes it easy to benchmark changes to bionic without needing
to reflash the device or mess with LD_LIBRARY_PATH.
Change-Id: Ic7ea0f075751f8f077612617802775d2d0a799dc
A lot of these benchmarks predate DoNotOptimize and rolled their own
hacks.
Bug: http://b/148307629
Test: ran benchmarks before & after and got similar results
Change-Id: If44699d261b687f6253af709edda58f4c90fb285
The benchmark calls __cxa_atexit 100000 times, then either exits early
without calling the destructors (_Exit) or exits normally, calling them
(exit).
Test: mmma bionic/benchmarks/spawn
Change-Id: I41fe702d6ef11acb7a1dec95bf546b5dc693bd4a