1094332d3Sopenharmony_ci/*
2094332d3Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
3094332d3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4094332d3Sopenharmony_ci * you may not use this file except in compliance with the License.
5094332d3Sopenharmony_ci * You may obtain a copy of the License at
6094332d3Sopenharmony_ci *
7094332d3Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8094332d3Sopenharmony_ci *
9094332d3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10094332d3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11094332d3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12094332d3Sopenharmony_ci * See the License for the specific language governing permissions and
13094332d3Sopenharmony_ci * limitations under the License.
14094332d3Sopenharmony_ci */
15094332d3Sopenharmony_ci
16094332d3Sopenharmony_ci#include <OMX_Component.h>
17094332d3Sopenharmony_ci#include <OMX_Core.h>
18094332d3Sopenharmony_ci#include <OMX_Video.h>
19094332d3Sopenharmony_ci#include <OMX_VideoExt.h>
20094332d3Sopenharmony_ci#include <gtest/gtest.h>
21094332d3Sopenharmony_ci#include <hdf_log.h>
22094332d3Sopenharmony_ci#include <securec.h>
23094332d3Sopenharmony_ci#include <servmgr_hdi.h>
24094332d3Sopenharmony_ci#include <vector>
25094332d3Sopenharmony_ci#include <benchmark/benchmark.h>
26094332d3Sopenharmony_ci#include "codec_omx_ext.h"
27094332d3Sopenharmony_ci#include "v3_0/codec_callback_service.h"
28094332d3Sopenharmony_ci#include "v3_0/icodec_component.h"
29094332d3Sopenharmony_ci#include "v3_0/icodec_component_manager.h"
30094332d3Sopenharmony_ci#include "v1_0/display_composer_type.h"
31094332d3Sopenharmony_ci#include "v1_0/display_buffer_type.h"
32094332d3Sopenharmony_ci#include "v1_0/include/idisplay_buffer.h"
33094332d3Sopenharmony_ci
34094332d3Sopenharmony_ci#define HDF_LOG_TAG codec_benchmark_omx_test
35094332d3Sopenharmony_ci#define CODEC_NUM 0
36094332d3Sopenharmony_ci#define TUNNELE_COMP 1002
37094332d3Sopenharmony_ci#define TUNNELED_PORT 101
38094332d3Sopenharmony_ci
39094332d3Sopenharmony_ciusing namespace std;
40094332d3Sopenharmony_ciusing namespace testing::ext;
41094332d3Sopenharmony_ciusing OHOS::sptr;
42094332d3Sopenharmony_ciusing OHOS::HDI::Base::NativeBuffer;
43094332d3Sopenharmony_ciusing namespace OHOS::HDI::Codec::V3_0;
44094332d3Sopenharmony_ciusing namespace OHOS::HDI::Display::Buffer::V1_0;
45094332d3Sopenharmony_ciusing namespace OHOS::HDI::Display::Composer::V1_0;
46094332d3Sopenharmony_cinamespace {
47094332d3Sopenharmony_ciconst int32_t ITERATION_FREQUENCY = 100;
48094332d3Sopenharmony_ciconst int32_t REPETITION_FREQUENCY = 3;
49094332d3Sopenharmony_ciconstexpr int32_t WIDTH = 640;
50094332d3Sopenharmony_ciconstexpr int FD_DEFAULT = -1;
51094332d3Sopenharmony_ciconstexpr int64_t APP_DATA = 3;
52094332d3Sopenharmony_ciconstexpr int32_t HEIGHT = 480;
53094332d3Sopenharmony_ciconstexpr int32_t BUFFER_SIZE = WIDTH * HEIGHT * 3;
54094332d3Sopenharmony_ciconstexpr int32_t FRAMERATE = 30 << 16;
55094332d3Sopenharmony_ciconstexpr uint32_t BUFFER_ID_ERROR = 65000;
56094332d3Sopenharmony_cistatic IDisplayBuffer *gralloc_ = nullptr;
57094332d3Sopenharmony_cistatic sptr<ICodecComponent> component_ = nullptr;
58094332d3Sopenharmony_cistatic sptr<ICodecCallback> callback_ = nullptr;
59094332d3Sopenharmony_cistatic sptr<ICodecComponentManager> manager_ = nullptr;
60094332d3Sopenharmony_cistatic OHOS::HDI::Codec::V3_0::CodecVersionType version_;
61094332d3Sopenharmony_cistatic inline std::string compName_ = "";
62094332d3Sopenharmony_ci
63094332d3Sopenharmony_ciclass CodecBenchmarkOmxTest : public benchmark::Fixture {
64094332d3Sopenharmony_cipublic:
65094332d3Sopenharmony_ci    enum class PortIndex { PORT_INDEX_INPUT = 0, PORT_INDEX_OUTPUT = 1 };
66094332d3Sopenharmony_ci    struct BufferInfo {
67094332d3Sopenharmony_ci        std::shared_ptr<OmxCodecBuffer> omxBuffer;
68094332d3Sopenharmony_ci        std::shared_ptr<OHOS::Ashmem> sharedMem;
69094332d3Sopenharmony_ci        BufferHandle *bufferHandle;
70094332d3Sopenharmony_ci        BufferInfo()
71094332d3Sopenharmony_ci        {
72094332d3Sopenharmony_ci            omxBuffer = nullptr;
73094332d3Sopenharmony_ci            sharedMem = nullptr;
74094332d3Sopenharmony_ci            bufferHandle = nullptr;
75094332d3Sopenharmony_ci        }
76094332d3Sopenharmony_ci        ~BufferInfo()
77094332d3Sopenharmony_ci        {
78094332d3Sopenharmony_ci            omxBuffer = nullptr;
79094332d3Sopenharmony_ci            if (sharedMem != nullptr) {
80094332d3Sopenharmony_ci                sharedMem->UnmapAshmem();
81094332d3Sopenharmony_ci                sharedMem->CloseAshmem();
82094332d3Sopenharmony_ci                sharedMem = nullptr;
83094332d3Sopenharmony_ci            }
84094332d3Sopenharmony_ci            if (bufferHandle != nullptr && gralloc_ != nullptr) {
85094332d3Sopenharmony_ci                gralloc_->FreeMem(*bufferHandle);
86094332d3Sopenharmony_ci                bufferHandle = nullptr;
87094332d3Sopenharmony_ci            }
88094332d3Sopenharmony_ci        }
89094332d3Sopenharmony_ci    };
90094332d3Sopenharmony_ci    template <typename T>
91094332d3Sopenharmony_ci    void InitParam(T &param)
92094332d3Sopenharmony_ci    {
93094332d3Sopenharmony_ci        int32_t ret = memset_s(&param, sizeof(param), 0, sizeof(param));
94094332d3Sopenharmony_ci        ASSERT_EQ(ret, EOK);
95094332d3Sopenharmony_ci        param.nSize = sizeof(param);
96094332d3Sopenharmony_ci        param.nVersion.nVersion = 1;
97094332d3Sopenharmony_ci    }
98094332d3Sopenharmony_ci
99094332d3Sopenharmony_ci    template <typename T>
100094332d3Sopenharmony_ci    void InitExtParam(T &param)
101094332d3Sopenharmony_ci    {
102094332d3Sopenharmony_ci        int32_t ret = memset_s(&param, sizeof(param), 0, sizeof(param));
103094332d3Sopenharmony_ci        ASSERT_EQ(ret, EOK);
104094332d3Sopenharmony_ci        param.size = sizeof(param);
105094332d3Sopenharmony_ci        param.version.nVersion = 1;
106094332d3Sopenharmony_ci    }
107094332d3Sopenharmony_ci
108094332d3Sopenharmony_ci    void InitOmxCodecBuffer(OmxCodecBuffer& buffer, CodecBufferType type)
109094332d3Sopenharmony_ci    {
110094332d3Sopenharmony_ci        buffer.bufferType = type;
111094332d3Sopenharmony_ci        buffer.fenceFd = -1;
112094332d3Sopenharmony_ci        buffer.version = version_;
113094332d3Sopenharmony_ci        buffer.allocLen = BUFFER_SIZE;
114094332d3Sopenharmony_ci        buffer.fd = FD_DEFAULT;
115094332d3Sopenharmony_ci        buffer.bufferhandle = nullptr;
116094332d3Sopenharmony_ci        buffer.pts = CODEC_NUM;
117094332d3Sopenharmony_ci        buffer.flag = CODEC_NUM;
118094332d3Sopenharmony_ci        buffer.size = sizeof(OmxCodecBuffer);
119094332d3Sopenharmony_ci        buffer.type = READ_ONLY_TYPE;
120094332d3Sopenharmony_ci    }
121094332d3Sopenharmony_ci
122094332d3Sopenharmony_ci    void InitCodecBufferWithAshMem(enum PortIndex port, int bufferSize, shared_ptr<OmxCodecBuffer> omxBuffer,
123094332d3Sopenharmony_ci                                   shared_ptr<OHOS::Ashmem> sharedMem)
124094332d3Sopenharmony_ci    {
125094332d3Sopenharmony_ci        InitOmxCodecBuffer(*omxBuffer.get(), CODEC_BUFFER_TYPE_AVSHARE_MEM_FD);
126094332d3Sopenharmony_ci        omxBuffer->fd = sharedMem->GetAshmemFd();
127094332d3Sopenharmony_ci        if (port == PortIndex::PORT_INDEX_INPUT) {
128094332d3Sopenharmony_ci            omxBuffer->type = READ_ONLY_TYPE;
129094332d3Sopenharmony_ci            sharedMem->MapReadAndWriteAshmem();
130094332d3Sopenharmony_ci        } else {
131094332d3Sopenharmony_ci            omxBuffer->type = READ_WRITE_TYPE;
132094332d3Sopenharmony_ci            sharedMem->MapReadOnlyAshmem();
133094332d3Sopenharmony_ci        }
134094332d3Sopenharmony_ci    }
135094332d3Sopenharmony_ci
136094332d3Sopenharmony_ci    bool UseBufferOnPort(enum PortIndex port, int32_t bufferCount, int32_t bufferSize)
137094332d3Sopenharmony_ci    {
138094332d3Sopenharmony_ci        for (int i = 0; i < bufferCount; i++) {
139094332d3Sopenharmony_ci            std::shared_ptr<OmxCodecBuffer> omxBuffer = std::make_shared<OmxCodecBuffer>();
140094332d3Sopenharmony_ci            if (omxBuffer == nullptr) {
141094332d3Sopenharmony_ci                return false;
142094332d3Sopenharmony_ci            }
143094332d3Sopenharmony_ci
144094332d3Sopenharmony_ci            int fd = OHOS::AshmemCreate(CODEC_NUM, bufferSize);
145094332d3Sopenharmony_ci            shared_ptr<OHOS::Ashmem> sharedMem = make_shared<OHOS::Ashmem>(fd, bufferSize);
146094332d3Sopenharmony_ci            if (sharedMem == nullptr) {
147094332d3Sopenharmony_ci                if (fd >= 0) {
148094332d3Sopenharmony_ci                    close(fd);
149094332d3Sopenharmony_ci                    fd = -1;
150094332d3Sopenharmony_ci                }
151094332d3Sopenharmony_ci                return false;
152094332d3Sopenharmony_ci            }
153094332d3Sopenharmony_ci            InitCodecBufferWithAshMem(port, bufferSize, omxBuffer, sharedMem);
154094332d3Sopenharmony_ci            OmxCodecBuffer outBuffer;
155094332d3Sopenharmony_ci            auto err = component_->UseBuffer(static_cast<uint32_t>(port), *omxBuffer.get(), outBuffer);
156094332d3Sopenharmony_ci            if (err != HDF_SUCCESS) {
157094332d3Sopenharmony_ci                sharedMem->UnmapAshmem();
158094332d3Sopenharmony_ci                sharedMem->CloseAshmem();
159094332d3Sopenharmony_ci                sharedMem = nullptr;
160094332d3Sopenharmony_ci                omxBuffer = nullptr;
161094332d3Sopenharmony_ci                return false;
162094332d3Sopenharmony_ci            }
163094332d3Sopenharmony_ci            omxBuffer->bufferId = outBuffer.bufferId;
164094332d3Sopenharmony_ci            omxBuffer->fd = FD_DEFAULT;
165094332d3Sopenharmony_ci            std::shared_ptr<BufferInfo> bufferInfo = std::make_shared<BufferInfo>();
166094332d3Sopenharmony_ci            bufferInfo->omxBuffer = omxBuffer;
167094332d3Sopenharmony_ci            bufferInfo->sharedMem = sharedMem;
168094332d3Sopenharmony_ci            if (port == PortIndex::PORT_INDEX_INPUT) {
169094332d3Sopenharmony_ci                inputBuffers_.emplace(std::make_pair(omxBuffer->bufferId, bufferInfo));
170094332d3Sopenharmony_ci            } else {
171094332d3Sopenharmony_ci                outputBuffers_.emplace(std::make_pair(omxBuffer->bufferId, bufferInfo));
172094332d3Sopenharmony_ci            }
173094332d3Sopenharmony_ci        }
174094332d3Sopenharmony_ci        return true;
175094332d3Sopenharmony_ci    }
176094332d3Sopenharmony_ci
177094332d3Sopenharmony_ci    bool FreeBufferOnPort(enum PortIndex port)
178094332d3Sopenharmony_ci    {
179094332d3Sopenharmony_ci        std::map<int32_t, std::shared_ptr<BufferInfo>> &buffer = inputBuffers_;
180094332d3Sopenharmony_ci        if (port == PortIndex::PORT_INDEX_OUTPUT) {
181094332d3Sopenharmony_ci            buffer = outputBuffers_;
182094332d3Sopenharmony_ci        }
183094332d3Sopenharmony_ci        for (auto [bufferId, bufferInfo] : buffer) {
184094332d3Sopenharmony_ci            auto ret = component_->FreeBuffer(static_cast<uint32_t>(port), *bufferInfo->omxBuffer.get());
185094332d3Sopenharmony_ci            if (ret != HDF_SUCCESS) {
186094332d3Sopenharmony_ci                return false;
187094332d3Sopenharmony_ci            }
188094332d3Sopenharmony_ci        }
189094332d3Sopenharmony_ci        buffer.clear();
190094332d3Sopenharmony_ci        return true;
191094332d3Sopenharmony_ci    }
192094332d3Sopenharmony_ci
193094332d3Sopenharmony_ci    void InitComponent()
194094332d3Sopenharmony_ci    {
195094332d3Sopenharmony_ci        int32_t count = CODEC_NUM;
196094332d3Sopenharmony_ci        (void)manager_->GetComponentNum(count);
197094332d3Sopenharmony_ci        if (count > 0) {
198094332d3Sopenharmony_ci            std::vector<CodecCompCapability> capList;
199094332d3Sopenharmony_ci            auto err = manager_->GetComponentCapabilityList(capList, count);
200094332d3Sopenharmony_ci            ASSERT_TRUE(err == HDF_SUCCESS);
201094332d3Sopenharmony_ci            compName_ = capList[0].compName;
202094332d3Sopenharmony_ci        }
203094332d3Sopenharmony_ci
204094332d3Sopenharmony_ci        callback_ = new CodecCallbackService();
205094332d3Sopenharmony_ci        if (callback_ == nullptr) {
206094332d3Sopenharmony_ci            return;
207094332d3Sopenharmony_ci        }
208094332d3Sopenharmony_ci        if (compName_.empty()) {
209094332d3Sopenharmony_ci            return;
210094332d3Sopenharmony_ci        }
211094332d3Sopenharmony_ci
212094332d3Sopenharmony_ci        auto ret = manager_->CreateComponent(component_, componentId_, compName_.data(),
213094332d3Sopenharmony_ci                                             APP_DATA, callback_);
214094332d3Sopenharmony_ci        ASSERT_TRUE(component_ != nullptr);
215094332d3Sopenharmony_ci        if (ret != HDF_SUCCESS) {
216094332d3Sopenharmony_ci            return;
217094332d3Sopenharmony_ci        }
218094332d3Sopenharmony_ci        struct CompVerInfo verInfo;
219094332d3Sopenharmony_ci        ret = component_->GetComponentVersion(verInfo);
220094332d3Sopenharmony_ci        ASSERT_TRUE(component_ != nullptr);
221094332d3Sopenharmony_ci        if (ret != HDF_SUCCESS) {
222094332d3Sopenharmony_ci            return;
223094332d3Sopenharmony_ci        }
224094332d3Sopenharmony_ci        version_ = verInfo.compVersion;
225094332d3Sopenharmony_ci        return;
226094332d3Sopenharmony_ci    }
227094332d3Sopenharmony_ci
228094332d3Sopenharmony_ci    void SetUp(benchmark::State &state)
229094332d3Sopenharmony_ci    {
230094332d3Sopenharmony_ci        manager_ = ICodecComponentManager::Get();
231094332d3Sopenharmony_ci        gralloc_ = IDisplayBuffer::Get();
232094332d3Sopenharmony_ci        if (manager_ == nullptr || gralloc_ == nullptr) {
233094332d3Sopenharmony_ci            std::cout << "GetCodecComponentManager  or GetDisplayBuffer ret nullptr" << std::endl;
234094332d3Sopenharmony_ci            return;
235094332d3Sopenharmony_ci        }
236094332d3Sopenharmony_ci        InitComponent();
237094332d3Sopenharmony_ci    }
238094332d3Sopenharmony_ci
239094332d3Sopenharmony_ci    void TearDown(benchmark::State &state)
240094332d3Sopenharmony_ci    {
241094332d3Sopenharmony_ci        if (manager_ != nullptr && component_ != nullptr) {
242094332d3Sopenharmony_ci            manager_->DestroyComponent(componentId_);
243094332d3Sopenharmony_ci        }
244094332d3Sopenharmony_ci        component_ = nullptr;
245094332d3Sopenharmony_ci        callback_ = nullptr;
246094332d3Sopenharmony_ci        manager_ = nullptr;
247094332d3Sopenharmony_ci        gralloc_ = nullptr;
248094332d3Sopenharmony_ci    }
249094332d3Sopenharmony_ci
250094332d3Sopenharmony_cipublic:
251094332d3Sopenharmony_ci    uint32_t componentId_ = CODEC_NUM;
252094332d3Sopenharmony_ci    std::map<int32_t, std::shared_ptr<BufferInfo>> inputBuffers_;
253094332d3Sopenharmony_ci    std::map<int32_t, std::shared_ptr<BufferInfo>> outputBuffers_;
254094332d3Sopenharmony_ci    const static uint32_t inputIndex = static_cast<uint32_t>(PortIndex::PORT_INDEX_INPUT);
255094332d3Sopenharmony_ci    const static uint32_t outputIndex = static_cast<uint32_t>(PortIndex::PORT_INDEX_OUTPUT);
256094332d3Sopenharmony_ci};
257094332d3Sopenharmony_ci
258094332d3Sopenharmony_citemplate <typename T>
259094332d3Sopenharmony_civoid ObjectToVector(T &param, std::vector<int8_t> &vec)
260094332d3Sopenharmony_ci{
261094332d3Sopenharmony_ci    int8_t *paramPointer = reinterpret_cast<int8_t *>(&param);
262094332d3Sopenharmony_ci    vec.insert(vec.end(), paramPointer, paramPointer + sizeof(param));
263094332d3Sopenharmony_ci}
264094332d3Sopenharmony_ci
265094332d3Sopenharmony_ciBENCHMARK_F(CodecBenchmarkOmxTest, GetComponentVersion)(benchmark::State &state)
266094332d3Sopenharmony_ci{
267094332d3Sopenharmony_ci    ASSERT_TRUE(component_ != nullptr);
268094332d3Sopenharmony_ci    int32_t ret;
269094332d3Sopenharmony_ci    struct CompVerInfo verInfo;
270094332d3Sopenharmony_ci    for (auto _ : state) {
271094332d3Sopenharmony_ci        ret = component_->GetComponentVersion(verInfo);
272094332d3Sopenharmony_ci        ASSERT_EQ(ret, HDF_SUCCESS);
273094332d3Sopenharmony_ci    }
274094332d3Sopenharmony_ci}
275094332d3Sopenharmony_ci
276094332d3Sopenharmony_ciBENCHMARK_REGISTER_F(CodecBenchmarkOmxTest, GetComponentVersion)->
277094332d3Sopenharmony_ci    Iterations(ITERATION_FREQUENCY)->Repetitions(REPETITION_FREQUENCY)->ReportAggregatesOnly();
278094332d3Sopenharmony_ci
279094332d3Sopenharmony_ciBENCHMARK_F(CodecBenchmarkOmxTest, GetParameter)(benchmark::State &state)
280094332d3Sopenharmony_ci{
281094332d3Sopenharmony_ci    ASSERT_TRUE(component_ != nullptr);
282094332d3Sopenharmony_ci    int32_t ret;
283094332d3Sopenharmony_ci    CodecVideoPortFormatParam pixFormat;
284094332d3Sopenharmony_ci    InitExtParam(pixFormat);
285094332d3Sopenharmony_ci    pixFormat.portIndex = outputIndex;
286094332d3Sopenharmony_ci    pixFormat.codecColorIndex = CODEC_NUM;
287094332d3Sopenharmony_ci
288094332d3Sopenharmony_ci    std::vector<int8_t> inParam;
289094332d3Sopenharmony_ci    ObjectToVector(pixFormat, inParam);
290094332d3Sopenharmony_ci
291094332d3Sopenharmony_ci    std::vector<int8_t> outParam;
292094332d3Sopenharmony_ci    for (auto _ : state) {
293094332d3Sopenharmony_ci        ret = component_->GetParameter(OMX_IndexCodecVideoPortFormat, inParam, outParam);
294094332d3Sopenharmony_ci        ASSERT_EQ(ret, HDF_SUCCESS);
295094332d3Sopenharmony_ci    }
296094332d3Sopenharmony_ci}
297094332d3Sopenharmony_ci
298094332d3Sopenharmony_ciBENCHMARK_REGISTER_F(CodecBenchmarkOmxTest, GetParameter)->
299094332d3Sopenharmony_ci    Iterations(ITERATION_FREQUENCY)->Repetitions(REPETITION_FREQUENCY)->ReportAggregatesOnly();
300094332d3Sopenharmony_ci
301094332d3Sopenharmony_ciBENCHMARK_F(CodecBenchmarkOmxTest, SetParameter)(benchmark::State &state)
302094332d3Sopenharmony_ci{
303094332d3Sopenharmony_ci    ASSERT_TRUE(component_ != nullptr);
304094332d3Sopenharmony_ci    int32_t ret;
305094332d3Sopenharmony_ci    OMX_VIDEO_PARAM_PORTFORMATTYPE param;
306094332d3Sopenharmony_ci    InitParam(param);
307094332d3Sopenharmony_ci    param.nPortIndex = inputIndex;
308094332d3Sopenharmony_ci    std::vector<int8_t> paramVec;
309094332d3Sopenharmony_ci    ObjectToVector(param, paramVec);
310094332d3Sopenharmony_ci    for (auto _ : state) {
311094332d3Sopenharmony_ci        ret = component_->SetParameter(OMX_IndexParamVideoPortFormat, paramVec);
312094332d3Sopenharmony_ci        ASSERT_EQ(ret, HDF_SUCCESS);
313094332d3Sopenharmony_ci    }
314094332d3Sopenharmony_ci}
315094332d3Sopenharmony_ci
316094332d3Sopenharmony_ciBENCHMARK_REGISTER_F(CodecBenchmarkOmxTest, SetParameter)->
317094332d3Sopenharmony_ci    Iterations(ITERATION_FREQUENCY)->Repetitions(REPETITION_FREQUENCY)->ReportAggregatesOnly();
318094332d3Sopenharmony_ci
319094332d3Sopenharmony_ciBENCHMARK_F(CodecBenchmarkOmxTest, GetConfig)(benchmark::State &state)
320094332d3Sopenharmony_ci{
321094332d3Sopenharmony_ci    ASSERT_TRUE(component_ != nullptr);
322094332d3Sopenharmony_ci    int32_t ret;
323094332d3Sopenharmony_ci    OMX_VIDEO_CONFIG_BITRATETYPE param;
324094332d3Sopenharmony_ci    InitParam(param);
325094332d3Sopenharmony_ci    param.nPortIndex = outputIndex;
326094332d3Sopenharmony_ci    std::vector<int8_t> inParam;
327094332d3Sopenharmony_ci    ObjectToVector(param, inParam);
328094332d3Sopenharmony_ci    std::vector<int8_t> outParam;
329094332d3Sopenharmony_ci    for (auto _ : state) {
330094332d3Sopenharmony_ci        ret = component_->GetConfig(OMX_IndexConfigVideoBitrate, inParam, outParam);
331094332d3Sopenharmony_ci        ASSERT_EQ(ret, HDF_SUCCESS);
332094332d3Sopenharmony_ci    }
333094332d3Sopenharmony_ci}
334094332d3Sopenharmony_ci
335094332d3Sopenharmony_ciBENCHMARK_REGISTER_F(CodecBenchmarkOmxTest, GetConfig)->
336094332d3Sopenharmony_ci    Iterations(ITERATION_FREQUENCY)->Repetitions(REPETITION_FREQUENCY)->ReportAggregatesOnly();
337094332d3Sopenharmony_ci
338094332d3Sopenharmony_ciBENCHMARK_F(CodecBenchmarkOmxTest, SetConfig)(benchmark::State &state)
339094332d3Sopenharmony_ci{
340094332d3Sopenharmony_ci    ASSERT_TRUE(component_ != nullptr);
341094332d3Sopenharmony_ci    int32_t ret;
342094332d3Sopenharmony_ci    OMX_VIDEO_CONFIG_BITRATETYPE param;
343094332d3Sopenharmony_ci    InitParam(param);
344094332d3Sopenharmony_ci    param.nPortIndex = outputIndex;
345094332d3Sopenharmony_ci    param.nEncodeBitrate = FRAMERATE;
346094332d3Sopenharmony_ci
347094332d3Sopenharmony_ci    std::vector<int8_t> inParam;
348094332d3Sopenharmony_ci    ObjectToVector(param, inParam);
349094332d3Sopenharmony_ci    for (auto _ : state) {
350094332d3Sopenharmony_ci        ret = component_->SetConfig(OMX_IndexConfigVideoBitrate, inParam);
351094332d3Sopenharmony_ci        ASSERT_EQ(ret, HDF_SUCCESS);
352094332d3Sopenharmony_ci    }
353094332d3Sopenharmony_ci}
354094332d3Sopenharmony_ci
355094332d3Sopenharmony_ciBENCHMARK_REGISTER_F(CodecBenchmarkOmxTest, SetConfig)->
356094332d3Sopenharmony_ci    Iterations(ITERATION_FREQUENCY)->Repetitions(REPETITION_FREQUENCY)->ReportAggregatesOnly();
357094332d3Sopenharmony_ci
358094332d3Sopenharmony_ci#ifdef SUPPORT_OMX_EXTEND
359094332d3Sopenharmony_ciBENCHMARK_F(CodecBenchmarkOmxTest, GetExtensionIndex)(benchmark::State &state)
360094332d3Sopenharmony_ci{
361094332d3Sopenharmony_ci    ASSERT_TRUE(component_ != nullptr);
362094332d3Sopenharmony_ci    int32_t ret;
363094332d3Sopenharmony_ci    uint32_t indexType = CODEC_NUM;
364094332d3Sopenharmony_ci    for (auto _ : state) {
365094332d3Sopenharmony_ci        ret = component_->GetExtensionIndex("OMX.Topaz.index.param.extended_video", indexType);
366094332d3Sopenharmony_ci        ASSERT_EQ(ret, HDF_SUCCESS);
367094332d3Sopenharmony_ci    }
368094332d3Sopenharmony_ci}
369094332d3Sopenharmony_ci
370094332d3Sopenharmony_ciBENCHMARK_REGISTER_F(CodecBenchmarkOmxTest, GetExtensionIndex)->
371094332d3Sopenharmony_ci    Iterations(ITERATION_FREQUENCY)->Repetitions(REPETITION_FREQUENCY)->ReportAggregatesOnly();
372094332d3Sopenharmony_ci#endif
373094332d3Sopenharmony_ci
374094332d3Sopenharmony_ciBENCHMARK_F(CodecBenchmarkOmxTest, GetState)(benchmark::State &state)
375094332d3Sopenharmony_ci{
376094332d3Sopenharmony_ci    ASSERT_TRUE(component_ != nullptr);
377094332d3Sopenharmony_ci    int32_t ret;
378094332d3Sopenharmony_ci    CodecStateType codecState = CODEC_STATE_INVALID;
379094332d3Sopenharmony_ci    for (auto _ : state) {
380094332d3Sopenharmony_ci        ret = component_->GetState(codecState);
381094332d3Sopenharmony_ci        ASSERT_EQ(codecState, CODEC_STATE_LOADED);
382094332d3Sopenharmony_ci        ASSERT_EQ(ret, HDF_SUCCESS);
383094332d3Sopenharmony_ci    }
384094332d3Sopenharmony_ci}
385094332d3Sopenharmony_ci
386094332d3Sopenharmony_ciBENCHMARK_REGISTER_F(CodecBenchmarkOmxTest, GetState)->
387094332d3Sopenharmony_ci    Iterations(ITERATION_FREQUENCY)->Repetitions(REPETITION_FREQUENCY)->ReportAggregatesOnly();
388094332d3Sopenharmony_ci
389094332d3Sopenharmony_ci#ifdef SUPPORT_OMX_EXTEND
390094332d3Sopenharmony_ciBENCHMARK_F(CodecBenchmarkOmxTest, ComponentTunnelRequest)(benchmark::State &state)
391094332d3Sopenharmony_ci{
392094332d3Sopenharmony_ci    ASSERT_TRUE(component_ != nullptr);
393094332d3Sopenharmony_ci    int32_t ret;
394094332d3Sopenharmony_ci    const int32_t tunneledComp = TUNNELE_COMP;
395094332d3Sopenharmony_ci    const uint32_t tunneledPort = TUNNELED_PORT;
396094332d3Sopenharmony_ci    OHOS::HDI::Codec::V3_0::CodecTunnelSetupType tunnelSetup;
397094332d3Sopenharmony_ci    tunnelSetup.supplier = OHOS::HDI::Codec::V3_0::CODEC_BUFFER_SUPPLY_INPUT;
398094332d3Sopenharmony_ci    for (auto _ : state) {
399094332d3Sopenharmony_ci    ret = component_->ComponentTunnelRequest(outputIndex, tunneledComp, tunneledPort,
400094332d3Sopenharmony_ci        tunnelSetup, tunnelSetup);
401094332d3Sopenharmony_ci        ASSERT_NE(ret, HDF_SUCCESS);
402094332d3Sopenharmony_ci    }
403094332d3Sopenharmony_ci}
404094332d3Sopenharmony_ci
405094332d3Sopenharmony_ciBENCHMARK_REGISTER_F(CodecBenchmarkOmxTest, ComponentTunnelRequest)->
406094332d3Sopenharmony_ci    Iterations(ITERATION_FREQUENCY)->Repetitions(REPETITION_FREQUENCY)->ReportAggregatesOnly();
407094332d3Sopenharmony_ci
408094332d3Sopenharmony_ciBENCHMARK_F(CodecBenchmarkOmxTest, SendCommand)(benchmark::State &state)
409094332d3Sopenharmony_ci{
410094332d3Sopenharmony_ci    std::vector<int8_t> cmdData;
411094332d3Sopenharmony_ci    int32_t ret;
412094332d3Sopenharmony_ci    for (auto _ : state) {
413094332d3Sopenharmony_ci        if (component_ == nullptr) {
414094332d3Sopenharmony_ci            InitComponent();
415094332d3Sopenharmony_ci        }
416094332d3Sopenharmony_ci        ret = component_->SendCommand(CODEC_COMMAND_STATE_SET, CODEC_STATE_IDLE, cmdData);
417094332d3Sopenharmony_ci        manager_->DestroyComponent(componentId_);
418094332d3Sopenharmony_ci        ASSERT_EQ(ret, HDF_SUCCESS);
419094332d3Sopenharmony_ci        component_ = nullptr;
420094332d3Sopenharmony_ci    }
421094332d3Sopenharmony_ci}
422094332d3Sopenharmony_ci
423094332d3Sopenharmony_ciBENCHMARK_REGISTER_F(CodecBenchmarkOmxTest, SendCommand)->
424094332d3Sopenharmony_ci    Iterations(ITERATION_FREQUENCY)->Repetitions(REPETITION_FREQUENCY)->ReportAggregatesOnly();
425094332d3Sopenharmony_ci
426094332d3Sopenharmony_ciBENCHMARK_F(CodecBenchmarkOmxTest, AllocateBuffer)(benchmark::State &state)
427094332d3Sopenharmony_ci{
428094332d3Sopenharmony_ci    ASSERT_TRUE(component_ != nullptr);
429094332d3Sopenharmony_ci    std::vector<int8_t> cmdData;
430094332d3Sopenharmony_ci    auto err = component_->SendCommand(CODEC_COMMAND_STATE_SET, CODEC_STATE_IDLE, cmdData);
431094332d3Sopenharmony_ci    ASSERT_EQ(err, HDF_SUCCESS);
432094332d3Sopenharmony_ci
433094332d3Sopenharmony_ci    struct OmxCodecBuffer allocBuffer;
434094332d3Sopenharmony_ci    InitOmxCodecBuffer(allocBuffer, CODEC_BUFFER_TYPE_AVSHARE_MEM_FD);
435094332d3Sopenharmony_ci    allocBuffer.type = READ_WRITE_TYPE;
436094332d3Sopenharmony_ci    struct OmxCodecBuffer outBuffer;
437094332d3Sopenharmony_ci    for (auto _ : state) {
438094332d3Sopenharmony_ci        err = component_->AllocateBuffer(outputIndex, allocBuffer, outBuffer);
439094332d3Sopenharmony_ci        ASSERT_EQ(err, HDF_SUCCESS);
440094332d3Sopenharmony_ci        err = component_->FreeBuffer(outputIndex, outBuffer);
441094332d3Sopenharmony_ci        ASSERT_EQ(err, HDF_SUCCESS);
442094332d3Sopenharmony_ci    }
443094332d3Sopenharmony_ci}
444094332d3Sopenharmony_ci
445094332d3Sopenharmony_ciBENCHMARK_REGISTER_F(CodecBenchmarkOmxTest, AllocateBuffer)->
446094332d3Sopenharmony_ci    Iterations(ITERATION_FREQUENCY)->Repetitions(REPETITION_FREQUENCY)->ReportAggregatesOnly();
447094332d3Sopenharmony_ci
448094332d3Sopenharmony_ciBENCHMARK_F(CodecBenchmarkOmxTest, UseBuffer)(benchmark::State &state)
449094332d3Sopenharmony_ci{
450094332d3Sopenharmony_ci    ASSERT_TRUE(component_ != nullptr);
451094332d3Sopenharmony_ci    std::vector<int8_t> cmdData;
452094332d3Sopenharmony_ci    auto ret = component_->SendCommand(CODEC_COMMAND_STATE_SET, CODEC_STATE_IDLE, cmdData);
453094332d3Sopenharmony_ci    ASSERT_EQ(ret, HDF_SUCCESS);
454094332d3Sopenharmony_ci
455094332d3Sopenharmony_ci    AllocInfo alloc = {.width = WIDTH,
456094332d3Sopenharmony_ci                       .height = HEIGHT,
457094332d3Sopenharmony_ci                       .usage = HBM_USE_CPU_READ | HBM_USE_CPU_WRITE | HBM_USE_MEM_DMA,
458094332d3Sopenharmony_ci                       .format = PIXEL_FMT_YCBCR_420_SP};
459094332d3Sopenharmony_ci    BufferHandle *bufferHandle = nullptr;
460094332d3Sopenharmony_ci    ASSERT_TRUE(gralloc_ != nullptr);
461094332d3Sopenharmony_ci    ret = gralloc_->AllocMem(alloc, bufferHandle);
462094332d3Sopenharmony_ci    ASSERT_EQ(ret, DISPLAY_SUCCESS);
463094332d3Sopenharmony_ci
464094332d3Sopenharmony_ci    std::shared_ptr<OmxCodecBuffer> omxBuffer = std::make_shared<OmxCodecBuffer>();
465094332d3Sopenharmony_ci    size_t handleSize =
466094332d3Sopenharmony_ci        sizeof(BufferHandle) + (sizeof(int32_t) * (bufferHandle->reserveFds + bufferHandle->reserveInts));
467094332d3Sopenharmony_ci    InitOmxCodecBuffer(*omxBuffer.get(), CODEC_BUFFER_TYPE_HANDLE);
468094332d3Sopenharmony_ci    omxBuffer->bufferhandle = new NativeBuffer(bufferHandle);
469094332d3Sopenharmony_ci    omxBuffer->allocLen = handleSize;
470094332d3Sopenharmony_ci    OmxCodecBuffer outBuffer;
471094332d3Sopenharmony_ci    for (auto _ : state) {
472094332d3Sopenharmony_ci        ret = component_->UseBuffer(inputIndex, *omxBuffer.get(), outBuffer);
473094332d3Sopenharmony_ci        omxBuffer->bufferId = outBuffer.bufferId;
474094332d3Sopenharmony_ci        ASSERT_EQ(ret, HDF_SUCCESS);
475094332d3Sopenharmony_ci        ret = component_->FreeBuffer(inputIndex, outBuffer);
476094332d3Sopenharmony_ci        ASSERT_EQ(ret, HDF_SUCCESS);
477094332d3Sopenharmony_ci    }
478094332d3Sopenharmony_ci}
479094332d3Sopenharmony_ci
480094332d3Sopenharmony_ciBENCHMARK_REGISTER_F(CodecBenchmarkOmxTest, UseBuffer)->
481094332d3Sopenharmony_ci    Iterations(ITERATION_FREQUENCY)->Repetitions(REPETITION_FREQUENCY)->ReportAggregatesOnly();
482094332d3Sopenharmony_ci#endif
483094332d3Sopenharmony_ci
484094332d3Sopenharmony_ciBENCHMARK_F(CodecBenchmarkOmxTest, UseEglImage)(benchmark::State &state)
485094332d3Sopenharmony_ci{
486094332d3Sopenharmony_ci    ASSERT_TRUE(component_ != nullptr);
487094332d3Sopenharmony_ci    int32_t ret;
488094332d3Sopenharmony_ci    struct OmxCodecBuffer omxBuffer;
489094332d3Sopenharmony_ci    InitOmxCodecBuffer(omxBuffer, CODEC_BUFFER_TYPE_AVSHARE_MEM_FD);
490094332d3Sopenharmony_ci    auto eglImage = std::make_unique<int8_t[]>(BUFFER_SIZE);
491094332d3Sopenharmony_ci    ASSERT_TRUE(eglImage != nullptr);
492094332d3Sopenharmony_ci    std::vector<int8_t> eglImageVec;
493094332d3Sopenharmony_ci    eglImageVec.assign(eglImage.get(), eglImage.get() + BUFFER_SIZE);
494094332d3Sopenharmony_ci    struct OmxCodecBuffer outbuffer;
495094332d3Sopenharmony_ci    for (auto _ : state) {
496094332d3Sopenharmony_ci        ret = component_->UseEglImage(inputIndex, omxBuffer, outbuffer, eglImageVec);
497094332d3Sopenharmony_ci        ASSERT_NE(ret, HDF_SUCCESS);
498094332d3Sopenharmony_ci        eglImage = nullptr;
499094332d3Sopenharmony_ci    }
500094332d3Sopenharmony_ci}
501094332d3Sopenharmony_ci
502094332d3Sopenharmony_ciBENCHMARK_REGISTER_F(CodecBenchmarkOmxTest, UseEglImage)->
503094332d3Sopenharmony_ci    Iterations(ITERATION_FREQUENCY)->Repetitions(REPETITION_FREQUENCY)->ReportAggregatesOnly();
504094332d3Sopenharmony_ci
505094332d3Sopenharmony_ciBENCHMARK_F(CodecBenchmarkOmxTest, FillThisBuffer)(benchmark::State &state)
506094332d3Sopenharmony_ci{
507094332d3Sopenharmony_ci    ASSERT_TRUE(component_ != nullptr);
508094332d3Sopenharmony_ci    int32_t ret;
509094332d3Sopenharmony_ci    struct OmxCodecBuffer omxBuffer;
510094332d3Sopenharmony_ci    InitOmxCodecBuffer(omxBuffer, CODEC_BUFFER_TYPE_AVSHARE_MEM_FD);
511094332d3Sopenharmony_ci    omxBuffer.bufferId = BUFFER_ID_ERROR;
512094332d3Sopenharmony_ci    for (auto _ : state) {
513094332d3Sopenharmony_ci        ret = component_->FillThisBuffer(omxBuffer);
514094332d3Sopenharmony_ci        ASSERT_NE(ret, HDF_SUCCESS);
515094332d3Sopenharmony_ci    }
516094332d3Sopenharmony_ci}
517094332d3Sopenharmony_ci
518094332d3Sopenharmony_ciBENCHMARK_REGISTER_F(CodecBenchmarkOmxTest, FillThisBuffer)->
519094332d3Sopenharmony_ci    Iterations(ITERATION_FREQUENCY)->Repetitions(REPETITION_FREQUENCY)->ReportAggregatesOnly();
520094332d3Sopenharmony_ci
521094332d3Sopenharmony_ciBENCHMARK_F(CodecBenchmarkOmxTest, EmptyThisBuffer)(benchmark::State &state)
522094332d3Sopenharmony_ci{
523094332d3Sopenharmony_ci    ASSERT_TRUE(component_ != nullptr);
524094332d3Sopenharmony_ci    int32_t ret;
525094332d3Sopenharmony_ci    struct OmxCodecBuffer omxBuffer;
526094332d3Sopenharmony_ci    InitOmxCodecBuffer(omxBuffer, CODEC_BUFFER_TYPE_AVSHARE_MEM_FD);
527094332d3Sopenharmony_ci    omxBuffer.bufferId = BUFFER_ID_ERROR;
528094332d3Sopenharmony_ci    for (auto _ : state) {
529094332d3Sopenharmony_ci        ret = component_->EmptyThisBuffer(omxBuffer);
530094332d3Sopenharmony_ci        ASSERT_NE(ret, HDF_SUCCESS);
531094332d3Sopenharmony_ci    }
532094332d3Sopenharmony_ci}
533094332d3Sopenharmony_ci
534094332d3Sopenharmony_ciBENCHMARK_REGISTER_F(CodecBenchmarkOmxTest, EmptyThisBuffer)->
535094332d3Sopenharmony_ci    Iterations(ITERATION_FREQUENCY)->Repetitions(REPETITION_FREQUENCY)->ReportAggregatesOnly();
536094332d3Sopenharmony_ci
537094332d3Sopenharmony_ciBENCHMARK_F(CodecBenchmarkOmxTest, SetCallbacks)(benchmark::State &state)
538094332d3Sopenharmony_ci{
539094332d3Sopenharmony_ci    ASSERT_TRUE(component_ != nullptr);
540094332d3Sopenharmony_ci    int32_t ret;
541094332d3Sopenharmony_ci    callback_ = new CodecCallbackService();
542094332d3Sopenharmony_ci    ASSERT_TRUE(callback_ != nullptr);
543094332d3Sopenharmony_ci    for (auto _ : state) {
544094332d3Sopenharmony_ci        ret = component_->SetCallbacks(callback_, APP_DATA);
545094332d3Sopenharmony_ci        ASSERT_EQ(ret, HDF_SUCCESS);
546094332d3Sopenharmony_ci    }
547094332d3Sopenharmony_ci}
548094332d3Sopenharmony_ci
549094332d3Sopenharmony_ciBENCHMARK_REGISTER_F(CodecBenchmarkOmxTest, SetCallbacks)->
550094332d3Sopenharmony_ci    Iterations(ITERATION_FREQUENCY)->Repetitions(REPETITION_FREQUENCY)->ReportAggregatesOnly();
551094332d3Sopenharmony_ci
552094332d3Sopenharmony_ci#ifdef SUPPORT_OMX_EXTEND
553094332d3Sopenharmony_ciBENCHMARK_F(CodecBenchmarkOmxTest, ComponentRoleEnum)(benchmark::State &state)
554094332d3Sopenharmony_ci{
555094332d3Sopenharmony_ci    ASSERT_TRUE(component_ != nullptr);
556094332d3Sopenharmony_ci    int32_t ret;
557094332d3Sopenharmony_ci    std::vector<uint8_t> role;
558094332d3Sopenharmony_ci    for (auto _ : state) {
559094332d3Sopenharmony_ci        ret = component_->ComponentRoleEnum(role, CODEC_NUM);
560094332d3Sopenharmony_ci        ASSERT_EQ(ret, HDF_SUCCESS);
561094332d3Sopenharmony_ci    }
562094332d3Sopenharmony_ci}
563094332d3Sopenharmony_ci
564094332d3Sopenharmony_ciBENCHMARK_REGISTER_F(CodecBenchmarkOmxTest, ComponentRoleEnum)->
565094332d3Sopenharmony_ci    Iterations(ITERATION_FREQUENCY)->Repetitions(REPETITION_FREQUENCY)->ReportAggregatesOnly();
566094332d3Sopenharmony_ci
567094332d3Sopenharmony_ciBENCHMARK_F(CodecBenchmarkOmxTest, FreeBuffer)(benchmark::State &state)
568094332d3Sopenharmony_ci{
569094332d3Sopenharmony_ci    ASSERT_TRUE(component_ != nullptr);
570094332d3Sopenharmony_ci    std::vector<int8_t> cmdData;
571094332d3Sopenharmony_ci    auto err = component_->SendCommand(CODEC_COMMAND_STATE_SET, CODEC_STATE_IDLE, cmdData);
572094332d3Sopenharmony_ci    ASSERT_EQ(err, HDF_SUCCESS);
573094332d3Sopenharmony_ci
574094332d3Sopenharmony_ci    struct OmxCodecBuffer allocBuffer;
575094332d3Sopenharmony_ci    InitOmxCodecBuffer(allocBuffer, CODEC_BUFFER_TYPE_AVSHARE_MEM_FD);
576094332d3Sopenharmony_ci    allocBuffer.type = READ_WRITE_TYPE;
577094332d3Sopenharmony_ci    struct OmxCodecBuffer outBuffer;
578094332d3Sopenharmony_ci    for (auto _ : state) {
579094332d3Sopenharmony_ci        err = component_->AllocateBuffer(outputIndex, allocBuffer, outBuffer);
580094332d3Sopenharmony_ci        ASSERT_EQ(err, HDF_SUCCESS);
581094332d3Sopenharmony_ci        err = component_->FreeBuffer(outputIndex, outBuffer);
582094332d3Sopenharmony_ci        ASSERT_EQ(err, HDF_SUCCESS);
583094332d3Sopenharmony_ci    }
584094332d3Sopenharmony_ci}
585094332d3Sopenharmony_ci
586094332d3Sopenharmony_ciBENCHMARK_REGISTER_F(CodecBenchmarkOmxTest, FreeBuffer)->
587094332d3Sopenharmony_ci    Iterations(ITERATION_FREQUENCY)->Repetitions(REPETITION_FREQUENCY)->ReportAggregatesOnly();
588094332d3Sopenharmony_ci
589094332d3Sopenharmony_ciBENCHMARK_F(CodecBenchmarkOmxTest, ComponentDeInit)(benchmark::State &state)
590094332d3Sopenharmony_ci{
591094332d3Sopenharmony_ci    std::vector<int8_t> cmdData;
592094332d3Sopenharmony_ci    int32_t ret;
593094332d3Sopenharmony_ci    for (auto _ : state) {
594094332d3Sopenharmony_ci        if (component_ == nullptr) {
595094332d3Sopenharmony_ci            InitComponent();
596094332d3Sopenharmony_ci        }
597094332d3Sopenharmony_ci        ret = component_->SendCommand(CODEC_COMMAND_STATE_SET, CODEC_STATE_LOADED, cmdData);
598094332d3Sopenharmony_ci        ASSERT_EQ(ret, HDF_SUCCESS);
599094332d3Sopenharmony_ci        CodecStateType state = CODEC_STATE_INVALID;
600094332d3Sopenharmony_ci        do {
601094332d3Sopenharmony_ci            usleep(ITERATION_FREQUENCY);
602094332d3Sopenharmony_ci            ret = component_->GetState(state);
603094332d3Sopenharmony_ci        } while (state != CODEC_STATE_LOADED);
604094332d3Sopenharmony_ci        ret = component_->ComponentDeInit();
605094332d3Sopenharmony_ci        if (manager_ != nullptr && component_ != nullptr) {
606094332d3Sopenharmony_ci            manager_->DestroyComponent(componentId_);
607094332d3Sopenharmony_ci        }
608094332d3Sopenharmony_ci        component_ = nullptr;
609094332d3Sopenharmony_ci        ASSERT_EQ(ret, HDF_SUCCESS);
610094332d3Sopenharmony_ci    }
611094332d3Sopenharmony_ci}
612094332d3Sopenharmony_ci
613094332d3Sopenharmony_ciBENCHMARK_REGISTER_F(CodecBenchmarkOmxTest, ComponentDeInit)->
614094332d3Sopenharmony_ci    Iterations(ITERATION_FREQUENCY)->Repetitions(REPETITION_FREQUENCY)->ReportAggregatesOnly();
615094332d3Sopenharmony_ci#endif
616094332d3Sopenharmony_ci}  // namespace
617094332d3Sopenharmony_ciBENCHMARK_MAIN();
618