bench.h 835 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright (c) 2018 The WebM project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef VPX_TEST_BENCH_H_
  11. #define VPX_TEST_BENCH_H_
  12. // Number of iterations used to compute median run time.
  13. #define VPX_BENCH_ROBUST_ITER 15
  14. class AbstractBench {
  15. public:
  16. void RunNTimes(int n);
  17. void PrintMedian(const char *title);
  18. protected:
  19. // Implement this method and put the code to benchmark in it.
  20. virtual void Run() = 0;
  21. private:
  22. int times_[VPX_BENCH_ROBUST_ITER];
  23. };
  24. #endif // VPX_TEST_BENCH_H_