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 26namespace OHOS { 27namespace DistributedHardware { 28constexpr uint64_t DCAMERA_HITRACE_LABEL = HITRACE_TAG_DISTRIBUTED_CAMERA; 29const std::string DCAMERA_LOAD_HDF = "DCAMERA_LOAD_HDF"; 30const std::string DCAMERA_REGISTER_CAMERA = "DCAMERA_REGISTER_CAMERA"; 31const std::string DCAMERA_UNREGISTER_CAMERA = "DCAMERA_UNREGISTER_CAMERA"; 32const std::string DCAMERA_SOURCE_CREATE_PIPELINE = "DCAMERA_SOURCE_CREATE_PIPELINE"; 33const std::string DCAMERA_SOURCE_DESTORY_PIPELINE = "DCAMERA_SOURCE_DESTORY_PIPELINE"; 34const std::string DCAMERA_SINK_CREATE_PIPELINE = "DCAMERA_SINK_CREATE_PIPELINE"; 35const std::string DCAMERA_SINK_DESTORY_PIPELINE = "DCAMERA_SINK_DESTORY_PIPELINE"; 36const std::string DCAMERA_OPEN_CHANNEL_CONTROL = "DCAMERA_OPEN_CHANNEL_CONTROL"; 37const std::string DCAMERA_OPEN_DATA_CONTINUE = "DCAMERA_OPEN_DATA_CONTINUE"; 38const std::string DCAMERA_OPEN_DATA_SNAPSHOT = "DCAMERA_OPEN_DATA_SNAPSHOT"; 39const std::string DCAMERA_CONTINUE_FIRST_FRAME = "DCAMERA_CONTINUE_FIRST_FRAME"; 40const std::string DCAMERA_SNAPSHOT_FIRST_FRAME = "DCAMERA_SNAPSHOT_FIRST_FRAME"; 41enum 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 49void DcameraStartAsyncTrace(const std::string& str, int32_t taskId); 50void DcameraFinishAsyncTrace(const std::string& str, int32_t taskId); 51} // namespace DistributedHardware 52} // namespace OHOS 53#endif // OHOS_DCAMERA_HITRACE_ADAPTER_H