diff options
Diffstat (limited to 'benchmarks/unistd_benchmark.cpp')
-rw-r--r-- | benchmarks/unistd_benchmark.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/benchmarks/unistd_benchmark.cpp b/benchmarks/unistd_benchmark.cpp index 7e2ac30..09ca0e6 100644 --- a/benchmarks/unistd_benchmark.cpp +++ b/benchmarks/unistd_benchmark.cpp @@ -14,12 +14,13 @@ * limitations under the License. */ -#include "benchmark.h" - #include <sys/syscall.h> #include <unistd.h> -static void BM_unistd_getpid(int iters) { +#include <benchmark/Benchmark.h> + +BENCHMARK_NO_ARG(BM_unistd_getpid); +void BM_unistd_getpid::Run(int iters) { StartBenchmarkTiming(); for (int i = 0; i < iters; ++i) { @@ -28,9 +29,9 @@ static void BM_unistd_getpid(int iters) { StopBenchmarkTiming(); } -BENCHMARK(BM_unistd_getpid); -static void BM_unistd_getpid_syscall(int iters) { +BENCHMARK_NO_ARG(BM_unistd_getpid_syscall); +void BM_unistd_getpid_syscall::Run(int iters) { StartBenchmarkTiming(); for (int i = 0; i < iters; ++i) { @@ -39,12 +40,14 @@ static void BM_unistd_getpid_syscall(int iters) { StopBenchmarkTiming(); } -BENCHMARK(BM_unistd_getpid_syscall); + +#if defined(__BIONIC__) // Stop GCC optimizing out our pure function. /* Must not be static! */ pid_t (*gettid_fp)() = gettid; -static void BM_unistd_gettid(int iters) { +BENCHMARK_NO_ARG(BM_unistd_gettid); +void BM_unistd_gettid::Run(int iters) { StartBenchmarkTiming(); for (int i = 0; i < iters; ++i) { @@ -53,9 +56,11 @@ static void BM_unistd_gettid(int iters) { StopBenchmarkTiming(); } -BENCHMARK(BM_unistd_gettid); -static void BM_unistd_gettid_syscall(int iters) { +#endif + +BENCHMARK_NO_ARG(BM_unistd_gettid_syscall); +void BM_unistd_gettid_syscall::Run(int iters) { StartBenchmarkTiming(); for (int i = 0; i < iters; ++i) { @@ -64,4 +69,3 @@ static void BM_unistd_gettid_syscall(int iters) { StopBenchmarkTiming(); } -BENCHMARK(BM_unistd_gettid_syscall); |