1 /*
2  * Copyright (c) 2024 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 "camera_benchmark_test.h"
17 
18 using namespace OHOS;
19 using namespace std;
20 using namespace testing::ext;
21 using namespace OHOS::Camera;
22 
23 constexpr int32_t ITERATION_FREQUENCY = 100;
24 constexpr int32_t REPETITION_FREQUENCY = 3;
25 
SetUp(const::benchmark::State & state)26 void CameraBenchmarkTest::SetUp(const ::benchmark::State &state)
27 {
28     cameraTest = std::make_shared<OHOS::Camera::Test>();
29     cameraTest->Init();
30     cameraTest->Open(DEVICE_0);
31 }
32 
TearDown(const::benchmark::State & state)33 void CameraBenchmarkTest::TearDown(const ::benchmark::State &state)
34 {
35     cameraTest->Close();
36 }
37 
38 /**
39   * @tc.name: NULL
40   * @tc.desc: benchmark
41   * @tc.level: Level0
42   * @tc.size: MediumTest
43   * @tc.type: Function
44   */
BENCHMARK_F(CameraBenchmarkTest,NULL_benchmark_001)45 BENCHMARK_F(CameraBenchmarkTest, NULL_benchmark_001)(
46     benchmark::State &st)
47 {
48     // Add code
49 }
50 BENCHMARK_REGISTER_F(CameraBenchmarkTest, NULL_benchmark_001)->Iterations(ITERATION_FREQUENCY)->
51     Repetitions(REPETITION_FREQUENCY)->ReportAggregatesOnly();
52