blob: aad8eb3716a69cffb34ae5848ff456ec6a871650 [file] [log] [blame]
John Recke702c9c2015-10-07 10:26:02 -07001/*
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
Chris Craik8160f202015-12-02 14:50:25 -080019#include "tests/common/TestScene.h"
John Reck16c9d6a2015-11-17 15:51:08 -080020
John Recke702c9c2015-10-07 10:26:02 -070021#include <string>
22#include <vector>
23
24namespace android {
25namespace uirenderer {
26
27struct BenchmarkOptions {
28 int count;
29};
30
John Reck16c9d6a2015-11-17 15:51:08 -080031typedef test::TestScene* (*CreateScene)(const BenchmarkOptions&);
32
33template <class T>
34test::TestScene* simpleCreateScene(const BenchmarkOptions&) {
35 return new T();
36}
John Recke702c9c2015-10-07 10:26:02 -070037
38struct BenchmarkInfo {
39 std::string name;
40 std::string description;
John Reck16c9d6a2015-11-17 15:51:08 -080041 CreateScene createScene;
John Recke702c9c2015-10-07 10:26:02 -070042};
43
44class Benchmark {
45public:
46 Benchmark(const BenchmarkInfo& info) {
47 registerBenchmark(info);
48 }
49
50private:
51 Benchmark() = delete;
52 Benchmark(const Benchmark&) = delete;
53 Benchmark& operator=(const Benchmark&) = delete;
54
55 static void registerBenchmark(const BenchmarkInfo& info);
56};
57
58} /* namespace uirenderer */
59} /* namespace android */
60
61#endif /* TESTS_BENCHMARK_H */