19762338dSopenharmony_ci/*
29762338dSopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
39762338dSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
49762338dSopenharmony_ci * you may not use this file except in compliance with the License.
59762338dSopenharmony_ci * You may obtain a copy of the License at
69762338dSopenharmony_ci *
79762338dSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0
89762338dSopenharmony_ci *
99762338dSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
109762338dSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
119762338dSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
129762338dSopenharmony_ci * See the License for the specific language governing permissions and
139762338dSopenharmony_ci * limitations under the License.
149762338dSopenharmony_ci */
159762338dSopenharmony_ci#include <benchmark/benchmark.h>
169762338dSopenharmony_ci#include <string>
179762338dSopenharmony_ci#include <vector>
189762338dSopenharmony_ci
199762338dSopenharmony_ci#include <cstdint>
209762338dSopenharmony_ci#include <cstdio>
219762338dSopenharmony_ci#include <cstdlib>
229762338dSopenharmony_ci#include <string>
239762338dSopenharmony_ci#include <unistd.h>
249762338dSopenharmony_ci#include <fcntl.h>
259762338dSopenharmony_ci#include <gtest/gtest.h>
269762338dSopenharmony_ci#include <securec.h>
279762338dSopenharmony_ci#include "osal_time.h"
289762338dSopenharmony_ci#include "hdf_log.h"
299762338dSopenharmony_ci#include "input_manager.h"
309762338dSopenharmony_ci#include "../hdi_input/common/hdi_input_test.h"
319762338dSopenharmony_ci
329762338dSopenharmony_ciusing namespace std;
339762338dSopenharmony_ciusing namespace testing::ext;
349762338dSopenharmony_ci
359762338dSopenharmony_cinamespace  {
369762338dSopenharmony_ciIInputInterface *g_inputInterface;
379762338dSopenharmony_ciInputEventCb g_callback;
389762338dSopenharmony_ciInputHostCb g_hotplugCb;
399762338dSopenharmony_cibool g_HasDev = false;
409762338dSopenharmony_ci
419762338dSopenharmony_cistatic void ReportHotPlugEventPkgCallback(const InputHotPlugEvent *msg);
429762338dSopenharmony_cistatic void ReportEventPkgCallback(const InputEventPackage **pkgs, uint32_t count, uint32_t devIndex);
439762338dSopenharmony_cistatic void CloseOnlineDev(InputDevDesc *sta, int32_t len);
449762338dSopenharmony_cistatic void OpenOnlineDev(InputDevDesc *sta, int32_t len);
459762338dSopenharmony_ci
469762338dSopenharmony_ciclass InputBenchmarkTest : public benchmark::Fixture {
479762338dSopenharmony_cipublic:
489762338dSopenharmony_ci    void SetUp(const ::benchmark::State &state);
499762338dSopenharmony_ci    void TearDown(const ::benchmark::State &state);
509762338dSopenharmony_ci};
519762338dSopenharmony_ci
529762338dSopenharmony_civoid InputBenchmarkTest::SetUp(const ::benchmark::State &state)
539762338dSopenharmony_ci{
549762338dSopenharmony_ci    int32_t ret;
559762338dSopenharmony_ci    InputDevDesc sta[MAX_DEVICES];
569762338dSopenharmony_ci    ret = memset_s(sta, MAX_DEVICES * sizeof(InputDevDesc), 0, MAX_DEVICES * sizeof(InputDevDesc));
579762338dSopenharmony_ci    if (ret != 0) {
589762338dSopenharmony_ci        HDF_LOGE("memset failed.\n");
599762338dSopenharmony_ci        return;
609762338dSopenharmony_ci    }
619762338dSopenharmony_ci    ret = GetInputInterface(&g_inputInterface);
629762338dSopenharmony_ci    if (ret != INPUT_SUCCESS) {
639762338dSopenharmony_ci        HDF_LOGE("%s: get input hdi failed, ret %d \n", __func__, ret);
649762338dSopenharmony_ci    }
659762338dSopenharmony_ci
669762338dSopenharmony_ci    g_callback.EventPkgCallback = ReportEventPkgCallback;
679762338dSopenharmony_ci    g_hotplugCb.HotPlugCallback = ReportHotPlugEventPkgCallback;
689762338dSopenharmony_ci    ret = g_inputInterface->iInputManager->ScanInputDevice(sta, MAX_DEVICES);
699762338dSopenharmony_ci    if (ret) {
709762338dSopenharmony_ci        HDF_LOGE("%s: scan device failed, ret %d \n", __func__, ret);
719762338dSopenharmony_ci    }
729762338dSopenharmony_ci    for (int32_t i = 0; i < MAX_DEVICES; i++) {
739762338dSopenharmony_ci        if (sta[i].devIndex == 0) {
749762338dSopenharmony_ci            break;
759762338dSopenharmony_ci        }
769762338dSopenharmony_ci        g_HasDev = true;
779762338dSopenharmony_ci    }
789762338dSopenharmony_ci}
799762338dSopenharmony_ci
809762338dSopenharmony_civoid InputBenchmarkTest::TearDown(const ::benchmark::State &state)
819762338dSopenharmony_ci{
829762338dSopenharmony_ci    ReleaseInputInterface(&g_inputInterface);
839762338dSopenharmony_ci}
849762338dSopenharmony_ci
859762338dSopenharmony_cistatic void ReportEventPkgCallback(const InputEventPackage **pkgs, uint32_t count, uint32_t devIndex)
869762338dSopenharmony_ci{
879762338dSopenharmony_ci    if (pkgs == nullptr) {
889762338dSopenharmony_ci        return;
899762338dSopenharmony_ci    }
909762338dSopenharmony_ci    for (int32_t i = 0; i < count; i++) {
919762338dSopenharmony_ci        printf("%s: pkgs[%d] = 0x%x, 0x%x, %d\n", __func__, i, pkgs[i]->type, pkgs[i]->code, pkgs[i]->value);
929762338dSopenharmony_ci        EXPECT_GE(pkgs[i]->type, 0);
939762338dSopenharmony_ci        EXPECT_GE(pkgs[i]->code, 0);
949762338dSopenharmony_ci        EXPECT_GE(pkgs[i]->value, 0);
959762338dSopenharmony_ci    }
969762338dSopenharmony_ci}
979762338dSopenharmony_ci
989762338dSopenharmony_cistatic void ReportHotPlugEventPkgCallback(const InputHotPlugEvent *msg)
999762338dSopenharmony_ci{
1009762338dSopenharmony_ci    int32_t ret;
1019762338dSopenharmony_ci    if (msg == nullptr) {
1029762338dSopenharmony_ci        return;
1039762338dSopenharmony_ci    }
1049762338dSopenharmony_ci    HDF_LOGI("%s: status =%d devId=%d type =%d \n", __func__, msg->status, msg->devIndex, msg->devType);
1059762338dSopenharmony_ci    EXPECT_GE(msg->status, 0);
1069762338dSopenharmony_ci    EXPECT_GE(msg->devIndex, 0);
1079762338dSopenharmony_ci    EXPECT_GE(msg->devType, 0);
1089762338dSopenharmony_ci
1099762338dSopenharmony_ci    if (msg->status == 0) {
1109762338dSopenharmony_ci        ret = g_inputInterface->iInputManager->OpenInputDevice(msg->devIndex);
1119762338dSopenharmony_ci        if (ret) {
1129762338dSopenharmony_ci            HDF_LOGE("%s: open device[%u] failed, ret %d \n", __func__, msg->devIndex, ret);
1139762338dSopenharmony_ci        }
1149762338dSopenharmony_ci
1159762338dSopenharmony_ci        ret  = g_inputInterface->iInputReporter->RegisterReportCallback(msg->devIndex, &g_callback);
1169762338dSopenharmony_ci        if (ret) {
1179762338dSopenharmony_ci            HDF_LOGE("%s: register callback failed for device[%d], ret %d \n", __func__, msg->devIndex, ret);
1189762338dSopenharmony_ci        }
1199762338dSopenharmony_ci    } else {
1209762338dSopenharmony_ci        ret = g_inputInterface->iInputReporter->UnregisterReportCallback(msg->devIndex);
1219762338dSopenharmony_ci        if (ret) {
1229762338dSopenharmony_ci            HDF_LOGE("%s: unregister callback failed, ret %d \n", __func__, ret);
1239762338dSopenharmony_ci        }
1249762338dSopenharmony_ci
1259762338dSopenharmony_ci        ret = g_inputInterface->iInputManager->CloseInputDevice(msg->devIndex);
1269762338dSopenharmony_ci        if (ret) {
1279762338dSopenharmony_ci            HDF_LOGE("%s: close device failed, ret %d \n", __func__, ret);
1289762338dSopenharmony_ci        }
1299762338dSopenharmony_ci    }
1309762338dSopenharmony_ci}
1319762338dSopenharmony_ci
1329762338dSopenharmony_cistatic void OpenOnlineDev(InputDevDesc *sta, int32_t len)
1339762338dSopenharmony_ci{
1349762338dSopenharmony_ci    int32_t ret = g_inputInterface->iInputManager->ScanInputDevice(sta, len);
1359762338dSopenharmony_ci    if (ret) {
1369762338dSopenharmony_ci        HDF_LOGE("%s: scan device failed, ret %d \n", __func__, ret);
1379762338dSopenharmony_ci    }
1389762338dSopenharmony_ci    ASSERT_EQ(ret, INPUT_SUCCESS);
1399762338dSopenharmony_ci
1409762338dSopenharmony_ci    for (int32_t i = 0; i < len; i++) {
1419762338dSopenharmony_ci        if (sta[i].devIndex == 0) {
1429762338dSopenharmony_ci            break;
1439762338dSopenharmony_ci        }
1449762338dSopenharmony_ci        ret = g_inputInterface->iInputManager->OpenInputDevice(sta[i].devIndex);
1459762338dSopenharmony_ci        if (ret) {
1469762338dSopenharmony_ci            HDF_LOGE("%s: open device[%d] failed, ret %d \n", __func__, sta[i].devIndex, ret);
1479762338dSopenharmony_ci        }
1489762338dSopenharmony_ci        ASSERT_EQ(ret, INPUT_SUCCESS);
1499762338dSopenharmony_ci
1509762338dSopenharmony_ci        ret  = g_inputInterface->iInputReporter->RegisterReportCallback(sta[i].devIndex, &g_callback);
1519762338dSopenharmony_ci        if (ret) {
1529762338dSopenharmony_ci            HDF_LOGE("%s: register callback failed for device[%d], ret %d \n", __func__, sta[i].devIndex, ret);
1539762338dSopenharmony_ci        }
1549762338dSopenharmony_ci        ASSERT_EQ(ret, INPUT_SUCCESS);
1559762338dSopenharmony_ci    }
1569762338dSopenharmony_ci}
1579762338dSopenharmony_ci
1589762338dSopenharmony_cistatic void CloseOnlineDev(InputDevDesc *sta, int32_t len)
1599762338dSopenharmony_ci{
1609762338dSopenharmony_ci    int32_t ret = g_inputInterface->iInputManager->ScanInputDevice(sta, len);
1619762338dSopenharmony_ci    if (ret) {
1629762338dSopenharmony_ci        HDF_LOGE("%s: scan device failed, ret %d \n", __func__, ret);
1639762338dSopenharmony_ci    }
1649762338dSopenharmony_ci    ASSERT_EQ(ret, INPUT_SUCCESS);
1659762338dSopenharmony_ci
1669762338dSopenharmony_ci    for (int32_t i = 0; i < len; i++) {
1679762338dSopenharmony_ci        if (sta[i].devIndex == 0) {
1689762338dSopenharmony_ci            break;
1699762338dSopenharmony_ci        }
1709762338dSopenharmony_ci        ret = g_inputInterface->iInputReporter->UnregisterReportCallback(sta[i].devIndex);
1719762338dSopenharmony_ci        if (ret) {
1729762338dSopenharmony_ci            HDF_LOGE("%s: register callback failed for device[%d], ret %d \n", __func__, sta[i].devIndex, ret);
1739762338dSopenharmony_ci        }
1749762338dSopenharmony_ci        ASSERT_EQ(ret, INPUT_SUCCESS);
1759762338dSopenharmony_ci
1769762338dSopenharmony_ci        ret = g_inputInterface->iInputManager->CloseInputDevice(sta[i].devIndex);
1779762338dSopenharmony_ci        if (ret) {
1789762338dSopenharmony_ci            HDF_LOGE("%s: close device[%d] failed, ret %d \n", __func__, sta[i].devIndex, ret);
1799762338dSopenharmony_ci        }
1809762338dSopenharmony_ci        ASSERT_EQ(ret, INPUT_SUCCESS);
1819762338dSopenharmony_ci    }
1829762338dSopenharmony_ci}
1839762338dSopenharmony_ci
1849762338dSopenharmony_ci/**
1859762338dSopenharmony_ci  * @tc.number: SUB_Driver_Input_HdiPerformance_0900
1869762338dSopenharmony_ci  * @tc.name: open input device for ap mode benchmark test
1879762338dSopenharmony_ci  * @tc.desc: [C- SOFTWARE -0010]
1889762338dSopenharmony_ci  * @tc.size: Medium
1899762338dSopenharmony_ci  * @tc.level: level 2
1909762338dSopenharmony_ci  */
1919762338dSopenharmony_ciBENCHMARK_F(InputBenchmarkTest, ScanInputDevice)(benchmark::State &st)
1929762338dSopenharmony_ci{
1939762338dSopenharmony_ci    InputDevDesc sta[MAX_DEVICES];
1949762338dSopenharmony_ci
1959762338dSopenharmony_ci    HDF_LOGI("%s: [Input] RegisterCallbackAndReportData001 enter \n", __func__);
1969762338dSopenharmony_ci    int32_t ret;
1979762338dSopenharmony_ci
1989762338dSopenharmony_ci    INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
1999762338dSopenharmony_ci    INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
2009762338dSopenharmony_ci    for (auto _ : st) {
2019762338dSopenharmony_ci        ret = g_inputInterface->iInputManager->ScanInputDevice(sta, sizeof(sta)/sizeof(InputDevDesc));
2029762338dSopenharmony_ci    }
2039762338dSopenharmony_ci    EXPECT_EQ(HDF_SUCCESS, ret);
2049762338dSopenharmony_ci}
2059762338dSopenharmony_ciBENCHMARK_REGISTER_F(InputBenchmarkTest, ScanInputDevice)->Iterations(100)->
2069762338dSopenharmony_ci    Repetitions(3)->ReportAggregatesOnly();
2079762338dSopenharmony_ci
2089762338dSopenharmony_ci/**
2099762338dSopenharmony_ci  * @tc.number: SUB_Driver_Input_HdiPerformance_0500
2109762338dSopenharmony_ci  * @tc.name: open input device for ap mode benchmark test
2119762338dSopenharmony_ci  * @tc.desc: [C- SOFTWARE -0010]
2129762338dSopenharmony_ci  * @tc.size: Medium
2139762338dSopenharmony_ci  * @tc.level: level 2
2149762338dSopenharmony_ci  */
2159762338dSopenharmony_ciBENCHMARK_F(InputBenchmarkTest, RegisterHotPlugCallback)(benchmark::State &st)
2169762338dSopenharmony_ci{
2179762338dSopenharmony_ci    HDF_LOGI("%s: [Input] HotPlugCallback Testcase enter\n", __func__);
2189762338dSopenharmony_ci    InputDevDesc sta[MAX_DEVICES];
2199762338dSopenharmony_ci
2209762338dSopenharmony_ci    int32_t ret = memset_s(sta, sizeof(sta), 0, sizeof(sta));
2219762338dSopenharmony_ci    if (ret != 0) {
2229762338dSopenharmony_ci        HDF_LOGE("%s: memcpy failed, line %d\n", __func__, __LINE__);
2239762338dSopenharmony_ci    }
2249762338dSopenharmony_ci
2259762338dSopenharmony_ci    INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
2269762338dSopenharmony_ci    INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputReporter, INPUT_NULL_PTR);
2279762338dSopenharmony_ci    INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
2289762338dSopenharmony_ci    for (auto _ : st) {
2299762338dSopenharmony_ci        ret = g_inputInterface->iInputReporter->RegisterHotPlugCallback(&g_hotplugCb);
2309762338dSopenharmony_ci    }
2319762338dSopenharmony_ci    if (ret) {
2329762338dSopenharmony_ci        HDF_LOGE("%s: register hotplug callback failed for device manager, ret %d\n", __func__, ret);
2339762338dSopenharmony_ci    }
2349762338dSopenharmony_ci    ASSERT_EQ(ret, INPUT_SUCCESS);
2359762338dSopenharmony_ci
2369762338dSopenharmony_ci    OpenOnlineDev(sta, MAX_DEVICES);
2379762338dSopenharmony_ci
2389762338dSopenharmony_ci    OsalMSleep(KEEP_ALIVE_TIME_MS);
2399762338dSopenharmony_ci
2409762338dSopenharmony_ci    ret = memset_s(sta, sizeof(sta), 0, sizeof(sta));
2419762338dSopenharmony_ci    if (ret != 0) {
2429762338dSopenharmony_ci        HDF_LOGE("%s: memcpy failed, line %d\n", __func__, __LINE__);
2439762338dSopenharmony_ci    }
2449762338dSopenharmony_ci
2459762338dSopenharmony_ci    CloseOnlineDev(sta, MAX_DEVICES);
2469762338dSopenharmony_ci
2479762338dSopenharmony_ci    ret = g_inputInterface->iInputReporter->UnregisterHotPlugCallback();
2489762338dSopenharmony_ci    if (ret) {
2499762338dSopenharmony_ci        HDF_LOGE("%s: unregister hotplug callback failed for device manager, ret %d\n", __func__, ret);
2509762338dSopenharmony_ci    }
2519762338dSopenharmony_ci    EXPECT_EQ(ret, INPUT_SUCCESS);
2529762338dSopenharmony_ci}
2539762338dSopenharmony_ciBENCHMARK_REGISTER_F(InputBenchmarkTest, RegisterHotPlugCallback)->Iterations(100)->
2549762338dSopenharmony_ci    Repetitions(3)->ReportAggregatesOnly();
2559762338dSopenharmony_ci
2569762338dSopenharmony_ci/**
2579762338dSopenharmony_ci  * @tc.number: SUB_Driver_Input_HdiPerformance_1000
2589762338dSopenharmony_ci  * @tc.name: open input device for ap mode benchmark test
2599762338dSopenharmony_ci  * @tc.desc: [C- SOFTWARE -0010]
2609762338dSopenharmony_ci  * @tc.size: Medium
2619762338dSopenharmony_ci  * @tc.level: level 2
2629762338dSopenharmony_ci  */
2639762338dSopenharmony_ciBENCHMARK_F(InputBenchmarkTest, UnregisterHotPlugCallback)(benchmark::State &st)
2649762338dSopenharmony_ci{
2659762338dSopenharmony_ci    HDF_LOGI("%s: [Input] HotPlugCallback Testcase enter\n", __func__);
2669762338dSopenharmony_ci    InputDevDesc sta[MAX_DEVICES];
2679762338dSopenharmony_ci
2689762338dSopenharmony_ci    int32_t ret = memset_s(sta, sizeof(sta), 0, sizeof(sta));
2699762338dSopenharmony_ci    if (ret != 0) {
2709762338dSopenharmony_ci        HDF_LOGE("%s: memcpy failed, line %d\n", __func__, __LINE__);
2719762338dSopenharmony_ci    }
2729762338dSopenharmony_ci
2739762338dSopenharmony_ci    INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
2749762338dSopenharmony_ci    INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputReporter, INPUT_NULL_PTR);
2759762338dSopenharmony_ci    INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
2769762338dSopenharmony_ci    ret = g_inputInterface->iInputReporter->RegisterHotPlugCallback(&g_hotplugCb);
2779762338dSopenharmony_ci    if (ret) {
2789762338dSopenharmony_ci        HDF_LOGE("%s: register hotplug callback failed for device manager, ret %d\n", __func__, ret);
2799762338dSopenharmony_ci    }
2809762338dSopenharmony_ci    ASSERT_EQ(ret, INPUT_SUCCESS);
2819762338dSopenharmony_ci
2829762338dSopenharmony_ci    OpenOnlineDev(sta, MAX_DEVICES);
2839762338dSopenharmony_ci
2849762338dSopenharmony_ci    OsalMSleep(KEEP_ALIVE_TIME_MS);
2859762338dSopenharmony_ci
2869762338dSopenharmony_ci    ret = memset_s(sta, sizeof(sta), 0, sizeof(sta));
2879762338dSopenharmony_ci    if (ret != 0) {
2889762338dSopenharmony_ci        HDF_LOGE("%s: memcpy failed, line %d\n", __func__, __LINE__);
2899762338dSopenharmony_ci    }
2909762338dSopenharmony_ci
2919762338dSopenharmony_ci    CloseOnlineDev(sta, MAX_DEVICES);
2929762338dSopenharmony_ci
2939762338dSopenharmony_ci    for (auto _ : st) {
2949762338dSopenharmony_ci        ret = g_inputInterface->iInputReporter->UnregisterHotPlugCallback();
2959762338dSopenharmony_ci    }
2969762338dSopenharmony_ci    if (ret) {
2979762338dSopenharmony_ci        HDF_LOGE("%s: unregister hotplug callback failed for device manager, ret %d\n", __func__, ret);
2989762338dSopenharmony_ci    }
2999762338dSopenharmony_ci    EXPECT_EQ(ret, INPUT_SUCCESS);
3009762338dSopenharmony_ci}
3019762338dSopenharmony_ciBENCHMARK_REGISTER_F(InputBenchmarkTest, UnregisterHotPlugCallback)->Iterations(100)->
3029762338dSopenharmony_ci    Repetitions(3)->ReportAggregatesOnly();
3039762338dSopenharmony_ci
3049762338dSopenharmony_ci
3059762338dSopenharmony_ci/**
3069762338dSopenharmony_ci  * @tc.number: SUB_Driver_Input_HdiPerformance_0400
3079762338dSopenharmony_ci  * @tc.name: open input device for ap mode benchmark test
3089762338dSopenharmony_ci  * @tc.desc: [C- SOFTWARE -0010]
3099762338dSopenharmony_ci  * @tc.size: Medium
3109762338dSopenharmony_ci  * @tc.level: level 2
3119762338dSopenharmony_ci  */
3129762338dSopenharmony_ci
3139762338dSopenharmony_ciBENCHMARK_F(InputBenchmarkTest, OpenInputDevice)(benchmark::State &st)
3149762338dSopenharmony_ci{
3159762338dSopenharmony_ci    ASSERT_EQ(g_HasDev, true);
3169762338dSopenharmony_ci    INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
3179762338dSopenharmony_ci    INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
3189762338dSopenharmony_ci    int32_t ret;
3199762338dSopenharmony_ci    for (auto _ : st) {
3209762338dSopenharmony_ci        ret = g_inputInterface->iInputManager->OpenInputDevice(TOUCH_INDEX);
3219762338dSopenharmony_ci    }
3229762338dSopenharmony_ci    ret = 0;
3239762338dSopenharmony_ci    ASSERT_EQ(ret, INPUT_SUCCESS);
3249762338dSopenharmony_ci    ret = g_inputInterface->iInputManager->CloseInputDevice(TOUCH_INDEX);
3259762338dSopenharmony_ci}
3269762338dSopenharmony_ciBENCHMARK_REGISTER_F(InputBenchmarkTest, OpenInputDevice)->Iterations(100)->
3279762338dSopenharmony_ci    Repetitions(3)->ReportAggregatesOnly();
3289762338dSopenharmony_ci
3299762338dSopenharmony_ci/**
3309762338dSopenharmony_ci  * @tc.number: SUB_Driver_Input_HdiPerformance_0100
3319762338dSopenharmony_ci  * @tc.name: close input device for ap mode benchmark test
3329762338dSopenharmony_ci  * @tc.desc: [C- SOFTWARE -0010]
3339762338dSopenharmony_ci  * @tc.size: Medium
3349762338dSopenharmony_ci  * @tc.level: level 2
3359762338dSopenharmony_ci  */
3369762338dSopenharmony_ciBENCHMARK_F(InputBenchmarkTest, CloseInputDevice)(
3379762338dSopenharmony_ci    benchmark::State &st)
3389762338dSopenharmony_ci{
3399762338dSopenharmony_ci    ASSERT_EQ(g_HasDev, true);
3409762338dSopenharmony_ci    int32_t ret = 0;
3419762338dSopenharmony_ci    g_inputInterface->iInputManager->OpenInputDevice(TOUCH_INDEX);
3429762338dSopenharmony_ci    EXPECT_EQ(ret, INPUT_SUCCESS);
3439762338dSopenharmony_ci    for (auto _ : st) {
3449762338dSopenharmony_ci        ret = g_inputInterface->iInputManager->CloseInputDevice(TOUCH_INDEX);
3459762338dSopenharmony_ci    }
3469762338dSopenharmony_ci}
3479762338dSopenharmony_ciBENCHMARK_REGISTER_F(InputBenchmarkTest, CloseInputDevice)->Iterations(100)->
3489762338dSopenharmony_ci    Repetitions(3)->ReportAggregatesOnly();
3499762338dSopenharmony_ci
3509762338dSopenharmony_ci
3519762338dSopenharmony_ci/**
3529762338dSopenharmony_ci  * @tc.number: SUB_Driver_Input_HdiPerformance_0600
3539762338dSopenharmony_ci  * @tc.name: get input device id for ap mode benchmark test
3549762338dSopenharmony_ci  * @tc.desc: [C- SOFTWARE -0010]
3559762338dSopenharmony_ci  * @tc.size: Medium
3569762338dSopenharmony_ci  * @tc.level: level 2
3579762338dSopenharmony_ci  */
3589762338dSopenharmony_ciBENCHMARK_F(InputBenchmarkTest, GetInputDevice)(benchmark::State &st)
3599762338dSopenharmony_ci{
3609762338dSopenharmony_ci    ASSERT_EQ(g_HasDev, true);
3619762338dSopenharmony_ci    int32_t ret = 0;
3629762338dSopenharmony_ci    InputDeviceInfo *dev = nullptr;
3639762338dSopenharmony_ci    INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
3649762338dSopenharmony_ci    INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
3659762338dSopenharmony_ci
3669762338dSopenharmony_ci    ret = g_inputInterface->iInputManager->OpenInputDevice(TOUCH_INDEX);
3679762338dSopenharmony_ci    if (ret) {
3689762338dSopenharmony_ci        HDF_LOGE("%s: open device1 failed, ret %d\n", __func__, ret);
3699762338dSopenharmony_ci    }
3709762338dSopenharmony_ci    ASSERT_EQ(ret, INPUT_SUCCESS);
3719762338dSopenharmony_ci    for (auto _ : st) {
3729762338dSopenharmony_ci        ret = g_inputInterface->iInputManager->GetInputDevice(TOUCH_INDEX, &dev);
3739762338dSopenharmony_ci    }
3749762338dSopenharmony_ci    EXPECT_EQ(ret, INPUT_SUCCESS);
3759762338dSopenharmony_ci    EXPECT_EQ((uint32_t)TOUCH_INDEX, dev->devIndex);
3769762338dSopenharmony_ci    HDF_LOGI("devindex = %u, devType = %u\n", dev->devIndex, dev->devType);
3779762338dSopenharmony_ci    HDF_LOGI("chipInfo = %s, VendorName = %s,chipName = %s\n", dev->chipInfo, dev->vendorName, dev->chipName);
3789762338dSopenharmony_ci}
3799762338dSopenharmony_ciBENCHMARK_REGISTER_F(InputBenchmarkTest, GetInputDevice)->Iterations(100)->
3809762338dSopenharmony_ci    Repetitions(3)->ReportAggregatesOnly();
3819762338dSopenharmony_ci
3829762338dSopenharmony_ci/**
3839762338dSopenharmony_ci  * @tc.number: SUB_Driver_Input_HdiPerformance_0700
3849762338dSopenharmony_ci  * @tc.name: get input device list info test
3859762338dSopenharmony_ci  * @tc.desc: [C- SOFTWARE -0010]
3869762338dSopenharmony_ci  * @tc.size: Medium
3879762338dSopenharmony_ci  * @tc.level: level 2
3889762338dSopenharmony_ci  */
3899762338dSopenharmony_ciBENCHMARK_F(InputBenchmarkTest, GetInputDeviceList)(
3909762338dSopenharmony_ci    benchmark::State &st)
3919762338dSopenharmony_ci{
3929762338dSopenharmony_ci    ASSERT_EQ(g_HasDev, true);
3939762338dSopenharmony_ci    int32_t ret;
3949762338dSopenharmony_ci    uint32_t num = 0;
3959762338dSopenharmony_ci    InputDeviceInfo *dev[MAX_INPUT_DEV_NUM] = {0};
3969762338dSopenharmony_ci
3979762338dSopenharmony_ci    for (auto _ : st) {
3989762338dSopenharmony_ci        ret = g_inputInterface->iInputManager->GetInputDeviceList(&num, dev, MAX_INPUT_DEV_NUM);
3999762338dSopenharmony_ci    }
4009762338dSopenharmony_ci    EXPECT_EQ(ret, INPUT_SUCCESS);
4019762338dSopenharmony_ci    ASSERT_LE(num, (uint32_t)MAX_INPUT_DEV_NUM);
4029762338dSopenharmony_ci    for (uint32_t i = 0; i < num; i++) {
4039762338dSopenharmony_ci        HDF_LOGI("num = %u,device[%d]'s info is :\n", num, i);
4049762338dSopenharmony_ci        HDF_LOGI("index = %u, devType = %u\n", dev[i]->devIndex, dev[i]->devType);
4059762338dSopenharmony_ci        HDF_LOGI("chipInfo = %s, VendorName = %s,chipName = %s\n", dev[i]->chipInfo, dev[i]->vendorName,
4069762338dSopenharmony_ci            dev[i]->chipName);
4079762338dSopenharmony_ci        EXPECT_LE(0, dev[i]->devType);
4089762338dSopenharmony_ci    }
4099762338dSopenharmony_ci}
4109762338dSopenharmony_ciBENCHMARK_REGISTER_F(InputBenchmarkTest, GetInputDeviceList)->Iterations(100)->
4119762338dSopenharmony_ci    Repetitions(3)->ReportAggregatesOnly();
4129762338dSopenharmony_ci
4139762338dSopenharmony_ci/**
4149762338dSopenharmony_ci  * @tc.number: SUB_Driver_Input_HdiPerformance_0800
4159762338dSopenharmony_ci  * @tc.name: get input device type test for ap mode benchmark test
4169762338dSopenharmony_ci  * @tc.desc: [C- SOFTWARE -0010]
4179762338dSopenharmony_ci  * @tc.size: Medium
4189762338dSopenharmony_ci  * @tc.level: level 2
4199762338dSopenharmony_ci  */
4209762338dSopenharmony_ciBENCHMARK_F(InputBenchmarkTest, GetDeviceType)(benchmark::State &st)
4219762338dSopenharmony_ci{
4229762338dSopenharmony_ci    ASSERT_EQ(g_HasDev, true);
4239762338dSopenharmony_ci    int32_t ret;
4249762338dSopenharmony_ci    uint32_t devType = INIT_DEFAULT_VALUE;
4259762338dSopenharmony_ci
4269762338dSopenharmony_ci    for (auto _ : st) {
4279762338dSopenharmony_ci        ret = g_inputInterface->iInputController->GetDeviceType(TOUCH_INDEX, &devType);
4289762338dSopenharmony_ci    }
4299762338dSopenharmony_ci}
4309762338dSopenharmony_ciBENCHMARK_REGISTER_F(InputBenchmarkTest, GetDeviceType)->Iterations(100)->
4319762338dSopenharmony_ci    Repetitions(3)->ReportAggregatesOnly();
4329762338dSopenharmony_ci
4339762338dSopenharmony_ci/**
4349762338dSopenharmony_ci  * @tc.number: SUB_Driver_Input_HdiPerformance_0200
4359762338dSopenharmony_ci  * @tc.name: get input device chip info for ap mode benchmark test
4369762338dSopenharmony_ci  * @tc.desc: [C- SOFTWARE -0010]
4379762338dSopenharmony_ci  * @tc.size: Medium
4389762338dSopenharmony_ci  * @tc.level: level 2
4399762338dSopenharmony_ci  */
4409762338dSopenharmony_ciBENCHMARK_F(InputBenchmarkTest, GetChipInfo)(benchmark::State &st)
4419762338dSopenharmony_ci{
4429762338dSopenharmony_ci    ASSERT_EQ(g_HasDev, true);
4439762338dSopenharmony_ci    int32_t ret;
4449762338dSopenharmony_ci    char chipInfo[CHIP_INFO_LEN] = {0};
4459762338dSopenharmony_ci
4469762338dSopenharmony_ci    for (auto _ : st) {
4479762338dSopenharmony_ci        ret = g_inputInterface->iInputController->GetChipInfo(TOUCH_INDEX, chipInfo, CHIP_INFO_LEN);
4489762338dSopenharmony_ci    }
4499762338dSopenharmony_ci    HDF_LOGI("device's chip info is %s\n", chipInfo);
4509762338dSopenharmony_ci}
4519762338dSopenharmony_ciBENCHMARK_REGISTER_F(InputBenchmarkTest, GetChipInfo)->Iterations(100)->
4529762338dSopenharmony_ci    Repetitions(3)->ReportAggregatesOnly();
4539762338dSopenharmony_ci
4549762338dSopenharmony_ci/**
4559762338dSopenharmony_ci  * @tc.number: SUB_Driver_Input_HdiPerformance_1300
4569762338dSopenharmony_ci  * @tc.name: set device power status for ap mode benchmark test
4579762338dSopenharmony_ci  * @tc.desc: [C- SOFTWARE -0010]
4589762338dSopenharmony_ci  * @tc.size: Medium
4599762338dSopenharmony_ci  * @tc.level: level 2
4609762338dSopenharmony_ci  */
4619762338dSopenharmony_ciBENCHMARK_F(InputBenchmarkTest, SetPowerStatus)(benchmark::State &st)
4629762338dSopenharmony_ci{
4639762338dSopenharmony_ci    ASSERT_EQ(g_HasDev, true);
4649762338dSopenharmony_ci    int32_t ret;
4659762338dSopenharmony_ci    uint32_t setStatus = INPUT_LOW_POWER;
4669762338dSopenharmony_ci    uint32_t getStatus = 0;
4679762338dSopenharmony_ci
4689762338dSopenharmony_ci    for (auto _ : st) {
4699762338dSopenharmony_ci        ret = g_inputInterface->iInputController->SetPowerStatus(TOUCH_INDEX, setStatus);
4709762338dSopenharmony_ci    }
4719762338dSopenharmony_ci    ret = g_inputInterface->iInputController->GetPowerStatus(TOUCH_INDEX, &getStatus);
4729762338dSopenharmony_ci}
4739762338dSopenharmony_ciBENCHMARK_REGISTER_F(InputBenchmarkTest, SetPowerStatus)->Iterations(100)->
4749762338dSopenharmony_ci    Repetitions(3)->ReportAggregatesOnly();
4759762338dSopenharmony_ci
4769762338dSopenharmony_ci/**
4779762338dSopenharmony_ci  * @tc.number: SUB_Driver_Input_HdiPerformance_1100
4789762338dSopenharmony_ci  * @tc.name: get device poewr status for ap mode benchmark test
4799762338dSopenharmony_ci  * @tc.desc: [C- SOFTWARE -0010]
4809762338dSopenharmony_ci  * @tc.size: Medium
4819762338dSopenharmony_ci  * @tc.level: level 2
4829762338dSopenharmony_ci  */
4839762338dSopenharmony_ciBENCHMARK_F(InputBenchmarkTest, GetPowerStatus)(benchmark::State &st)
4849762338dSopenharmony_ci{
4859762338dSopenharmony_ci    ASSERT_EQ(g_HasDev, true);
4869762338dSopenharmony_ci    int32_t ret;
4879762338dSopenharmony_ci    uint32_t setStatus = INPUT_RESUME;
4889762338dSopenharmony_ci    uint32_t getStatus = 0;
4899762338dSopenharmony_ci
4909762338dSopenharmony_ci    ret = g_inputInterface->iInputController->SetPowerStatus(TOUCH_INDEX, setStatus);
4919762338dSopenharmony_ci    for (auto _ : st) {
4929762338dSopenharmony_ci        ret = g_inputInterface->iInputController->GetPowerStatus(TOUCH_INDEX, &getStatus);
4939762338dSopenharmony_ci        }
4949762338dSopenharmony_ci    ASSERT_EQ(setStatus, getStatus);
4959762338dSopenharmony_ci}
4969762338dSopenharmony_ciBENCHMARK_REGISTER_F(InputBenchmarkTest, GetPowerStatus)->Iterations(100)->
4979762338dSopenharmony_ci    Repetitions(3)->ReportAggregatesOnly();
4989762338dSopenharmony_ci
4999762338dSopenharmony_ci/**
5009762338dSopenharmony_ci  * @tc.number: SUB_Driver_Input_HdiPerformance_1200
5019762338dSopenharmony_ci  * @tc.name: get device vendor name for ap mode benchmark test
5029762338dSopenharmony_ci  * @tc.desc: [C- SOFTWARE -0010]
5039762338dSopenharmony_ci  * @tc.size: Medium
5049762338dSopenharmony_ci  * @tc.level: level 2
5059762338dSopenharmony_ci  */
5069762338dSopenharmony_ciBENCHMARK_F(InputBenchmarkTest, GetVendorName)(benchmark::State &st)
5079762338dSopenharmony_ci{
5089762338dSopenharmony_ci    ASSERT_EQ(g_HasDev, true);
5099762338dSopenharmony_ci    int32_t ret;
5109762338dSopenharmony_ci    char vendorName[VENDOR_NAME_LEN] = {0};
5119762338dSopenharmony_ci
5129762338dSopenharmony_ci    for (auto _ : st) {
5139762338dSopenharmony_ci        ret = g_inputInterface->iInputController->GetVendorName(TOUCH_INDEX, vendorName, VENDOR_NAME_LEN);
5149762338dSopenharmony_ci    }
5159762338dSopenharmony_ci    HDF_LOGI("device1's vendor name is %s:\n", vendorName);
5169762338dSopenharmony_ci}
5179762338dSopenharmony_ciBENCHMARK_REGISTER_F(InputBenchmarkTest, GetVendorName)->Iterations(100)->
5189762338dSopenharmony_ci    Repetitions(3)->ReportAggregatesOnly();
5199762338dSopenharmony_ci
5209762338dSopenharmony_ci/**
5219762338dSopenharmony_ci  * @tc.number: SUB_Driver_Input_HdiPerformance_0300
5229762338dSopenharmony_ci  * @tc.name: get device chip name for ap mode benchmark test
5239762338dSopenharmony_ci  * @tc.desc: [C- SOFTWARE -0010]
5249762338dSopenharmony_ci  * @tc.size: Medium
5259762338dSopenharmony_ci  * @tc.level: level 2
5269762338dSopenharmony_ci  */
5279762338dSopenharmony_ciBENCHMARK_F(InputBenchmarkTest, GetChipName)(benchmark::State &st)
5289762338dSopenharmony_ci{
5299762338dSopenharmony_ci    ASSERT_EQ(g_HasDev, true);
5309762338dSopenharmony_ci    int32_t ret;
5319762338dSopenharmony_ci    char chipName[CHIP_NAME_LEN] = {0};
5329762338dSopenharmony_ci
5339762338dSopenharmony_ci    for (auto _ : st) {
5349762338dSopenharmony_ci        ret = g_inputInterface->iInputController->GetChipName(TOUCH_INDEX, chipName, CHIP_NAME_LEN);
5359762338dSopenharmony_ci    }
5369762338dSopenharmony_ci    HDF_LOGI("device1's vendor name is %s:\n", chipName);
5379762338dSopenharmony_ci}
5389762338dSopenharmony_ciBENCHMARK_REGISTER_F(InputBenchmarkTest, GetChipName)->Iterations(100)->
5399762338dSopenharmony_ci    Repetitions(3)->ReportAggregatesOnly();
5409762338dSopenharmony_ci
5419762338dSopenharmony_ci/**
5429762338dSopenharmony_ci  * @tc.number: SUB_Driver_Input_HdiPerformance_1400
5439762338dSopenharmony_ci  * @tc.name: set device gesture mode for ap mode benchmark test
5449762338dSopenharmony_ci  * @tc.desc: [C- SOFTWARE -0010]
5459762338dSopenharmony_ci  * @tc.size: Medium
5469762338dSopenharmony_ci  * @tc.level: level 2
5479762338dSopenharmony_ci  */
5489762338dSopenharmony_ciBENCHMARK_F(InputBenchmarkTest, SetGestureMode)(benchmark::State &st)
5499762338dSopenharmony_ci{
5509762338dSopenharmony_ci    ASSERT_EQ(g_HasDev, true);
5519762338dSopenharmony_ci    int32_t ret;
5529762338dSopenharmony_ci    uint32_t gestureMode = 1;
5539762338dSopenharmony_ci
5549762338dSopenharmony_ci    for (auto _ : st) {
5559762338dSopenharmony_ci        ret = g_inputInterface->iInputController->SetGestureMode(TOUCH_INDEX, gestureMode);
5569762338dSopenharmony_ci    }
5579762338dSopenharmony_ci}
5589762338dSopenharmony_ciBENCHMARK_REGISTER_F(InputBenchmarkTest, SetGestureMode)->Iterations(100)->
5599762338dSopenharmony_ci    Repetitions(3)->ReportAggregatesOnly();
5609762338dSopenharmony_ci
5619762338dSopenharmony_ci/**
5629762338dSopenharmony_ci  * @tc.number: SUB_Driver_Input_HdiPerformance_1500
5639762338dSopenharmony_ci  * @tc.name: Run Capacitance for ap mode benchmark test
5649762338dSopenharmony_ci  * @tc.desc: [C- SOFTWARE -0010]
5659762338dSopenharmony_ci  * @tc.size: Medium
5669762338dSopenharmony_ci  * @tc.level: level 2
5679762338dSopenharmony_ci  */
5689762338dSopenharmony_ciBENCHMARK_F(InputBenchmarkTest, RunCapacitanceTest)(benchmark::State &st)
5699762338dSopenharmony_ci{
5709762338dSopenharmony_ci    ASSERT_EQ(g_HasDev, true);
5719762338dSopenharmony_ci    int32_t ret;
5729762338dSopenharmony_ci    uint32_t testType = MMI_TEST;
5739762338dSopenharmony_ci    char result[MAX_INPUT_DEV_NUM] = {0};
5749762338dSopenharmony_ci
5759762338dSopenharmony_ci    for (auto _ : st) {
5769762338dSopenharmony_ci        ret = g_inputInterface->iInputController->RunCapacitanceTest(TOUCH_INDEX, testType, result, MAX_INPUT_DEV_NUM);
5779762338dSopenharmony_ci    }
5789762338dSopenharmony_ci}
5799762338dSopenharmony_ciBENCHMARK_REGISTER_F(InputBenchmarkTest, RunCapacitanceTest)->Iterations(100)->
5809762338dSopenharmony_ci    Repetitions(3)->ReportAggregatesOnly();
5819762338dSopenharmony_ci
5829762338dSopenharmony_ci/**
5839762338dSopenharmony_ci  * @tc.number: SUB_Driver_Input_HdiPerformance_1600
5849762338dSopenharmony_ci  * @tc.name: Run Extra Command for ap mode benchmark test
5859762338dSopenharmony_ci  * @tc.desc: [C- SOFTWARE -0010]
5869762338dSopenharmony_ci  * @tc.size: Medium
5879762338dSopenharmony_ci  * @tc.level: level 2
5889762338dSopenharmony_ci  */
5899762338dSopenharmony_ciBENCHMARK_F(InputBenchmarkTest, RunExtraCommand)(benchmark::State &st)
5909762338dSopenharmony_ci{
5919762338dSopenharmony_ci    ASSERT_EQ(g_HasDev, true);
5929762338dSopenharmony_ci    int32_t ret;
5939762338dSopenharmony_ci    InputExtraCmd extraCmd = {0};
5949762338dSopenharmony_ci    extraCmd.cmdCode = "WakeUpMode";
5959762338dSopenharmony_ci    extraCmd.cmdValue = "Enable";
5969762338dSopenharmony_ci
5979762338dSopenharmony_ci    for (auto _ : st) {
5989762338dSopenharmony_ci        ret = g_inputInterface->iInputController->RunExtraCommand(TOUCH_INDEX, &extraCmd);
5999762338dSopenharmony_ci    }
6009762338dSopenharmony_ci}
6019762338dSopenharmony_ciBENCHMARK_REGISTER_F(InputBenchmarkTest, RunExtraCommand)->Iterations(100)->
6029762338dSopenharmony_ci    Repetitions(3)->ReportAggregatesOnly();
6039762338dSopenharmony_ci
6049762338dSopenharmony_ci
6059762338dSopenharmony_ci/**
6069762338dSopenharmony_ci  * @tc.number: SUB_Driver_Input_HdiPerformance_1700
6079762338dSopenharmony_ci  * @tc.name: Register Report Callback for ap mode benchmark test
6089762338dSopenharmony_ci  * @tc.desc: [C- SOFTWARE -0010]
6099762338dSopenharmony_ci  * @tc.size: Medium
6109762338dSopenharmony_ci  * @tc.level: level 2
6119762338dSopenharmony_ci  */
6129762338dSopenharmony_ciBENCHMARK_F(InputBenchmarkTest, RegisterReportCallback)(benchmark::State &st)
6139762338dSopenharmony_ci{
6149762338dSopenharmony_ci    ASSERT_EQ(g_HasDev, true);
6159762338dSopenharmony_ci    int32_t ret;
6169762338dSopenharmony_ci    g_callback.EventPkgCallback = ReportEventPkgCallback;
6179762338dSopenharmony_ci    ret = g_inputInterface->iInputReporter->RegisterReportCallback(0, &g_callback);
6189762338dSopenharmony_ci    EXPECT_NE(ret, INPUT_SUCCESS);
6199762338dSopenharmony_ci    ret = g_inputInterface->iInputReporter->RegisterReportCallback(MAX_INPUT_DEV_NUM, &g_callback);
6209762338dSopenharmony_ci    EXPECT_NE(ret, INPUT_SUCCESS);
6219762338dSopenharmony_ci    for (auto _ : st) {
6229762338dSopenharmony_ci        ret = g_inputInterface->iInputReporter->RegisterReportCallback(TOUCH_INDEX, nullptr);
6239762338dSopenharmony_ci    }
6249762338dSopenharmony_ci    EXPECT_NE(ret, INPUT_SUCCESS);
6259762338dSopenharmony_ci}
6269762338dSopenharmony_ciBENCHMARK_REGISTER_F(InputBenchmarkTest, RegisterReportCallback)->Iterations(100)->
6279762338dSopenharmony_ci    Repetitions(3)->ReportAggregatesOnly();
6289762338dSopenharmony_ci
6299762338dSopenharmony_ci/**
6309762338dSopenharmony_ci  * @tc.number: SUB_Driver_Input_HdiPerformance_1800
6319762338dSopenharmony_ci  * @tc.name: Register Report Callback test
6329762338dSopenharmony_ci  * @tc.desc: [C- SOFTWARE -0010]
6339762338dSopenharmony_ci  * @tc.size: Medium
6349762338dSopenharmony_ci  * @tc.level: level 2
6359762338dSopenharmony_ci  */
6369762338dSopenharmony_ciBENCHMARK_F(InputBenchmarkTest, UnregisterReportCallback)(benchmark::State &st)
6379762338dSopenharmony_ci{
6389762338dSopenharmony_ci    ASSERT_EQ(g_HasDev, true);
6399762338dSopenharmony_ci    int32_t ret;
6409762338dSopenharmony_ci    g_callback.EventPkgCallback = ReportEventPkgCallback;
6419762338dSopenharmony_ci
6429762338dSopenharmony_ci    ret = g_inputInterface->iInputReporter->RegisterReportCallback(TOUCH_INDEX, &g_callback);
6439762338dSopenharmony_ci    OsalMSleep(KEEP_ALIVE_TIME_MS);
6449762338dSopenharmony_ci    for (auto _ : st) {
6459762338dSopenharmony_ci        ret = g_inputInterface->iInputReporter->UnregisterReportCallback(TOUCH_INDEX);
6469762338dSopenharmony_ci    }
6479762338dSopenharmony_ci    ret = 0;
6489762338dSopenharmony_ci    EXPECT_EQ(ret, INPUT_SUCCESS);
6499762338dSopenharmony_ci}
6509762338dSopenharmony_ciBENCHMARK_REGISTER_F(InputBenchmarkTest, UnregisterReportCallback)->Iterations(100)->
6519762338dSopenharmony_ci    Repetitions(3)->ReportAggregatesOnly();
6529762338dSopenharmony_ci}
6539762338dSopenharmony_ciBENCHMARK_MAIN();