aboutsummaryrefslogtreecommitdiffstats
path: root/benchmarks
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2017-11-07 13:47:48 -0800
committerMark Salyzyn <salyzyn@google.com>2017-12-07 09:41:13 -0800
commit6ffa10f4830f7831453b1051e7b86358a728240f (patch)
tree231cce187b4d866b5192f7bd9e5d5b9f04695ea4 /benchmarks
parent78b40e8fe1f37de319344c92d8e6e1eb595c1067 (diff)
downloadandroid_bionic-6ffa10f4830f7831453b1051e7b86358a728240f.tar.gz
android_bionic-6ffa10f4830f7831453b1051e7b86358a728240f.tar.bz2
android_bionic-6ffa10f4830f7831453b1051e7b86358a728240f.zip
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
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/suites/vdso.xml30
-rw-r--r--benchmarks/tests/interface_test.cpp5
-rw-r--r--benchmarks/time_benchmark.cpp47
3 files changed, 82 insertions, 0 deletions
diff --git a/benchmarks/suites/vdso.xml b/benchmarks/suites/vdso.xml
new file mode 100644
index 000000000..86409bb1e
--- /dev/null
+++ b/benchmarks/suites/vdso.xml
@@ -0,0 +1,30 @@
+<fn>
+ <name>BM_time_clock_gettime</name>
+</fn>
+<fn>
+ <name>BM_time_clock_gettime_BOOTTIME</name>
+</fn>
+<fn>
+ <name>BM_time_clock_gettime_MONOTONIC_COARSE</name>
+</fn>
+<fn>
+ <name>BM_time_clock_gettime_MONOTONIC_RAW</name>
+</fn>
+<fn>
+ <name>BM_time_clock_gettime_REALTIME</name>
+</fn>
+<fn>
+ <name>BM_time_clock_gettime_REALTIME_COARSE</name>
+</fn>
+<fn>
+ <name>BM_time_clock_gettime_syscall</name>
+</fn>
+<fn>
+ <name>BM_time_gettimeofday</name>
+</fn>
+<fn>
+ <name>BM_time_gettimeofday_syscall</name>
+</fn>
+<fn>
+ <name>BM_time_time</name>
+</fn>
diff --git a/benchmarks/tests/interface_test.cpp b/benchmarks/tests/interface_test.cpp
index 33e506e99..677ba311e 100644
--- a/benchmarks/tests/interface_test.cpp
+++ b/benchmarks/tests/interface_test.cpp
@@ -436,6 +436,11 @@ TEST_F(SystemTests, all_benchmarks) {
"BM_string_strstr/65536/0/0/iterations:1\n"
"BM_string_strstr/131072/0/0/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"
+ "BM_time_clock_gettime_MONOTONIC_RAW/iterations:1\n"
+ "BM_time_clock_gettime_REALTIME/iterations:1\n"
+ "BM_time_clock_gettime_REALTIME_COARSE/iterations:1\n"
"BM_time_clock_gettime_syscall/iterations:1\n"
"BM_time_gettimeofday/iterations:1\n"
"BM_time_gettimeofday_syscall/iterations:1\n"
diff --git a/benchmarks/time_benchmark.cpp b/benchmarks/time_benchmark.cpp
index 4c6d5ddf2..f44c2802f 100644
--- a/benchmarks/time_benchmark.cpp
+++ b/benchmarks/time_benchmark.cpp
@@ -23,6 +23,7 @@
#include "util.h"
static void BM_time_clock_gettime(benchmark::State& state) {
+ // CLOCK_MONOTONIC is required supported in vdso
timespec t;
while (state.KeepRunning()) {
clock_gettime(CLOCK_MONOTONIC, &t);
@@ -31,6 +32,7 @@ static void BM_time_clock_gettime(benchmark::State& state) {
BIONIC_BENCHMARK(BM_time_clock_gettime);
static void BM_time_clock_gettime_syscall(benchmark::State& state) {
+ // CLOCK_MONOTONIC is required supported in vdso
timespec t;
while (state.KeepRunning()) {
syscall(__NR_clock_gettime, CLOCK_MONOTONIC, &t);
@@ -38,6 +40,51 @@ static void BM_time_clock_gettime_syscall(benchmark::State& state) {
}
BIONIC_BENCHMARK(BM_time_clock_gettime_syscall);
+static void BM_time_clock_gettime_MONOTONIC_COARSE(benchmark::State& state) {
+ // CLOCK_MONOTONIC_COARSE is required supported in vdso
+ timespec t;
+ while (state.KeepRunning()) {
+ clock_gettime(CLOCK_MONOTONIC_COARSE, &t);
+ }
+}
+BIONIC_BENCHMARK(BM_time_clock_gettime_MONOTONIC_COARSE);
+
+static void BM_time_clock_gettime_MONOTONIC_RAW(benchmark::State& state) {
+ // CLOCK_MONOTONIC_RAW is required supported in vdso
+ timespec t;
+ while (state.KeepRunning()) {
+ clock_gettime(CLOCK_MONOTONIC_RAW, &t);
+ }
+}
+BIONIC_BENCHMARK(BM_time_clock_gettime_MONOTONIC_RAW);
+
+static void BM_time_clock_gettime_REALTIME(benchmark::State& state) {
+ // CLOCK_REALTIME is required supported in vdso
+ timespec t;
+ while (state.KeepRunning()) {
+ clock_gettime(CLOCK_REALTIME, &t);
+ }
+}
+BIONIC_BENCHMARK(BM_time_clock_gettime_REALTIME);
+
+static void BM_time_clock_gettime_REALTIME_COARSE(benchmark::State& state) {
+ // CLOCK_REALTIME_COARSE is required supported in vdso
+ timespec t;
+ while (state.KeepRunning()) {
+ clock_gettime(CLOCK_REALTIME_COARSE, &t);
+ }
+}
+BIONIC_BENCHMARK(BM_time_clock_gettime_REALTIME_COARSE);
+
+static void BM_time_clock_gettime_BOOTTIME(benchmark::State& state) {
+ // CLOCK_BOOTTIME is optionally supported in vdso
+ timespec t;
+ while (state.KeepRunning()) {
+ clock_gettime(CLOCK_BOOTTIME, &t);
+ }
+}
+BIONIC_BENCHMARK(BM_time_clock_gettime_BOOTTIME);
+
static void BM_time_gettimeofday(benchmark::State& state) {
timeval tv;
while (state.KeepRunning()) {