1 /* 2 * Copyright (c) 2024 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 OHOS_CAMERA_REPORT_DFX_UITLS_H 17 #define OHOS_CAMERA_REPORT_DFX_UITLS_H 18 19 #include <map> 20 #include <refbase.h> 21 22 namespace OHOS { 23 namespace CameraStandard { 24 25 struct CaptureDfxInfo { 26 int32_t captureId; 27 bool isSystemApp; 28 uint64_t firstBufferStartTime; 29 uint64_t firstBufferEndTime; 30 uint64_t prepareProxyStartTime; 31 uint64_t prepareProxyEndTime; 32 uint64_t addProxyStartTime; 33 uint64_t addProxyEndTime; 34 }; 35 36 class CameraReportDfxUtils : public RefBase { 37 public: 38 static sptr<CameraReportDfxUtils> &GetInstance(); 39 40 void SetFirstBufferStartInfo(CaptureDfxInfo captureInfo); 41 void SetFirstBufferEndInfo(int32_t captureId); 42 43 void SetPrepareProxyStartInfo(int32_t captureId); 44 void SetPrepareProxyEndInfo(int32_t captureId); 45 46 void SetAddProxyStartInfo(int32_t captureId); 47 void SetAddProxyEndInfo(int32_t captureId); 48 49 private: 50 std::mutex mutex_; 51 52 static sptr<CameraReportDfxUtils> cameraReportDfx_; 53 static std::mutex instanceMutex_; 54 55 std::map<int32_t, CaptureDfxInfo> captureList_; 56 57 void ReportPerformanceDeferredPhoto(CaptureDfxInfo captureInfo); 58 }; 59 } // namespace CameraStandard 60 } // namespace OHOS 61 #endif // OHOS_CAMERA_REPORT_DFX_UITLS_H