1 #include "benchmark/benchmark_api.h" 2 BM_basic(benchmark::State & state)3void BM_basic(benchmark::State& state) { 4 while (state.KeepRunning()) { 5 } 6 } 7 BENCHMARK(BM_basic); 8 BENCHMARK(BM_basic)->Arg(42); 9 BENCHMARK(BM_basic)->Range(1, 8); 10 BENCHMARK(BM_basic)->DenseRange(10, 15); 11 BENCHMARK(BM_basic)->ArgPair(42, 42); 12 BENCHMARK(BM_basic)->RangePair(64, 512, 64, 512); 13 BENCHMARK(BM_basic)->MinTime(0.7); 14 BENCHMARK(BM_basic)->UseRealTime(); 15 BENCHMARK(BM_basic)->ThreadRange(2, 4); 16 BENCHMARK(BM_basic)->ThreadPerCpu(); 17 CustomArgs(benchmark::internal::Benchmark * b)18void CustomArgs(benchmark::internal::Benchmark* b) { 19 for (int i = 0; i < 10; ++i) { 20 b->Arg(i); 21 } 22 } 23 24 BENCHMARK(BM_basic)->Apply(CustomArgs); 25 26 BENCHMARK_MAIN() 27