1e9297d28Sopenharmony_ci/*
2e9297d28Sopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd.
3e9297d28Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4e9297d28Sopenharmony_ci * you may not use this file except in compliance with the License.
5e9297d28Sopenharmony_ci * You may obtain a copy of the License at
6e9297d28Sopenharmony_ci *
7e9297d28Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8e9297d28Sopenharmony_ci *
9e9297d28Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10e9297d28Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11e9297d28Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12e9297d28Sopenharmony_ci * See the License for the specific language governing permissions and
13e9297d28Sopenharmony_ci * limitations under the License.
14e9297d28Sopenharmony_ci */
15e9297d28Sopenharmony_ci
16e9297d28Sopenharmony_ci#ifndef GRAPHIC_RS_TRACE_H
17e9297d28Sopenharmony_ci#define GRAPHIC_RS_TRACE_H
18e9297d28Sopenharmony_ci
19e9297d28Sopenharmony_ci#ifndef ROSEN_TRACE_DISABLE
20e9297d28Sopenharmony_ci#include "hitrace_meter.h"
21e9297d28Sopenharmony_ci#define ROSEN_TRACE_BEGIN(tag, name) StartTrace(tag, name)
22e9297d28Sopenharmony_ci#define RS_TRACE_BEGIN(name) ROSEN_TRACE_BEGIN(HITRACE_TAG_GRAPHIC_AGP | HITRACE_TAG_COMMERCIAL, name)
23e9297d28Sopenharmony_ci#define ROSEN_TRACE_END(tag) FinishTrace(tag)
24e9297d28Sopenharmony_ci#define RS_TRACE_END() ROSEN_TRACE_END(HITRACE_TAG_GRAPHIC_AGP | HITRACE_TAG_COMMERCIAL)
25e9297d28Sopenharmony_ci#define RS_TRACE_NAME(name) HITRACE_METER_NAME(HITRACE_TAG_GRAPHIC_AGP | HITRACE_TAG_COMMERCIAL, name)
26e9297d28Sopenharmony_ci#define RS_TRACE_NAME_FMT(fmt, ...) \
27e9297d28Sopenharmony_ci    HITRACE_METER_FMT(HITRACE_TAG_GRAPHIC_AGP | HITRACE_TAG_COMMERCIAL, fmt, ##__VA_ARGS__)
28e9297d28Sopenharmony_ci#define RS_ASYNC_TRACE_BEGIN(name, value) StartAsyncTrace(HITRACE_TAG_GRAPHIC_AGP | HITRACE_TAG_COMMERCIAL, name, value)
29e9297d28Sopenharmony_ci#define RS_ASYNC_TRACE_END(name, value) FinishAsyncTrace(HITRACE_TAG_GRAPHIC_AGP | HITRACE_TAG_COMMERCIAL, name, value)
30e9297d28Sopenharmony_ci#define RS_TRACE_INT(name, value) CountTrace(HITRACE_TAG_GRAPHIC_AGP | HITRACE_TAG_COMMERCIAL, name, value)
31e9297d28Sopenharmony_ci#define RS_TRACE_FUNC() RS_TRACE_NAME(__func__)
32e9297d28Sopenharmony_ci
33e9297d28Sopenharmony_ci#elif defined(ROSEN_ANDROID) && !defined(RUNTIME_MODE_RELEASE)
34e9297d28Sopenharmony_ci#include "rs_trace_crossplatform.h"
35e9297d28Sopenharmony_ci#else
36e9297d28Sopenharmony_ci
37e9297d28Sopenharmony_ci#define ROSEN_TRACE_BEGIN(tag, name)
38e9297d28Sopenharmony_ci#define RS_TRACE_BEGIN(name)
39e9297d28Sopenharmony_ci#define ROSEN_TRACE_END(tag)
40e9297d28Sopenharmony_ci#define RS_TRACE_END()
41e9297d28Sopenharmony_ci#define RS_TRACE_NAME_FMT(fmt, ...)
42e9297d28Sopenharmony_ci#define RS_ASYNC_TRACE_BEGIN(name, value)
43e9297d28Sopenharmony_ci#define RS_ASYNC_TRACE_END(name, value)
44e9297d28Sopenharmony_ci#define RS_TRACE_INT(name, value)
45e9297d28Sopenharmony_ci#define RS_TRACE_NAME(name)
46e9297d28Sopenharmony_ci#define RS_TRACE_FUNC()
47e9297d28Sopenharmony_ci#endif //ROSEN_TRACE_DISABLE
48e9297d28Sopenharmony_ci
49e9297d28Sopenharmony_ci#endif // GRAPHIC_RS_TRACE_H
50