cxx03_test.cc
Go to the documentation of this file.
1 #undef NDEBUG
2 #include <cassert>
3 #include <cstddef>
4 
5 #include "benchmark/benchmark.h"
6 
7 #if __cplusplus >= 201103L
8 #error C++11 or greater detected. Should be C++03.
9 #endif
10 
11 void BM_empty(benchmark::State& state) {
12  while (state.KeepRunning()) {
13  volatile std::size_t x = state.iterations();
14  ((void)x);
15  }
16 }
18 
19 // The new C++11 interface for args/ranges requires initializer list support.
20 // Therefore we provide the old interface to support C++03.
22  assert((state.range(0) == 1 && state.range(1) == 2) ||
23  (state.range(0) == 5 && state.range(1) == 6));
24  while (state.KeepRunning()) {
25  }
26 }
27 BENCHMARK(BM_old_arg_range_interface)->ArgPair(1, 2)->RangePair(5, 5, 6, 6);
28 
29 template <class T, class U>
31  BM_empty(state);
32 }
34 
35 template <class T>
37  BM_empty(state);
38 }
41 
43  BM_empty(state);
44  state.counters["Foo"] = 2;
45 }
47 
BENCHMARK_TEMPLATE2
BENCHMARK_TEMPLATE2(BM_template2, int, long)
BENCHMARK
BENCHMARK(BM_empty)
BM_empty
void BM_empty(benchmark::State &state)
Definition: cxx03_test.cc:11
BM_counters
void BM_counters(benchmark::State &state)
Definition: cxx03_test.cc:42
BENCHMARK_TEMPLATE
BENCHMARK_TEMPLATE(BM_template1, long)
benchmark::State::counters
UserCounters counters
Definition: benchmark.h:553
x
GLint GLenum GLint x
Definition: glcorearb.h:2834
BM_template2
void BM_template2(benchmark::State &state)
Definition: cxx03_test.cc:30
BENCHMARK_MAIN
#define BENCHMARK_MAIN()
Definition: benchmark.h:988
benchmark::State::iterations
BENCHMARK_ALWAYS_INLINE size_t iterations() const
Definition: benchmark.h:535
benchmark::State::KeepRunning
bool KeepRunning()
Definition: benchmark.h:404
void
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
BM_template1
void BM_template1(benchmark::State &state)
Definition: cxx03_test.cc:36
benchmark::State::range
BENCHMARK_ALWAYS_INLINE int range(std::size_t pos=0) const
Definition: benchmark.h:523
benchmark::State
Definition: benchmark.h:399
BM_old_arg_range_interface
void BM_old_arg_range_interface(benchmark::State &state)
Definition: cxx03_test.cc:21
BENCHMARK_TEMPLATE1
BENCHMARK_TEMPLATE1(BM_template1, int)
benchmark.h


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:49