summaryrefslogtreecommitdiffstats
path: root/liblog
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2015-04-23 15:08:11 -0700
committerMark Salyzyn <salyzyn@google.com>2015-04-24 07:59:44 -0700
commit1ac79cbd89938649e5bc963d74b417e8a8ed53d7 (patch)
tree29a09c3ef5d65ddddf57acc90fab454ba53103ef /liblog
parent659b7d633a03a03674f82f02f567ac5ff18fba41 (diff)
downloadsystem_core-1ac79cbd89938649e5bc963d74b417e8a8ed53d7.zip
system_core-1ac79cbd89938649e5bc963d74b417e8a8ed53d7.tar.gz
system_core-1ac79cbd89938649e5bc963d74b417e8a8ed53d7.tar.bz2
liblog: Add BM_is_loggable benchmark
- On a N9 64-bit benchmark, the __android_log_is_loggable overhead is roughly 500ns (1/2 of a syscall?) Bug: 19544788 Bug: 17760225 Bug: 20416721 Change-Id: Ib9e4d06d96e1b19ca5d459e569ead451ef47a9c0
Diffstat (limited to 'liblog')
-rw-r--r--liblog/tests/liblog_benchmark.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/liblog/tests/liblog_benchmark.cpp b/liblog/tests/liblog_benchmark.cpp
index 979aded..b594634 100644
--- a/liblog/tests/liblog_benchmark.cpp
+++ b/liblog/tests/liblog_benchmark.cpp
@@ -266,3 +266,17 @@ static void BM_log_delay(int iters) {
android_logger_list_free(logger_list);
}
BENCHMARK(BM_log_delay);
+
+/*
+ * Measure the time it takes for __android_log_is_loggable.
+ */
+static void BM_is_loggable(int iters) {
+ StartBenchmarkTiming();
+
+ for (int i = 0; i < iters; ++i) {
+ __android_log_is_loggable(ANDROID_LOG_WARN, "logd", ANDROID_LOG_VERBOSE);
+ }
+
+ StopBenchmarkTiming();
+}
+BENCHMARK(BM_is_loggable);