1 /*
2  * Copyright (c) 2021 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 GRAPHIC_RS_TRACE_H
17 #define GRAPHIC_RS_TRACE_H
18 
19 #ifndef ROSEN_TRACE_DISABLE
20 #include "hitrace_meter.h"
21 #define ROSEN_TRACE_BEGIN(tag, name) StartTrace(tag, name)
22 #define RS_TRACE_BEGIN(name) ROSEN_TRACE_BEGIN(HITRACE_TAG_GRAPHIC_AGP | HITRACE_TAG_COMMERCIAL, name)
23 #define ROSEN_TRACE_END(tag) FinishTrace(tag)
24 #define RS_TRACE_END() ROSEN_TRACE_END(HITRACE_TAG_GRAPHIC_AGP | HITRACE_TAG_COMMERCIAL)
25 #define RS_TRACE_NAME(name) HITRACE_METER_NAME(HITRACE_TAG_GRAPHIC_AGP | HITRACE_TAG_COMMERCIAL, name)
26 #define RS_TRACE_NAME_FMT(fmt, ...) \
27     HITRACE_METER_FMT(HITRACE_TAG_GRAPHIC_AGP | HITRACE_TAG_COMMERCIAL, fmt, ##__VA_ARGS__)
28 #define RS_ASYNC_TRACE_BEGIN(name, value) StartAsyncTrace(HITRACE_TAG_GRAPHIC_AGP | HITRACE_TAG_COMMERCIAL, name, value)
29 #define RS_ASYNC_TRACE_END(name, value) FinishAsyncTrace(HITRACE_TAG_GRAPHIC_AGP | HITRACE_TAG_COMMERCIAL, name, value)
30 #define RS_TRACE_INT(name, value) CountTrace(HITRACE_TAG_GRAPHIC_AGP | HITRACE_TAG_COMMERCIAL, name, value)
31 #define RS_TRACE_FUNC() RS_TRACE_NAME(__func__)
32 
33 #elif defined(ROSEN_ANDROID) && !defined(RUNTIME_MODE_RELEASE)
34 #include "rs_trace_crossplatform.h"
35 #else
36 
37 #define ROSEN_TRACE_BEGIN(tag, name)
38 #define RS_TRACE_BEGIN(name)
39 #define ROSEN_TRACE_END(tag)
40 #define RS_TRACE_END()
41 #define RS_TRACE_NAME_FMT(fmt, ...)
42 #define RS_ASYNC_TRACE_BEGIN(name, value)
43 #define RS_ASYNC_TRACE_END(name, value)
44 #define RS_TRACE_INT(name, value)
45 #define RS_TRACE_NAME(name)
46 #define RS_TRACE_FUNC()
47 #endif //ROSEN_TRACE_DISABLE
48 
49 #endif // GRAPHIC_RS_TRACE_H
50