diff options
author | Anders Lewis <agloo@google.com> | 2017-07-24 20:01:13 -0700 |
---|---|---|
committer | Anders Lewis <agloo@google.com> | 2017-08-07 13:16:09 -0700 |
commit | a7b0f8899790198cd9e72950f481679fe31e1a92 (patch) | |
tree | 4167c3afc82ffb281f43ef2332a60c675f121e43 /benchmarks/stdio_benchmark.cpp | |
parent | 0d6485eca47f0e860486795b2da97679948fd5d5 (diff) |
Implement interface for bionic benchmarks.
Test: Unit tests.
Change-Id: Ic61932f61ddd572e2f045b601f9da6e090cdc45d
Diffstat (limited to 'benchmarks/stdio_benchmark.cpp')
-rw-r--r-- | benchmarks/stdio_benchmark.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/benchmarks/stdio_benchmark.cpp b/benchmarks/stdio_benchmark.cpp index f49677956..756a698bb 100644 --- a/benchmarks/stdio_benchmark.cpp +++ b/benchmarks/stdio_benchmark.cpp @@ -19,12 +19,7 @@ #include <stdlib.h> #include <benchmark/benchmark.h> - -constexpr auto KB = 1024; - -#define AT_COMMON_SIZES \ - Arg(1)->Arg(2)->Arg(3)->Arg(4)->Arg(8)->Arg(16)->Arg(32)->Arg(64)->Arg(512)-> \ - Arg(1*KB)->Arg(4*KB)->Arg(8*KB)->Arg(16*KB)->Arg(64*KB) +#include "util.h" template <typename Fn> void ReadWriteTest(benchmark::State& state, Fn f, bool buffered) { @@ -50,22 +45,22 @@ void ReadWriteTest(benchmark::State& state, Fn f, bool buffered) { void BM_stdio_fread(benchmark::State& state) { ReadWriteTest(state, fread, true); } -BENCHMARK(BM_stdio_fread)->AT_COMMON_SIZES; +BIONIC_BENCHMARK(BM_stdio_fread); void BM_stdio_fwrite(benchmark::State& state) { ReadWriteTest(state, fwrite, true); } -BENCHMARK(BM_stdio_fwrite)->AT_COMMON_SIZES; +BIONIC_BENCHMARK(BM_stdio_fwrite); void BM_stdio_fread_unbuffered(benchmark::State& state) { ReadWriteTest(state, fread, false); } -BENCHMARK(BM_stdio_fread_unbuffered)->AT_COMMON_SIZES; +BIONIC_BENCHMARK(BM_stdio_fread_unbuffered); void BM_stdio_fwrite_unbuffered(benchmark::State& state) { ReadWriteTest(state, fwrite, false); } -BENCHMARK(BM_stdio_fwrite_unbuffered)->AT_COMMON_SIZES; +BIONIC_BENCHMARK(BM_stdio_fwrite_unbuffered); static void FopenFgetsFclose(benchmark::State& state, bool no_locking) { char buf[1024]; @@ -80,9 +75,9 @@ static void FopenFgetsFclose(benchmark::State& state, bool no_locking) { static void BM_stdio_fopen_fgets_fclose_locking(benchmark::State& state) { FopenFgetsFclose(state, false); } -BENCHMARK(BM_stdio_fopen_fgets_fclose_locking); +BIONIC_BENCHMARK(BM_stdio_fopen_fgets_fclose_locking); void BM_stdio_fopen_fgets_fclose_no_locking(benchmark::State& state) { FopenFgetsFclose(state, true); } -BENCHMARK(BM_stdio_fopen_fgets_fclose_no_locking); +BIONIC_BENCHMARK(BM_stdio_fopen_fgets_fclose_no_locking); |