android_bionic/libc/private
Mark Salyzyn 79249b0897 bionic: add vdso clock_getres
clock_getres() should not be a hot call, nevertheless it is
~6-7 times faster for supported clock ids if it uses
__vdso_clock_getres if available.  There is a 3% performance
penalty for unsupported clock ids via __vdso_clock_getres with
respect to a direct syscall.

[TL;DR]

w/vdso32 kernel patches, locked cores to MAX, little cores only.

BEFORE:

hikey960 vdso (aarch64):

----------------------------------------------------------------------
Benchmark                               Time           CPU Iterations
----------------------------------------------------------------------
BM_time_clock_getres                  126 ns        126 ns    5577874
BM_time_clock_getres_syscall          127 ns        127 ns    5505016
BM_time_clock_getres_REALTIME         126 ns        126 ns    5574682
BM_time_clock_getres_BOOTTIME         126 ns        126 ns    5575237
BM_time_clock_getres_TAI              126 ns        126 ns    5576810
BM_time_clock_getres_unsupported      128 ns        128 ns    5480189

hikey960 vdso32 (aarch32):

----------------------------------------------------------------------
Benchmark                               Time           CPU Iterations
----------------------------------------------------------------------
BM_time_clock_getres                  199 ns        199 ns    3508708
BM_time_clock_getres_syscall          220 ns        220 ns    3184676
BM_time_clock_getres_REALTIME         199 ns        199 ns    3509697
BM_time_clock_getres_BOOTTIME         199 ns        199 ns    3513551
BM_time_clock_getres_TAI              200 ns        199 ns    3512412
BM_time_clock_getres_unsupported      196 ns        196 ns    3575609

x86_64 (glibc):

---------------------------------------------------------------------
Benchmark                              Time           CPU Iterations
---------------------------------------------------------------------
BM_time_clock_getres                 252 ns        252 ns    2370263
BM_time_clock_getres_syscall         215 ns        215 ns    3287497
BM_time_clock_getres_REALTIME        214 ns        214 ns    3294228
BM_time_clock_getres_BOOTTIME        213 ns        213 ns    3277519
BM_time_clock_getres_TAI             213 ns        213 ns    3294991
BM_time_clock_getres_unsupported     206 ns        206 ns    3450654

imx7d_pico IOT nyc (w/arm,cpu-registers-not-fw-configured) (armv7a):
(Virtual Timers)

Benchmark                           Time(ns)    CPU(ns) Iterations
------------------------------------------------------------------
BM_time_clock_getres                      16        345    2000000
BM_time_clock_getres_syscall              16        339    2121212
BM_time_clock_getres_REALTIME             17        350    2058824
BM_time_clock_getres_BOOTTIME             17        345    2000000
BM_time_clock_getres_TAI                  16        350    2000000
BM_time_clock_getres_unsupported          13        284    2500000

AFTER:

hikey960 vdso (aarch64):

---------------------------------------------------------------------
Benchmark                              Time           CPU Iterations
---------------------------------------------------------------------
BM_time_clock_getres                  18 ns         18 ns   37880389
BM_time_clock_getres_syscall         127 ns        127 ns    5520029
BM_time_clock_getres_REALTIME         18 ns         18 ns   37879962
BM_time_clock_getres_BOOTTIME         19 ns         18 ns   37878361
BM_time_clock_getres_TAI             131 ns        131 ns    5368484
BM_time_clock_getres_unsupported      97 ns         97 ns    7182864

hikey960 vdso32 (aarch32):

---------------------------------------------------------------------
Benchmark                              Time           CPU Iterations
---------------------------------------------------------------------
BM_time_clock_getres                  36 ns         36 ns   19205240
BM_time_clock_getres_syscall         212 ns        212 ns    3297100
BM_time_clock_getres_REALTIME         36 ns         36 ns   19219109
BM_time_clock_getres_BOOTTIME         36 ns         36 ns   19222490
BM_time_clock_getres_TAI             206 ns        206 ns    3402868
BM_time_clock_getres_unsupported     159 ns        159 ns    4409492

imx7d_pico IOT nyc (wo/arm,cpu-registers-not-fw-configured) (armv7a):
(Physical Timers)

Benchmark                           Time(ns)    CPU(ns) Iterations
------------------------------------------------------------------
BM_time_clock_getres                       2         48   14000000
BM_time_clock_getres_syscall              14        335    2058824
BM_time_clock_getres_REALTIME              2         49   14583333
BM_time_clock_getres_BOOTTIME              2         48   14000000
BM_time_clock_getres_TAI                  14        350    2058824
BM_time_clock_getres_unsupported           8        203    3500000

Test: taskset F \
        /data/benchmarktest{64}/bionic-benchmarks/bionic-benchmarks \
        --bionic_xml=vdso.xml --benchmark_filter=BM_time_clock_getres*
Bug: 63737556
Change-Id: I80c0a5106625d76720287f715fcf145d2aad1705
2017-12-07 09:41:48 -08:00
..
CFIShadow.h Revert "Revert "arm64: expand CFI shadow to cover 48-bit virtual addresses"" 2017-08-03 14:11:28 -07:00
CachedProperty.h Update CachedProperty to support long ro. properties 2017-10-18 10:25:39 -07:00
ErrnoRestorer.h
FdPath.h Add POSIX fexecve. 2017-10-18 16:26:17 -07:00
KernelArgumentBlock.h
NetdClientDispatch.h
ScopedPthreadMutexLocker.h
ScopedReaddir.h
ScopedSignalBlocker.h Implement <spawn.h>. 2017-10-11 14:57:49 -07:00
WriteProtected.h Move libc_log code into libasync_safe. 2017-05-03 08:50:43 -07:00
__get_tls.h
bionic_arc4random.h Add __libc_arc4random_unlimited_entropy. 2016-11-29 15:26:08 -08:00
bionic_asm.h Mark __BIONIC_WEAK_FOR_NATIVE_BRIDGE symbols 2017-10-27 10:01:46 +02:00
bionic_asm_arm.h Unified sysroot: kill arch-specific include dirs. 2017-10-12 13:19:51 -07:00
bionic_asm_arm64.h Unified sysroot: kill arch-specific include dirs. 2017-10-12 13:19:51 -07:00
bionic_asm_mips.h Unified sysroot: kill arch-specific include dirs. 2017-10-12 13:19:51 -07:00
bionic_asm_x86.h Unified sysroot: kill arch-specific include dirs. 2017-10-12 13:19:51 -07:00
bionic_asm_x86_64.h Unified sysroot: kill arch-specific include dirs. 2017-10-12 13:19:51 -07:00
bionic_auxv.h
bionic_config.h
bionic_constants.h
bionic_defs.h Mark __BIONIC_WEAK_FOR_NATIVE_BRIDGE symbols 2017-10-27 10:01:46 +02:00
bionic_errdefs.h
bionic_fortify.h Add null checks to <dirent.h> functions. 2017-10-26 16:16:33 -07:00
bionic_futex.h Always use CLOCK_MONOTONIC for pthreads and semaphores 2017-08-18 09:11:05 -07:00
bionic_globals.h Only initialize the global stack protector once. 2016-06-30 12:58:32 -07:00
bionic_ieee.h Fix instances of '#if __LP64__'. 2016-09-15 14:21:28 -07:00
bionic_lock.h Always use CLOCK_MONOTONIC for pthreads and semaphores 2017-08-18 09:11:05 -07:00
bionic_macros.h Only use uids and gids for which we've allocated AIDs 2017-11-15 10:31:49 -08:00
bionic_malloc_dispatch.h Add support for modifying decay timer. 2017-05-15 16:59:16 -07:00
bionic_mbstate.h Hide various mbstate implementation details. 2017-07-14 17:00:05 -07:00
bionic_page.h
bionic_prctl.h
bionic_sdk_version.h
bionic_sigdefs.h
bionic_ssp.h
bionic_string_utils.h
bionic_systrace.h Add end() method to bionic's ScopedTrace class 2017-03-20 12:45:55 -07:00
bionic_time_conversions.h Always use CLOCK_MONOTONIC for pthreads and semaphores 2017-08-18 09:11:05 -07:00
bionic_tls.h Add a legacy inline for mmap64. 2017-10-05 23:41:47 -07:00
bionic_vdso.h bionic: add vdso clock_getres 2017-12-07 09:41:48 -08:00
get_cpu_count_from_string.h
grp_pwd.h Allocate thread local buffers in __init_tls. 2017-02-22 16:05:03 -08:00
icu.h Implement <iconv.h>. 2017-08-25 08:47:41 -07:00
kernel_sigset_t.h
thread_private.h Defer registration of the arc4random fork-detect handler. 2016-06-28 15:52:59 -07:00