perf_counters_test.cc
Go to the documentation of this file.
1 #undef NDEBUG
2 
3 #include "../src/perf_counters.h"
4 
5 #include "benchmark/benchmark.h"
6 #include "output_test.h"
7 
9  for (auto _ : state) {
10  benchmark::DoNotOptimize(state.iterations());
11  }
12 }
14 ADD_CASES(TC_JSONOut, {{"\"name\": \"BM_Simple\",$"}});
15 
16 static void CheckSimple(Results const& e) {
17  CHECK_COUNTER_VALUE(e, double, "CYCLES", GT, 0);
18  CHECK_COUNTER_VALUE(e, double, "BRANCHES", GT, 0.0);
19 }
21 
22 int main(int argc, char* argv[]) {
24  return 0;
25  }
26  RunOutputTests(argc, argv);
27 }
BM_Simple
static void BM_Simple(benchmark::State &state)
Definition: perf_counters_test.cc:8
benchmark::DoNotOptimize
BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const &value)
Definition: benchmark/include/benchmark/benchmark.h:375
TC_JSONOut
@ TC_JSONOut
Definition: benchmark/test/output_test.h:43
output_test.h
benchmark::internal::PerfCounters::kSupported
static const bool kSupported
Definition: perf_counters.h:72
Results
Definition: benchmark/test/output_test.h:92
gmock_output_test._
_
Definition: bloaty/third_party/googletest/googlemock/test/gmock_output_test.py:175
CHECK_BENCHMARK_RESULTS
CHECK_BENCHMARK_RESULTS("BM_Simple", &CheckSimple)
BENCHMARK
BENCHMARK(BM_Simple)
main
int main(int argc, char *argv[])
Definition: perf_counters_test.cc:22
RunOutputTests
void RunOutputTests(int argc, char *argv[])
Definition: benchmark/test/output_test_helper.cc:391
benchmark::State
Definition: benchmark/include/benchmark/benchmark.h:503
state
Definition: bloaty/third_party/zlib/contrib/blast/blast.c:41
CHECK_COUNTER_VALUE
#define CHECK_COUNTER_VALUE(entry, var_type, var_name, relationship, value)
Definition: benchmark/test/output_test.h:192
CheckSimple
static void CheckSimple(Results const &e)
Definition: perf_counters_test.cc:16
ADD_CASES
ADD_CASES(TC_JSONOut, {{"\"name\": \"BM_Simple\",$"}})


grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:42