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 SENSOR_TRACE_H 17#define SENSOR_TRACE_H 18 19#include "hitrace_meter.h" 20 21#define SENSOR_TRACE_TAG HITRACE_TAG_HDF 22#define SENSOR_TRACE HITRACE_METER_NAME(SENSOR_TRACE_TAG, __func__) 23 24#define SENSOR_TRACE_PID HITRACE_METER_NAME(SENSOR_TRACE_TAG, (std::string(__func__) + ":pid " + \ 25 std::to_string(static_cast<uint32_t>(HdfRemoteGetCallingPid()))).c_str()) 26 27#define SENSOR_TRACE_MSG(msg) HITRACE_METER_NAME(SENSOR_TRACE_TAG, (std::string(__func__) + ":" + (msg)).c_str()) 28 29#define SENSOR_TRACE_PID_MSG(msg) HITRACE_METER_NAME(SENSOR_TRACE_TAG, (std::string(__func__) + ":pid " + \ 30 std::to_string(static_cast<uint32_t>(HdfRemoteGetCallingPid())) + "," + (msg)).c_str()) 31 32#define SENSOR_TRACE_START(msg) StartTrace(SENSOR_TRACE_TAG, (std::string(__func__) + ":" + (msg)).c_str()) 33 34#define SENSOR_TRACE_FINISH FinishTrace(SENSOR_TRACE_TAG) 35 36#endif //SENSOR_TRACE_H 37