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 auto iterations = state.iterations();
11 benchmark::DoNotOptimize(iterations);
12 }
13 }
14 BENCHMARK(BM_Simple);
15 ADD_CASES(TC_JSONOut, {{"\"name\": \"BM_Simple\",$"}});
16
CheckSimple(Results const & e)17 static void CheckSimple(Results const& e) {
18 CHECK_COUNTER_VALUE(e, double, "CYCLES", GT, 0);
19 CHECK_COUNTER_VALUE(e, double, "BRANCHES", GT, 0.0);
20 }
21 CHECK_BENCHMARK_RESULTS("BM_Simple", &CheckSimple);
22
main(int argc,char * argv[])23 int main(int argc, char* argv[]) {
24 if (!benchmark::internal::PerfCounters::kSupported) {
25 return 0;
26 }
27 RunOutputTests(argc, argv);
28 }
29