John Reck | e702c9c | 2015-10-07 10:26:02 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2015 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | #ifndef TESTS_BENCHMARK_H |
| 17 | #define TESTS_BENCHMARK_H |
| 18 | |
| 19 | #include <string> |
| 20 | #include <vector> |
| 21 | |
| 22 | namespace android { |
| 23 | namespace uirenderer { |
| 24 | |
| 25 | struct BenchmarkOptions { |
| 26 | int count; |
| 27 | }; |
| 28 | |
| 29 | typedef void (*BenchmarkFunctor)(const BenchmarkOptions&); |
| 30 | |
| 31 | struct BenchmarkInfo { |
| 32 | std::string name; |
| 33 | std::string description; |
| 34 | BenchmarkFunctor functor; |
| 35 | }; |
| 36 | |
| 37 | class Benchmark { |
| 38 | public: |
| 39 | Benchmark(const BenchmarkInfo& info) { |
| 40 | registerBenchmark(info); |
| 41 | } |
| 42 | |
| 43 | private: |
| 44 | Benchmark() = delete; |
| 45 | Benchmark(const Benchmark&) = delete; |
| 46 | Benchmark& operator=(const Benchmark&) = delete; |
| 47 | |
| 48 | static void registerBenchmark(const BenchmarkInfo& info); |
| 49 | }; |
| 50 | |
| 51 | } /* namespace uirenderer */ |
| 52 | } /* namespace android */ |
| 53 | |
| 54 | #endif /* TESTS_BENCHMARK_H */ |