[Workflow] Try to fix code-formatter failing to find changes in some cases.
[llvm-project.git] / third-party / benchmark / test / perf_counters_test.cc
blob3017a452fe275926f01b88d5789b1182f9433417
1 #undef NDEBUG
3 #include "../src/perf_counters.h"
5 #include "benchmark/benchmark.h"
6 #include "output_test.h"
8 static void BM_Simple(benchmark::State& state) {
9 for (auto _ : state) {
10 benchmark::DoNotOptimize(state.iterations());
13 BENCHMARK(BM_Simple);
14 ADD_CASES(TC_JSONOut, {{"\"name\": \"BM_Simple\",$"}});
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);
20 CHECK_BENCHMARK_RESULTS("BM_Simple", &CheckSimple);
22 int main(int argc, char* argv[]) {
23 if (!benchmark::internal::PerfCounters::kSupported) {
24 return 0;
26 RunOutputTests(argc, argv);