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_DAUDIO_HITRACE_H 17 #define OHOS_DAUDIO_HITRACE_H 18 19 #include <string> 20 21 #include "hitrace_meter.h" 22 23 #define DAUDIO_SYNC_TRACE(value) HITRACE_METER_NAME(DAUDIO_HITRACE_LABEL, value) 24 25 namespace OHOS { 26 namespace DistributedHardware { 27 constexpr uint64_t DAUDIO_HITRACE_LABEL = HITRACE_TAG_DISTRIBUTED_AUDIO; 28 29 const std::string DAUDIO_LOAD_HDF_DRIVER = "DAUDIO_LOAD_HDF_DRIVER"; 30 const std::string DAUDIO_SOURCE_LOAD_SYSTEM_ABILITY = "DAUDIO_SOURCE_LOAD_SYSTEM_ABILITY"; 31 const std::string DAUDIO_SINK_LOAD_SYSTEM_ABILITY = "DAUDIO_SINK_LOAD_SYSTEM_ABILITY"; 32 const std::string DAUDIO_REGISTER_AUDIO = "DAUDIO_REGISTER_AUDIO"; 33 const std::string DAUDIO_UNREGISTER_AUDIO = "DAUDIO_UNREGISTER_AUDIO"; 34 const std::string DAUDIO_ENABLE_SPK = "DAUDIO_ENABLE_SPK"; 35 const std::string DAUDIO_DISABLE_SPK = "DAUDIO_DISABLE_SPK"; 36 const std::string DAUDIO_ENABLE_MIC = "DAUDIO_ENABLE_MIC"; 37 const std::string DAUDIO_DISABLE_MIC = "DAUDIO_DISABLE_MIC"; 38 39 const std::string DAUDIO_CREATE_DATA_SESSION = "DAUDIO_CREATE_DATA_SESSION"; 40 const std::string DAUDIO_RELEASE_DATA_SESSION = "DAUDIO_RELEASE_DATA_SESSION"; 41 const std::string DAUDIO_OPEN_DATA_SESSION = "DAUDIO_OPEN_DATA_SESSION"; 42 const std::string DAUDIO_CLOSE_DATA_SESSION = "DAUDIO_CLOSE_DATA_SESSION"; 43 44 const std::string DAUDIO_CREATE_CTRL_SESSION = "DAUDIO_CREATE_CTRL_SESSION"; 45 const std::string DAUDIO_RELEASE_CTRL_SESSION = "DAUDIO_RELEASE_CTRL_SESSION"; 46 const std::string DAUDIO_OPEN_CTRL_SESSION = "DAUDIO_OPEN_CTRL_SESSION"; 47 const std::string DAUDIO_CLOSE_CTRL_SESSION = "DAUDIO_CLOSE_CTRL_SESSION"; 48 49 const std::string DAUDIO_START_ENCODER_PROCESSOR = "DAUDIO_START_ENCODER_PROCESSOR"; 50 const std::string DAUDIO_STOP_ENCODER_PROCESSOR = "DAUDIO_STOP_ENCODER_PROCESSOR"; 51 const std::string DAUDIO_RELEASE_ENCODER_PROCESSOR = "DAUDIO_RELEASE_ENCODER_PROCESSOR"; 52 const std::string DAUDIO_START_DECODER_PROCESSOR = "DAUDIO_START_DECODER_PROCESSOR"; 53 const std::string DAUDIO_STOP_DECODER_PROCESSOR = "DAUDIO_STOP_DECODER_PROCESSOR"; 54 const std::string DAUDIO_RELEASE_DECODER_PROCESSOR = "DAUDIO_RELEASE_DECODER_PROCESSOR"; 55 56 enum DaudioTaskId : int32_t { 57 DAUDIO_REGISTER_AUDIO_TASKID = 0, 58 DAUDIO_UNREGISTER_AUDIO_TASKID = 1, 59 DAUDIO_OPEN_DATA_SESSION_TASKID = 2, 60 DAUDIO_OPEN_CTRL_SESSION_TASKID = 3, 61 }; 62 63 void DaudioStartAsyncTrace(const std::string& str, int32_t taskId); 64 void DaudioFinishAsyncTrace(const std::string& str, int32_t taskId); 65 } // namespace DistributedHardware 66 } // namespace OHOS 67 #endif // OHOS_DAUDIO_HITRACE_H 68