From 7bf76068eb3802095af8e7f784561d053f074672 Mon Sep 17 00:00:00 2001 From: status102 <102887808+status102@users.noreply.github.com> Date: Thu, 8 Feb 2024 17:04:13 +0800 Subject: [PATCH] =?UTF-8?q?perf(MaaCore):=20ScreenCost=E6=88=AA=E5=9B=BE?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=AC=A1=E6=95=B0=E4=B8=BA0=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E8=BF=94=E5=9B=9Efault=5Ftimes=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaCore/Controller/AdbController.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/MaaCore/Controller/AdbController.cpp b/src/MaaCore/Controller/AdbController.cpp index 718d37a658..9c09e5789f 100644 --- a/src/MaaCore/Controller/AdbController.cpp +++ b/src/MaaCore/Controller/AdbController.cpp @@ -475,14 +475,18 @@ bool asst::AdbController::screencap(cv::Mat& image_payload, bool allow_reconnect { "uuid", m_uuid }, { "what", "ScreencapCost" }, { "details", - json::object { { "min", screencap_cost_min }, - { "max", screencap_cost_max }, - { "avg", filtered_count > 0 ? std::accumulate(filtered_duration.begin(), - filtered_duration.end(), 0ll) / - filtered_count - : -1 }, - { "fault_times", m_screencap_duration.size() - filtered_count } } }, + json::object { + { "min", screencap_cost_min }, + { "max", screencap_cost_max }, + { "avg", + filtered_count > 0 + ? std::accumulate(filtered_duration.begin(), filtered_duration.end(), 0ll) / filtered_count + : -1 }, + } }, }; + if (m_screencap_duration.size() - filtered_count > 0) { + info["details"]["fault_times"] = m_screencap_duration.size() - filtered_count; + } callback(AsstMsg::ConnectionInfo, info); } return screencap_ret;