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