From 020740fda7b0c2ea63a47ab41685b93931a64fb4 Mon Sep 17 00:00:00 2001 From: buzhenwang Date: Tue, 9 Sep 2025 14:42:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=90=8C=E6=AD=A5=20Signed-o?= =?UTF-8?q?ff-by:leiguangyu=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: buzhenwang --- .../include/test_hiperf_event_listener.h | 82 +++++++++---------- .../native/test_hiperf_event_listener.cpp | 72 ++++++++-------- 2 files changed, 77 insertions(+), 77 deletions(-) diff --git a/test/unittest/common/native/include/test_hiperf_event_listener.h b/test/unittest/common/native/include/test_hiperf_event_listener.h index 11e0dff..0190cf4 100644 --- a/test/unittest/common/native/include/test_hiperf_event_listener.h +++ b/test/unittest/common/native/include/test_hiperf_event_listener.h @@ -1,42 +1,42 @@ -/* - * Copyright (c) 2025-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef TEST_HIPERF_EVENT_LISTENER -#define TEST_HIPERF_EVENT_LISTENER - -#include "hisysevent_listener.h" - -namespace OHOS { -namespace Developtools { -namespace HiPerf { - -class HiperfEventListener : public HiviewDFX::HiSysEventListener { -public: - HiperfEventListener() = default; - ~HiperfEventListener() override = default; - void OnEvent(std::shared_ptr sysEvent) override; - void OnServiceDied() override {}; - - std::shared_ptr GetLastEvent(); -private: - std::mutex mutex_; - std::shared_ptr lastEvent_ = nullptr; -}; - -} // namespace HiPerf -} // namespace Developtools -} // namespace OHOS - +/* + * Copyright (c) 2025-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_HIPERF_EVENT_LISTENER +#define TEST_HIPERF_EVENT_LISTENER + +#include "hisysevent_listener.h" + +namespace OHOS { +namespace Developtools { +namespace HiPerf { + +class HiperfEventListener : public HiviewDFX::HiSysEventListener { +public: + HiperfEventListener() = default; + ~HiperfEventListener() override = default; + void OnEvent(std::shared_ptr sysEvent) override; + void OnServiceDied() override {}; + + std::shared_ptr GetLastEvent(); +private: + std::mutex mutex_; + std::shared_ptr lastEvent_ = nullptr; +}; + +} // namespace HiPerf +} // namespace Developtools +} // namespace OHOS + #endif \ No newline at end of file diff --git a/test/unittest/common/native/test_hiperf_event_listener.cpp b/test/unittest/common/native/test_hiperf_event_listener.cpp index 34e2fb7..6fd94ae 100644 --- a/test/unittest/common/native/test_hiperf_event_listener.cpp +++ b/test/unittest/common/native/test_hiperf_event_listener.cpp @@ -1,36 +1,36 @@ -/* - * Copyright (c) 2025-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "test_hiperf_event_listener.h" - -namespace OHOS { -namespace Developtools { -namespace HiPerf { - -void HiperfEventListener::OnEvent(std::shared_ptr sysEvent) -{ - std::unique_lock lock(mutex_); - lastEvent_ = sysEvent; -} - -std::shared_ptr HiperfEventListener::GetLastEvent() -{ - std::unique_lock lock(mutex_); - return lastEvent_; -} - -} // namespace HiPerf -} // namespace Developtools -} // namespace OHOS +/* + * Copyright (c) 2025-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "test_hiperf_event_listener.h" + +namespace OHOS { +namespace Developtools { +namespace HiPerf { + +void HiperfEventListener::OnEvent(std::shared_ptr sysEvent) +{ + std::unique_lock lock(mutex_); + lastEvent_ = sysEvent; +} + +std::shared_ptr HiperfEventListener::GetLastEvent() +{ + std::unique_lock lock(mutex_); + return lastEvent_; +} + +} // namespace HiPerf +} // namespace Developtools +} // namespace OHOS -- Gitee