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 26 #include "drawing_singlethread.h" 27 28 using namespace OHOS; 29 using namespace OHOS::Rosen; 30 main(int32_t argc,char * argv[])31int32_t main(int32_t argc, char *argv[]) 32 { 33 DrawingEngineSample m; 34 35 std::cout << "benchmark name is " << argv[1] << std::endl; 36 37 BenchmarkConfig::SetBenchMarkType(std::string(argv[1])); 38 39 BenchMark* benchMark = nullptr; 40 41 switch (BenchmarkConfig::benchMarkType_) { 42 case BenchMarkName::SINGLETHREAD: 43 std::cout << "new DrawingSinglethread()" << std::endl; 44 benchMark = new DrawingSinglethread(); 45 break; 46 case BenchMarkName::MULTITHREAD: 47 std::cout << "new DrawingMultithread()" << std::endl; 48 benchMark = new DrawingMultithread(); 49 break; 50 case BenchMarkName::API: 51 std::cout << "new DrawingApi()" << std::endl; 52 benchMark = new DrawingApi(); 53 break; 54 default: 55 break; 56 } 57 58 std::cout << "start to SetBenchMark" << std::endl; 59 m.SetBenchMark(benchMark); 60 m.Run(); 61 return 0; 62 }