1 /* 2 * Copyright (c) 2022 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_DCAMERA_HITRACE_ADAPTER_H 17 #define OHOS_DCAMERA_HITRACE_ADAPTER_H 18 19 #include <cstdint> 20 #include <string> 21 22 #include "hitrace_meter.h" 23 24 #define DCAMERA_SYNC_TRACE(value) HITRACE_METER_NAME(DCAMERA_HITRACE_LABEL, value) 25 26 namespace OHOS { 27 namespace DistributedHardware { 28 constexpr uint64_t DCAMERA_HITRACE_LABEL = HITRACE_TAG_DISTRIBUTED_CAMERA; 29 const std::string DCAMERA_LOAD_HDF = "DCAMERA_LOAD_HDF"; 30 const std::string DCAMERA_REGISTER_CAMERA = "DCAMERA_REGISTER_CAMERA"; 31 const std::string DCAMERA_UNREGISTER_CAMERA = "DCAMERA_UNREGISTER_CAMERA"; 32 const std::string DCAMERA_SOURCE_CREATE_PIPELINE = "DCAMERA_SOURCE_CREATE_PIPELINE"; 33 const std::string DCAMERA_SOURCE_DESTORY_PIPELINE = "DCAMERA_SOURCE_DESTORY_PIPELINE"; 34 const std::string DCAMERA_SINK_CREATE_PIPELINE = "DCAMERA_SINK_CREATE_PIPELINE"; 35 const std::string DCAMERA_SINK_DESTORY_PIPELINE = "DCAMERA_SINK_DESTORY_PIPELINE"; 36 const std::string DCAMERA_OPEN_CHANNEL_CONTROL = "DCAMERA_OPEN_CHANNEL_CONTROL"; 37 const std::string DCAMERA_OPEN_DATA_CONTINUE = "DCAMERA_OPEN_DATA_CONTINUE"; 38 const std::string DCAMERA_OPEN_DATA_SNAPSHOT = "DCAMERA_OPEN_DATA_SNAPSHOT"; 39 const std::string DCAMERA_CONTINUE_FIRST_FRAME = "DCAMERA_CONTINUE_FIRST_FRAME"; 40 const std::string DCAMERA_SNAPSHOT_FIRST_FRAME = "DCAMERA_SNAPSHOT_FIRST_FRAME"; 41 enum DcameraTaskId { 42 DCAMERA_OPEN_CHANNEL_TASKID = 0, 43 DCAMERA_OPEN_DATA_CONTINUE_TASKID = 1, 44 DCAMERA_OPEN_DATA_SNAPSHOT_TASKID = 2, 45 DCAMERA_CONTINUE_FIRST_FRAME_TASKID = 3, 46 DCAMERA_SNAPSHOT_FIRST_FRAME_TASKID = 4, 47 }; 48 49 void DcameraStartAsyncTrace(const std::string& str, int32_t taskId); 50 void DcameraFinishAsyncTrace(const std::string& str, int32_t taskId); 51 } // namespace DistributedHardware 52 } // namespace OHOS 53 #endif // OHOS_DCAMERA_HITRACE_ADAPTER_H