1 /* 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef ARKUI_PERF_INTERFACES_H 17 #define ARKUI_PERF_INTERFACES_H 18 19 #include <cstdint> 20 #include <string> 21 #include "base/perfmonitor/perf_monitor.h" 22 23 namespace OHOS::Ace { 24 25 class PerfInterfaces { 26 public: 27 static void SetScrollState(bool state); 28 static void RecordInputEvent(PerfActionType type, PerfSourceType sourceType, int64_t time); 29 static int64_t GetInputTime(const std::string& sceneId, PerfActionType type, const std::string& note); 30 31 static void NotifyAppJankStatsBegin(); 32 static void NotifyAppJankStatsEnd(); 33 static void SetPageUrl(const std::string& pageUrl); 34 static std::string GetPageUrl(); 35 static void SetPageName(const std::string& pageName); 36 static std::string GetPageName(); 37 static void SetAppForeground(bool isShow); 38 static void SetAppStartStatus(); 39 static bool IsScrollJank(const std::string& sceneId); 40 41 static void Start(const std::string& sceneId, PerfActionType type, const std::string& note); 42 static void End(const std::string& sceneId, bool isRsRender); 43 static void StartCommercial(const std::string& sceneId, PerfActionType type, const std::string& note); 44 static void EndCommercial(const std::string& sceneId, bool isRsRender); 45 static void SetFrameTime(int64_t vsyncTime, int64_t duration, double jank, const std::string& windowName); 46 static void SetSubHealthInfo(const std::string& info, const std::string& reason, const int32_t duration); 47 48 static void ReportJankFrameApp(double jank, int32_t jankThreshold); 49 static void ReportPageShowMsg(const std::string& pageUrl, const std::string& bundleName, 50 const std::string& pageName); 51 static void SetApplicationInfo(); 52 }; 53 54 } // namespace OHOS::Ace 55 56 #endif // ARKUI_PERF_INTERFACES_H 57