You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
698 B

2 months ago
  1. #undef NDEBUG
  2. #include "../src/perf_counters.h"
  3. #include "benchmark/benchmark.h"
  4. #include "output_test.h"
  5. static void BM_Simple(benchmark::State& state) {
  6. for (auto _ : state) {
  7. auto iterations = state.iterations();
  8. benchmark::DoNotOptimize(iterations);
  9. }
  10. }
  11. BENCHMARK(BM_Simple);
  12. ADD_CASES(TC_JSONOut, {{"\"name\": \"BM_Simple\",$"}});
  13. static void CheckSimple(Results const& e) {
  14. CHECK_COUNTER_VALUE(e, double, "CYCLES", GT, 0);
  15. CHECK_COUNTER_VALUE(e, double, "BRANCHES", GT, 0.0);
  16. }
  17. CHECK_BENCHMARK_RESULTS("BM_Simple", &CheckSimple);
  18. int main(int argc, char* argv[]) {
  19. if (!benchmark::internal::PerfCounters::kSupported) {
  20. return 0;
  21. }
  22. RunOutputTests(argc, argv);
  23. }