1 #undef NDEBUG
2
3 #include "../src/perf_counters.h"
4
5 #include "benchmark/benchmark.h"
6 #include "output_test.h"
7
BM_Simple(benchmark::State & state)8 static void BM_Simple(benchmark::State& state) {
9 for (auto _ : state) {
10 benchmark::DoNotOptimize(state.iterations());
11 }
12 }
13 BENCHMARK(BM_Simple);
14 ADD_CASES(TC_JSONOut, {{"\"name\": \"BM_Simple\",$"}});
15
CheckSimple(Results const & e)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 }
20 CHECK_BENCHMARK_RESULTS("BM_Simple", &CheckSimple);
21
main(int argc,char * argv[])22 int main(int argc, char* argv[]) {
23 if (!benchmark::internal::PerfCounters::kSupported) {
24 return 0;
25 }
26 RunOutputTests(argc, argv);
27 }
28