summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2b8246f)
raw | patch | inline | side by side (parent: 2b8246f)
author | Elliott Hughes <enh@google.com> | |
Tue, 10 Jun 2014 01:35:21 +0000 (18:35 -0700) | ||
committer | Elliott Hughes <enh@google.com> | |
Tue, 10 Jun 2014 01:35:21 +0000 (18:35 -0700) |
benchmarks/time_benchmark.cpp | patch | blob | history | |
benchmarks/unistd_benchmark.cpp | patch | blob | history |
index 75132e50e595d3baa0afd0ab72076dfbbdb9a230..3bf8c07f6ce3b54ba9225446f7bb757cc39f450f 100644 (file)
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);
index 12b788acd25dc28ed263824095a8dcad452ce751..f2c9d73cfa6de4aefaca4d79d4c3d400529c5a54 100644 (file)
#include "benchmark.h"
+#include <sys/syscall.h>
#include <unistd.h>
static void BM_unistd_getpid(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);