From 12055fc81937a1567f009c0e08411d73fba8f1d7 Mon Sep 17 00:00:00 2001 From: wangxiuxiu96 Date: Thu, 5 Dec 2024 17:02:19 +0800 Subject: [PATCH] Performance experience tool stability improvemment Signed-off-by: wangxiuxiu96 Change-Id: I0b47177f07328eb87b294fa13dafacb43f2edae4 --- 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 4fdb8579..3ad3eefe 100644 --- a/inspector/connect_inspector.cpp +++ b/inspector/connect_inspector.cpp @@ -28,6 +28,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) @@ -136,6 +138,19 @@ void OnMessage(const std::string& message) g_inspector->setDebugMode_(); } } + + 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->setPerformanceCheckStatus_(false, message); + } + } OnInspectorRecordMessage(message); } } @@ -299,6 +314,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 acb9b62d..9e4dd9a0 100644 --- a/inspector/connect_inspector.h +++ b/inspector/connect_inspector.h @@ -58,7 +58,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); @@ -86,6 +86,7 @@ public: std::queue ideMsgQueue_; std::function setSwitchStatus_; std::function setArkUIStateProfilerStatus_; + std::function setPerformanceCheckStatus_; std::function createLayoutInfo_; std::function setDebugMode_; int32_t instanceId_ = -1; -- Gitee