1 /*
2  * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "drawing_engine_sample.h"
17 
18 #include <iostream>
19 #include <string>
20 
21 #include "benchmark_config.h"
22 #include "drawing_multithread.h"
23 #include "drawing_singlethread.h"
24 #include "drawing_api.h"
25 #include "drawing_playback.h"
26 
27 using namespace OHOS;
28 using namespace OHOS::Rosen;
29 
main(int32_t argc,char * argv[])30 int32_t main(int32_t argc, char *argv[])
31 {
32     DrawingEngineSample m;
33 
34     std::cout << "benchmark name is " << argv[1] << std::endl;
35 
36     BenchmarkConfig::SetBenchMarkType(std::string(argv[1]));
37 
38     BenchMark* benchMark = nullptr;
39 
40     switch (BenchmarkConfig::benchMarkType_) {
41         case BenchMarkName::SINGLETHREAD:
42             std::cout << "new DrawingSinglethread()" << std::endl;
43             benchMark = new DrawingSinglethread();
44             break;
45         case BenchMarkName::MULTITHREAD:
46             std::cout << "new DrawingMultithread()" << std::endl;
47             benchMark = new DrawingMultithread();
48             break;
49         case BenchMarkName::API:
50             std::cout << "new DrawingApi()" << std::endl;
51             benchMark = new DrawingApi();
52             break;
53         case BenchMarkName::DCL:
54             std::cout << "new DrawingDCL()" << std::endl;
55             benchMark = new DrawingDCL(argc, argv);
56             break;
57         default:
58             break;
59     }
60 
61     std::cout << "start to SetBenchMark" << std::endl;
62     m.SetBenchMark(benchMark);
63     m.Run();
64     return 0;
65 }