diff options
author | Mark Salyzyn <salyzyn@google.com> | 2017-11-07 13:48:46 -0800 |
---|---|---|
committer | Mark Salyzyn <salyzyn@google.com> | 2017-12-07 09:41:31 -0800 |
commit | 6f9c35ded294ca7b0b8f9042f705cbfca1ec8518 (patch) | |
tree | 0e6baac52e0ddd5b8d6fe250285db3484728efe0 /benchmarks | |
parent | 6ffa10f4830f7831453b1051e7b86358a728240f (diff) | |
download | android_bionic-6f9c35ded294ca7b0b8f9042f705cbfca1ec8518.tar.gz android_bionic-6f9c35ded294ca7b0b8f9042f705cbfca1ec8518.tar.bz2 android_bionic-6f9c35ded294ca7b0b8f9042f705cbfca1ec8518.zip |
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
Diffstat (limited to 'benchmarks')
-rw-r--r-- | benchmarks/suites/vdso.xml | 21 | ||||
-rw-r--r-- | benchmarks/tests/interface_test.cpp | 7 | ||||
-rw-r--r-- | benchmarks/time_benchmark.cpp | 63 |
3 files changed, 91 insertions, 0 deletions
diff --git a/benchmarks/suites/vdso.xml b/benchmarks/suites/vdso.xml index 86409bb1e..1f5958cf6 100644 --- a/benchmarks/suites/vdso.xml +++ b/benchmarks/suites/vdso.xml @@ -1,4 +1,25 @@ <fn> + <name>BM_time_clock_getres</name> +</fn> +<fn> + <name>BM_time_clock_getres_BOOTTIME</name> +</fn> +<fn> + <name>BM_time_clock_getres_MONOTONIC_COARSE</name> +</fn> +<fn> + <name>BM_time_clock_getres_MONOTONIC_RAW</name> +</fn> +<fn> + <name>BM_time_clock_getres_REALTIME</name> +</fn> +<fn> + <name>BM_time_clock_getres_REALTIME_COARSE</name> +</fn> +<fn> + <name>BM_time_clock_getres_syscall</name> +</fn> +<fn> <name>BM_time_clock_gettime</name> </fn> <fn> diff --git a/benchmarks/tests/interface_test.cpp b/benchmarks/tests/interface_test.cpp index 677ba311e..3020c270e 100644 --- a/benchmarks/tests/interface_test.cpp +++ b/benchmarks/tests/interface_test.cpp @@ -435,6 +435,13 @@ TEST_F(SystemTests, all_benchmarks) { "BM_string_strstr/32768/0/0/iterations:1\n" "BM_string_strstr/65536/0/0/iterations:1\n" "BM_string_strstr/131072/0/0/iterations:1\n" + "BM_time_clock_getres/iterations:1\n" + "BM_time_clock_getres_BOOTTIME/iterations:1\n" + "BM_time_clock_getres_MONOTONIC_COARSE/iterations:1\n" + "BM_time_clock_getres_MONOTONIC_RAW/iterations:1\n" + "BM_time_clock_getres_REALTIME/iterations:1\n" + "BM_time_clock_getres_REALTIME_COARSE/iterations:1\n" + "BM_time_clock_getres_syscall/iterations:1\n" "BM_time_clock_gettime/iterations:1\n" "BM_time_clock_gettime_BOOTTIME/iterations:1\n" "BM_time_clock_gettime_MONOTONIC_COARSE/iterations:1\n" diff --git a/benchmarks/time_benchmark.cpp b/benchmarks/time_benchmark.cpp index f44c2802f..437dc7812 100644 --- a/benchmarks/time_benchmark.cpp +++ b/benchmarks/time_benchmark.cpp @@ -85,6 +85,69 @@ static void BM_time_clock_gettime_BOOTTIME(benchmark::State& state) { } BIONIC_BENCHMARK(BM_time_clock_gettime_BOOTTIME); +static void BM_time_clock_getres(benchmark::State& state) { + // CLOCK_MONOTONIC is required supported in vdso + timespec t; + while (state.KeepRunning()) { + clock_getres(CLOCK_MONOTONIC, &t); + } +} +BIONIC_BENCHMARK(BM_time_clock_getres); + +static void BM_time_clock_getres_syscall(benchmark::State& state) { + // CLOCK_MONOTONIC is required supported in vdso + timespec t; + while (state.KeepRunning()) { + syscall(__NR_clock_getres, CLOCK_MONOTONIC, &t); + } +} +BIONIC_BENCHMARK(BM_time_clock_getres_syscall); + +static void BM_time_clock_getres_MONOTONIC_COARSE(benchmark::State& state) { + // CLOCK_MONOTONIC_COARSE is required supported in vdso + timespec t; + while (state.KeepRunning()) { + clock_getres(CLOCK_MONOTONIC_COARSE, &t); + } +} +BIONIC_BENCHMARK(BM_time_clock_getres_MONOTONIC_COARSE); + +static void BM_time_clock_getres_MONOTONIC_RAW(benchmark::State& state) { + // CLOCK_MONOTONIC_RAW is required supported in vdso + timespec t; + while (state.KeepRunning()) { + clock_getres(CLOCK_MONOTONIC_RAW, &t); + } +} +BIONIC_BENCHMARK(BM_time_clock_getres_MONOTONIC_RAW); + +static void BM_time_clock_getres_REALTIME(benchmark::State& state) { + // CLOCK_REALTIME is required supported in vdso + timespec t; + while (state.KeepRunning()) { + clock_getres(CLOCK_REALTIME, &t); + } +} +BIONIC_BENCHMARK(BM_time_clock_getres_REALTIME); + +static void BM_time_clock_getres_REALTIME_COARSE(benchmark::State& state) { + // CLOCK_REALTIME_COARSE is required supported in vdso + timespec t; + while (state.KeepRunning()) { + clock_getres(CLOCK_REALTIME_COARSE, &t); + } +} +BIONIC_BENCHMARK(BM_time_clock_getres_REALTIME_COARSE); + +static void BM_time_clock_getres_BOOTTIME(benchmark::State& state) { + // CLOCK_BOOTTIME is optionally supported in vdso + timespec t; + while (state.KeepRunning()) { + clock_getres(CLOCK_BOOTTIME, &t); + } +} +BIONIC_BENCHMARK(BM_time_clock_getres_BOOTTIME); + static void BM_time_gettimeofday(benchmark::State& state) { timeval tv; while (state.KeepRunning()) { |