DriveWorks SDK Reference
5.20.37 Release
For Test and Development only

Trace.hpp
Go to the documentation of this file.
1
2//
3// Notice
4// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
5// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
6// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
7// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8//
9// NVIDIA CORPORATION & AFFILIATES assumes no responsibility for the consequences of use of such
10// information or for any infringement of patents or other rights of third parties that may
11// result from its use. No license is granted by implication or otherwise under any patent
12// or patent rights of NVIDIA CORPORATION & AFFILIATES. No third party distribution is allowed unless
13// expressly authorized by NVIDIA. Details are subject to change without notice.
14// This code supersedes and replaces all information previously supplied.
15// NVIDIA CORPORATION & AFFILIATES products are not authorized for use as critical
16// components in life support devices or systems without express written approval of
17// NVIDIA CORPORATION & AFFILIATES.
18//
19// SPDX-FileCopyrightText: Copyright (c) 2016-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
20// SPDX-License-Identifier: LicenseRef-NvidiaProprietary
21//
22// NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
23// property and proprietary rights in and to this material, related
24// documentation and any modifications thereto. Any use, reproduction,
25// disclosure or distribution of this material and related documentation
26// without an express license agreement from NVIDIA CORPORATION or
27// its affiliates is strictly prohibited.
28//
30
31#ifndef DWTRACE_TRACE_HPP_
32#define DWTRACE_TRACE_HPP_
33
34// Trace Public header file
41
42namespace dw
43{
44namespace trace
45{
46// Supports up to 5 layers of Concatenation
47#define DW_TRACE_GET_MACRO_2(_1, _2, NAME, ...) NAME
48#define DW_TRACE_GET_MACRO_5(_1, _2, _3, _4, _5, NAME, ...) NAME
49
50#define DW_TRACE_TAG(...) \
51 dw::trace::dwtFixedString_t(DW_TRACE_GET_MACRO_5(__VA_ARGS__, DW_TRACE_TAG5, DW_TRACE_TAG4, DW_TRACE_TAG3, DW_TRACE_TAG2, DW_TRACE_TAG1)(__VA_ARGS__))
52#define DW_TRACE_TAG1(STR1) (STR1)
53#define DW_TRACE_TAG2(STR1, STR2) (STR1 "@" STR2)
54#define DW_TRACE_TAG3(STR1, STR2, STR3) (STR1 ":" STR2 "@" STR3)
55#define DW_TRACE_TAG4(STR1, STR2, STR3, STR4) (STR1 ":" STR2 ":" STR3 "@" STR4)
56#define DW_TRACE_TAG5(STR1, STR2, STR3, STR4, STR5) (STR1 ":" STR2 ":" STR3 ":" STR4 "@" STR5)
57
58#define DW_TRACE_PAYLOAD(...) \
59 DW_TRACE_GET_MACRO_2(__VA_ARGS__, DW_TRACE_PAYLOAD2, DW_TRACE_PAYLOAD1) \
60 (__VA_ARGS__)
61#define DW_TRACE_PAYLOAD1(STR1) dw::trace::TraceFunctions::singlePayload(STR1)
62#define DW_TRACE_PAYLOAD2(STR1, STR2) dw::trace::TraceFunctions::joinPayloadChars(STR1, STR2)
63
64// Avoid shadow declaration for nested tracing with unique variables
65#define DW_CONCAT_(x, y) x##y
66#define DW_CONCAT(x, y) DW_CONCAT_(x, y)
67#define DW_UNIQUE_VAR(name) DW_CONCAT(name, __LINE__)
68
75#define DW_TRACE_ENABLE(chan_mask, level) dw::trace::TraceFunctions::dwTraceEnable(chan_mask, level)
76
81#define DW_TRACE_DISABLE(chan_mask) dw::trace::TraceFunctions::dwTraceDisable(chan_mask)
82
86#define DW_TRACE_ENABLE_ALL() dw::trace::TraceFunctions::dwTraceEnableAll()
87
95#define DW_TRACE_MARK(...) dw::trace::TraceFunctions::dwTraceMark(__VA_ARGS__)
96
105#define DW_TRACE_BEGIN(...) dw::trace::TraceFunctions::dwTraceBegin(__VA_ARGS__)
106
115#define DW_TRACE_END(...) dw::trace::TraceFunctions::dwTraceEnd(__VA_ARGS__)
116
126#define DW_TRACE_ASYNC_BEGIN(...) dw::trace::TraceFunctions::dwTraceAsyncBegin(__VA_ARGS__)
127
135#define DW_TRACE_ASYNC_END(...) dw::trace::TraceFunctions::dwTraceAsyncEnd(__VA_ARGS__)
136
146#define DW_TRACE_CUDA_BEGIN(...) dw::trace::TraceFunctions::dwTraceCudaBegin(__VA_ARGS__)
147
156#define DW_TRACE_CUDA_END(...) dw::trace::TraceFunctions::dwTraceCudaEnd(__VA_ARGS__)
157
167#define DW_TRACE_CUDA_BEGIN_ASYNC(...) DW_TRACE_CUDA_BEGIN(__VA_ARGS__)
168
177#define DW_TRACE_CUDA_RECORD_ASYNC(...) dw::trace::TraceFunctions::dwTraceCudaRecordAsync(__VA_ARGS__)
178
195#define DW_TRACE_CUDA_COLLECT_ASYNC(...) dw::trace::TraceFunctions::dwTraceCudaCollectAsync(__VA_ARGS__)
196
209#define DW_TRACE_CUDA_COLLECT_ALL() dw::trace::TraceFunctions::dwTraceCudaCollectAll()
210
219#define DW_TRACE_CORE_INIT(...) dw::trace::TraceFunctions::dwTraceCoreInit(__VA_ARGS__)
220
227#define DW_TRACE_INIT(...) \
228 dw::trace::TraceFunctions::dwTraceCoreInit(__VA_ARGS__); \
229 dw::trace::TraceFunctions::dwTraceWrapperInit(__VA_ARGS__);
230
234#define DW_TRACE_RESET(...) \
235 dw::trace::TraceFunctions::dwTraceReset(__VA_ARGS__); \
236 dw::trace::TraceFunctions::dwTraceWrapperDeinit(__VA_ARGS__);
237
241#define DW_TRACE_RESET_WRAPPER(...) \
242 dw::trace::TraceFunctions::dwTraceWrapperReset(__VA_ARGS__);
243
244#define DW_TRACE_BIND_OUTPUT(...) dw::trace::TraceFunctions::dwTraceBindOutput(__VA_ARGS__)
245
246#define DW_TRACE_REGISTER_CB(...) dw::trace::TraceFunctions::dwTraceRegisterCallback(__VA_ARGS__)
253#define DW_TRACE_FLUSH(isForce) dw::trace::TraceFunctions::dwTraceFlush(isForce)
254
265#define DW_TRACE_SCOPE(...) \
266 dw::trace::CpuScopeTraceEvent DW_UNIQUE_VAR(cpuTraceEvent_){__VA_ARGS__}; \
267 dw::trace::TraceFunctions::dwTraceBegin(__VA_ARGS__);
268
280#define DW_TRACE_CUDA_SCOPE(...) \
281 dw::trace::CudaScopeTraceEvent DW_UNIQUE_VAR(cudaTraceEvent_){false, __VA_ARGS__}; \
282 dw::trace::TraceFunctions::dwTraceCudaBegin(__VA_ARGS__);
283
295#define DW_TRACE_CUDA_SCOPE_ASYNC(...) \
296 dw::trace::CudaScopeTraceEvent DW_UNIQUE_VAR(cudaTraceEvent_){true, __VA_ARGS__}; \
297 dw::trace::TraceFunctions::dwTraceCudaBegin(__VA_ARGS__);
298
305#ifdef __QNX__
306#define DW_TRACE_BOOT_PROFILER(msg) dw::trace::TraceFunctions::dwTraceBootProfiler(msg)
307#else
308#define DW_TRACE_BOOT_PROFILER(msg)
309#endif
310
311} // namespace trace
312} // namespace dw
313
314#endif // DWTRACE_TRACE_HPP_