1 /* 2 * Copyright (c) 2023 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 #include <string> 17 18 19 #define ROSEN_TRACE_BEGIN(tag, name) OHOS::Rosen::RosenTraceBegin(name) 20 #define RS_TRACE_BEGIN(name) OHOS::Rosen::RosenTraceBegin(name) 21 #define ROSEN_TRACE_END(tag) OHOS::Rosen::RosenTraceEnd() 22 #define RS_TRACE_END() OHOS::Rosen::RosenTraceEnd() 23 #define RS_TRACE_NAME(name) OHOS::Rosen::ScopedTrace ___tracer(name) 24 #define RS_TRACE_NAME_FMT(fmt, ...) 25 #define RS_ASYNC_TRACE_BEGIN(name, value) 26 #define RS_ASYNC_TRACE_END(name, value) 27 #define RS_TRACE_INT(name, value) 28 #define RS_TRACE_FUNC() RS_TRACE_NAME(__FUNCTION__) 29 30 namespace OHOS { 31 namespace Rosen { 32 33 void RosenTraceBegin(const char* name); 34 void RosenTraceBegin(std::string name); 35 void RosenTraceEnd(); 36 class ScopedTrace { 37 public: 38 explicit ScopedTrace(const char *name); 39 40 explicit ScopedTrace(std::string name); 41 42 ~ScopedTrace(); 43 }; 44 } // namespace Rosen 45 } // namespace OHOS