xref: /aosp_15_r20/external/libvpx/test/bench.h (revision fb1b10ab9aebc7c7068eedab379b749d7e3900be)
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 
11 #ifndef VPX_TEST_BENCH_H_
12 #define VPX_TEST_BENCH_H_
13 
14 // Number of iterations used to compute median run time.
15 #define VPX_BENCH_ROBUST_ITER 15
16 
17 class AbstractBench {
18  public:
19   virtual ~AbstractBench() = default;
20 
21   void RunNTimes(int n);
22   void PrintMedian(const char *title);
23 
24  protected:
25   // Implement this method and put the code to benchmark in it.
26   virtual void Run() = 0;
27 
28  private:
29   int times_[VPX_BENCH_ROBUST_ITER];
30 };
31 
32 #endif  // VPX_TEST_BENCH_H_
33