summaryrefslogtreecommitdiffstats
path: root/benchmarks
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-06-11 03:17:19 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-06-10 22:08:45 +0000
commit0ada9388e74693d990bdbb4af92c33bae8b34d4b (patch)
tree09036a8bc36d89835a1d830559ddcd926246f20b /benchmarks
parent80664231b8a17fc6a1bf2f4881c9353a47b74ab6 (diff)
parent7634db5a0657129225869c3650a992f9cbe82fe4 (diff)
downloadbionic-0ada9388e74693d990bdbb4af92c33bae8b34d4b.zip
bionic-0ada9388e74693d990bdbb4af92c33bae8b34d4b.tar.gz
bionic-0ada9388e74693d990bdbb4af92c33bae8b34d4b.tar.bz2
Merge "Add a couple more system call benchmarks."
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/time_benchmark.cpp13
-rw-r--r--benchmarks/unistd_benchmark.cpp12
2 files changed, 25 insertions, 0 deletions
diff --git a/benchmarks/time_benchmark.cpp b/benchmarks/time_benchmark.cpp
index 75132e5..3bf8c07 100644
--- a/benchmarks/time_benchmark.cpp
+++ b/benchmarks/time_benchmark.cpp
@@ -35,4 +35,17 @@ static void BM_time_localtime_tz(int iters) {
StopBenchmarkTiming();
}
BENCHMARK(BM_time_localtime_tz);
+
#endif
+
+static void BM_time_clock_gettime(int iters) {
+ StartBenchmarkTiming();
+
+ struct timespec t;
+ for (int i = 0; i < iters; ++i) {
+ clock_gettime(CLOCK_MONOTONIC, &t);
+ }
+
+ StopBenchmarkTiming();
+}
+BENCHMARK(BM_time_clock_gettime);
diff --git a/benchmarks/unistd_benchmark.cpp b/benchmarks/unistd_benchmark.cpp
index 12b788a..f2c9d73 100644
--- a/benchmarks/unistd_benchmark.cpp
+++ b/benchmarks/unistd_benchmark.cpp
@@ -16,6 +16,7 @@
#include "benchmark.h"
+#include <sys/syscall.h>
#include <unistd.h>
static void BM_unistd_getpid(int iters) {
@@ -39,3 +40,14 @@ static void BM_unistd_gettid(int iters) {
StopBenchmarkTiming();
}
BENCHMARK(BM_unistd_gettid);
+
+static void BM_unistd_gettid_syscall(int iters) {
+ StartBenchmarkTiming();
+
+ for (int i = 0; i < iters; ++i) {
+ syscall(__NR_gettid);
+ }
+
+ StopBenchmarkTiming();
+}
+BENCHMARK(BM_unistd_gettid_syscall);