From 9064f452df91502741d22418c2f1b5a02feec920 Mon Sep 17 00:00:00 2001 From: wangxiuxiu96 Date: Fri, 20 Dec 2024 10:13:06 +0800 Subject: [PATCH] Performance experience tool stability improvemment Signed-off-by: wangxiuxiu96 Change-Id: Ibbf2a79950c122af05750bd52f42f4554a1486b3 --- inspector/connect_inspector.cpp | 24 ++++++++++++++++++++++++ inspector/connect_inspector.h | 3 ++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/inspector/connect_inspector.cpp b/inspector/connect_inspector.cpp index d7d0219d..c883bb21 100644 --- a/inspector/connect_inspector.cpp +++ b/inspector/connect_inspector.cpp @@ -35,6 +35,8 @@ static constexpr char OPEN_ARKUI_STATE_PROFILER[] = "ArkUIStateProfilerOpen"; static constexpr char CLOSE_ARKUI_STATE_PROFILER[] = "ArkUIStateProfilerClose"; static constexpr char START_RECORD_MESSAGE[] = "rsNodeStartRecord"; static constexpr char STOP_RECORD_MESSAGE[] = "rsNodeStopRecord"; +static constexpr char START_PERFORMANCE_CHECK_MESSAGE[] = "StartArkPerformanceCheck"; +static constexpr char END_PERFORMANCE_CHECK_MESSAGE[] = "EndArkPerformanceCheck"; std::function g_setConnectCallBack; void* HandleDebugManager(void* const server) @@ -200,6 +202,19 @@ void OnMessage(const std::string &message) g_setConnectCallBack(false); } } + if (message.find(START_PERFORMANCE_CHECK_MESSAGE, 0) != std::string::npos) { + if (g_inspector->setPerformanceCheckStatus_ != nullptr) { + LOGI("performance check start"); + g_inspector->setPerformanceCheckStatus_(true, message); + } + } + if (message.find(END_PERFORMANCE_CHECK_MESSAGE, 0) != std::string::npos) { + if (g_inspector->setPerformanceCheckStatus_ != nullptr) { + LOGI("performance check end"); + g_inspector->waitingForDebugger_ = true; + g_inspector->setPerformanceCheckStatus_(false, message); + } + } OnInspectorRecordMessage(message); } } @@ -335,6 +350,15 @@ void SetProfilerCallback(const std::function &setArkUIStateProfilerS g_inspector->setArkUIStateProfilerStatus_ = setArkUIStateProfilerStatus; } +void SetPerformanceCheckCallback(const std::function &setPerformanceCheckStatus) +{ + std::lock_guard lock(g_connectMutex); + if (g_inspector == nullptr) { + g_inspector = std::make_unique(); + } + g_inspector->setPerformanceCheckStatus_ = setPerformanceCheckStatus; +} + void SetRecordCallback(const std::function &startRecordFunc, const std::function &stopRecordFunc) { diff --git a/inspector/connect_inspector.h b/inspector/connect_inspector.h index 600e194d..5c228eb0 100644 --- a/inspector/connect_inspector.h +++ b/inspector/connect_inspector.h @@ -52,7 +52,7 @@ void SetSwitchCallBack(const std::function& setSwitchStatus, const std::function& createLayoutInfo, int32_t instanceId); void SetProfilerCallback(const std::function &setArkUIStateProfilerStatus); - +void SetPerformanceCheckCallback(const std::function &setPerformanceCheckStatus); void SetRecordCallback(const std::function &startRecordFunc, const std::function &stopRecordFunc); @@ -94,6 +94,7 @@ public: std::atomic waitingForDebugger_ = true; std::function setSwitchStatus_; std::function setArkUIStateProfilerStatus_; + std::function setPerformanceCheckStatus_; std::function createLayoutInfo_; std::function setDebugMode_; int32_t instanceId_ = -1; -- Gitee