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.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/benchmarks/unistd_benchmark.cpp b/benchmarks/unistd_benchmark.cpp
index f2c9d73..c35e7c3 100644
--- a/benchmarks/unistd_benchmark.cpp
+++ b/benchmarks/unistd_benchmark.cpp
@@ -30,11 +30,14 @@ static void BM_unistd_getpid(int iters) {
}
BENCHMARK(BM_unistd_getpid);
+// Stop GCC optimizing out our pure function.
+/* Must not be static! */ pid_t (*gettid_fp)() = gettid;
+
static void BM_unistd_gettid(int iters) {
StartBenchmarkTiming();
for (int i = 0; i < iters; ++i) {
- gettid();
+ gettid_fp();
}
StopBenchmarkTiming();