summaryrefslogtreecommitdiffstats
path: root/benchmarks/unistd_benchmark.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'benchmarks/unistd_benchmark.cpp')
-rw-r--r--benchmarks/unistd_benchmark.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/benchmarks/unistd_benchmark.cpp b/benchmarks/unistd_benchmark.cpp
index c35e7c3..7e2ac30 100644
--- a/benchmarks/unistd_benchmark.cpp
+++ b/benchmarks/unistd_benchmark.cpp
@@ -30,6 +30,17 @@ static void BM_unistd_getpid(int iters) {
}
BENCHMARK(BM_unistd_getpid);
+static void BM_unistd_getpid_syscall(int iters) {
+ StartBenchmarkTiming();
+
+ for (int i = 0; i < iters; ++i) {
+ syscall(__NR_getpid);
+ }
+
+ StopBenchmarkTiming();
+}
+BENCHMARK(BM_unistd_getpid_syscall);
+
// Stop GCC optimizing out our pure function.
/* Must not be static! */ pid_t (*gettid_fp)() = gettid;