1 /* 2 * Copyright (c) 2022-2023 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 ROSEN_RENDER_SERVICE_BASE_RS_FRAME_REPORT_H 17 #define ROSEN_RENDER_SERVICE_BASE_RS_FRAME_REPORT_H 18 19 #include <string> 20 21 #include "common/rs_macros.h" 22 23 namespace OHOS { 24 namespace Rosen { 25 using FrameGetEnableFunc = int (*)(); 26 using InitFunc = void (*)(); 27 using ProcessCommandsStartFunc = void(*)(); 28 using AnimateStartFunc = void(*)(); 29 using RenderStartFunc = void(*)(uint64_t); 30 using RenderEndFunc = void(*)(); 31 using SendCommandsStartFunc = void(*)(); 32 using SetFrameParamFunc = void(*)(int, int, int, int); 33 class RSB_EXPORT RsFrameReport final { 34 public: 35 static RSB_EXPORT RsFrameReport& GetInstance(); 36 void Init(); 37 int GetEnable(); 38 39 void ProcessCommandsStart(); 40 void AnimateStart(); 41 void RenderStart(uint64_t timestamp); 42 void RenderEnd(); 43 void SendCommandsStart(); 44 void SetFrameParam(int requestId, int load, int schedFrameNum, int value); 45 46 private: 47 RsFrameReport(); 48 ~RsFrameReport(); 49 bool LoadLibrary(); 50 void CloseLibrary(); 51 void *LoadSymbol(const char *symName); 52 void *frameSchedHandle_ = nullptr; 53 bool frameSchedSoLoaded_ = false; 54 55 FrameGetEnableFunc frameGetEnableFunc_ = nullptr; 56 InitFunc initFunc_ = nullptr; 57 ProcessCommandsStartFunc processCommandsStartFun_ = nullptr; 58 AnimateStartFunc animateStartFunc_ = nullptr; 59 RenderStartFunc renderStartFunc_ = nullptr; 60 RenderEndFunc renderEndFunc_ = nullptr; 61 SendCommandsStartFunc sendCommandsStartFunc_ = nullptr; 62 SetFrameParamFunc setFrameParamFunc_ = nullptr; 63 }; 64 } // namespace Rosen 65 } // namespace OHOS 66 #endif // FOUNDATION_ACE_FRAMEWORKS_BASE_LOG_FRAME_REPORT_H 67