protobuf/third_party/benchmark/test/basic_test.cc
Go to the documentation of this file.
1 
2 #include "benchmark/benchmark.h"
3 
4 #define BASIC_BENCHMARK_TEST(x) BENCHMARK(x)->Arg(8)->Arg(512)->Arg(8192)
5 
7  while (state.KeepRunning()) {
8  benchmark::DoNotOptimize(state.iterations());
9  }
10 }
12 BENCHMARK(BM_empty)->ThreadPerCpu();
13 
15  while (state.KeepRunning()) {
16  for (int x = 0; x < state.range(0); ++x) {
18  }
19  }
20 }
22 BASIC_BENCHMARK_TEST(BM_spin_empty)->ThreadPerCpu();
23 
25  for (int i = 0; i < state.range(0); ++i) {
27  }
28  while (state.KeepRunning()) {
29  for (int i = 0; i < state.range(0); ++i) {
31  }
32  }
33 }
36 
38  while (state.KeepRunning()) {
39  state.PauseTiming();
40  for (int i = 0; i < state.range(0); ++i) {
42  }
43  state.ResumeTiming();
44  for (int i = 0; i < state.range(0); ++i) {
46  }
47  }
48 }
51 
53  while (state.KeepRunning()) {
54  state.PauseTiming();
55  state.ResumeTiming();
56  }
57 }
59 BENCHMARK(BM_pause_during)->ThreadPerCpu();
60 BENCHMARK(BM_pause_during)->UseRealTime();
61 BENCHMARK(BM_pause_during)->UseRealTime()->ThreadPerCpu();
62 
64  while (state.KeepRunning()) {
65  for (int i = 0; i < state.range(0); ++i) {
67  }
68  }
69  for (int i = 0; i < state.range(0); ++i) {
71  }
72 }
75 
77  for (int i = 0; i < state.range(0); ++i) {
79  }
80  while (state.KeepRunning()) {
81  for (int i = 0; i < state.range(0); ++i) {
83  }
84  }
85  for (int i = 0; i < state.range(0); ++i) {
87  }
88 }
91 
93  while (state.KeepRunning()) {
94  }
95 }
97 BENCHMARK(BM_empty_stop_start)->ThreadPerCpu();
98 
BM_pause_during
void BM_pause_during(benchmark::State &state)
Definition: protobuf/third_party/benchmark/test/basic_test.cc:52
BENCHMARK
BENCHMARK(BM_empty)
benchmark::DoNotOptimize
BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const &value)
Definition: benchmark/include/benchmark/benchmark.h:375
BASIC_BENCHMARK_TEST
#define BASIC_BENCHMARK_TEST(x)
Definition: protobuf/third_party/benchmark/test/basic_test.cc:4
BM_spin_pause_before
void BM_spin_pause_before(benchmark::State &state)
Definition: protobuf/third_party/benchmark/test/basic_test.cc:24
BM_spin_empty
void BM_spin_empty(benchmark::State &state)
Definition: protobuf/third_party/benchmark/test/basic_test.cc:14
BM_spin_pause_before_and_after
void BM_spin_pause_before_and_after(benchmark::State &state)
Definition: protobuf/third_party/benchmark/test/basic_test.cc:76
x
int x
Definition: bloaty/third_party/googletest/googlemock/test/gmock-matchers_test.cc:3610
BM_spin_pause_during
void BM_spin_pause_during(benchmark::State &state)
Definition: protobuf/third_party/benchmark/test/basic_test.cc:37
benchmark::State
Definition: benchmark/include/benchmark/benchmark.h:503
BENCHMARK_MAIN
#define BENCHMARK_MAIN()
Definition: benchmark/include/benchmark/benchmark.h:1338
state
Definition: bloaty/third_party/zlib/contrib/blast/blast.c:41
BM_empty
void BM_empty(benchmark::State &state)
Definition: protobuf/third_party/benchmark/test/basic_test.cc:6
BM_spin_pause_after
void BM_spin_pause_after(benchmark::State &state)
Definition: protobuf/third_party/benchmark/test/basic_test.cc:63
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
BM_empty_stop_start
void BM_empty_stop_start(benchmark::State &state)
Definition: protobuf/third_party/benchmark/test/basic_test.cc:92


grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:45