Compute Graph Framework SDK Reference  5.12
dwTraceCollectorNode.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) 2020-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 DWFRAMEWORK_DWNODES_DWTRACE_TRACECOLLECTORNODE_DWTRACECOLLECTORNODE_HPP_
32#define DWFRAMEWORK_DWNODES_DWTRACE_TRACECOLLECTORNODE_DWTRACECOLLECTORNODE_HPP_
33
34#include <dwshared/dwtrace/dw/trace/core/TraceTypes.hpp>
35#include <dwcgf/node/Node.hpp>
38#include <dwcgf/port/Port.hpp>
40#include <dwframework/dwnodes/common/channelpackets/SensorCommonTypes.hpp>
41
42namespace dw
43{
44namespace framework
45{
46static constexpr uint32_t MAX_INPUT_TRACE_PORTS{16}; // Keep in-sync with ports description of dwTraceCollectorNode
47
49{
50 // Use this flag when traces are deterministic. When there is uncontrollably large amount of trace(Ex. DW Channel traces),
51 // it is good to disable this flag. After disabling this flag traces won't be dropped.
52 bool stmControlTracing;
53 // Enable tracing.
54 bool enabled;
55 // File path where Trace*.txt will be stored if fileBackend is enabled.
56 dw::core::FixedString<384> filePath;
57 // DWTrace supports total 32 channels. Following mask allows to enable/disable specific channels.
58 // Only Enabled channels allocated buffers for their channel. This value must match channelMask provided to dwTraceNode.
59 uint64_t channelMask;
60 // Enable filebased backend. For this backend post processing script dwTrace.py is needed to infer results.
62 // Enable network socket backend. For this backend post processing
64 // customer's ipAddr
65 dw::core::FixedString<16> ipAddr;
66 // customer's serverPort
67 uint16_t serverPort;
68 // Enable NVTx backend.
70 // Global tracing level, any trace which has level greater than this level will be ignored.
71 uint32_t tracingLevel;
72 // Enable ftrace backend.
74 // Enable mem trace.
76 // Enable full MemUsage.
78 // Enable disk io usage(read/write bytes, io delay total) trace. Disk IO operation
79 // mainly happens when running application after boot. After that data is cached(Depends upon OS and System memory)
80 // For now this info will be dumped for STARTUP channels BEGIN/END, as it is expected that major IO operation happens during program init phase.
82 // Max file size of generated filebackend based dwtrace. After this file limit reached log rotation will start.
83 uint32_t maxFileSizeMB;
84};
85static_assert(std::is_same<decltype(dwTraceCollectorNodeParams::filePath), dw::trace::dwtStringFilepath_t>::value, "Parameter type has diverged from underlying type");
86static_assert(std::is_same<decltype(dwTraceCollectorNodeParams::ipAddr), dw::trace::dwtStringIPAddr_t>::value, "Parameter type has diverged from underlying type");
87
92{
93public:
94 // TODO(csketch): FP -- This is used when the logger is called and not just at assignment.
95 // coverity[autosar_cpp14_a0_1_1_violation] FP: nvbugs/2980283
96 // coverity[autosar_cpp14_m0_1_4_violation] FP: nvbugs/2980283
97 static constexpr char8_t LOG_TAG[]{"dwTraceCollectorNode"};
98
99 // coverity[autosar_cpp14_a7_1_5_violation] RFD Accepted: TID-1984
100 static constexpr auto describeInputPorts()
101 {
102 // TODO(csketch): RFD -- user defined literal being interpreted as c style cast.
103 // coverity[autosar_cpp14_a5_2_2_violation] RFD Pending: TID-1983
105 DW_DESCRIBE_PORT_ARRAY(dwTraceNodeData, MAX_INPUT_TRACE_PORTS, "TRACE"_sv));
106 }
107
108 // coverity[autosar_cpp14_a7_1_5_violation] RFD Accepted: TID-1984
109 static constexpr auto describeOutputPorts()
110 {
111 // TODO(csketch): RFD -- user defined literal being interpreted as c style cast.
112 // coverity[autosar_cpp14_a5_2_2_violation] RFD Pending: TID-1983
113 // TODO(csketch): RFD -- user defined literal being interpreted as c style cast.
114 // coverity[autosar_cpp14_a5_2_2_violation] RFD Pending: TID-1983
115 return describePortCollection();
116 }
117
118 // coverity[autosar_cpp14_a7_1_5_violation] RFD Accepted: TID-1984
119 static constexpr auto describePasses()
120 {
122 describePass(StringView{"SETUP"}, DW_PROCESSOR_TYPE_CPU),
123 describePass(StringView{"PASS_PROCESS"}, DW_PROCESSOR_TYPE_CPU),
124 describePass(StringView{"TEARDOWN"}, DW_PROCESSOR_TYPE_CPU));
125 }
126
127 // coverity[autosar_cpp14_a7_1_5_violation] RFD Accepted: TID-1984
128 static constexpr auto describeParameters()
129 {
130 // TODO(csketch): RFD -- user defined literal being interpreted as c style cast.
131 // coverity[autosar_cpp14_a5_2_2_violation] RFD Pending: TID-1983
132 return describeConstructorArguments<dwTraceCollectorNodeParams, dwContextHandle_t>(
135 bool,
136 "stmControlTracing"_sv,
137 &dwTraceCollectorNodeParams::stmControlTracing),
139 bool,
140 "enabled"_sv,
143 dw::core::FixedString<384>,
144 "filePath"_sv,
147 uint64_t,
148 "channelMask"_sv,
151 bool,
152 "fileBackendEnabled"_sv,
155 bool,
156 "networkBackendEnabled"_sv,
159 dw::core::FixedString<16>,
160 "ipAddr"_sv,
163 uint16_t,
164 "serverPort"_sv,
167 bool,
168 "nvtxBackendEnabled"_sv,
171 uint32_t,
172 "tracingLevel"_sv,
175 bool,
176 "ftraceBackendEnabled"_sv,
179 bool,
180 "memTraceEnabled"_sv,
183 bool,
184 "fullMemUsage"_sv,
187 bool,
188 "diskIOStatsEnabled"_sv,
191 uint32_t,
192 "maxFileSizeMB"_sv,
196 dwContextHandle_t)));
197 }
198
199 static std::unique_ptr<dwTraceCollectorNode> create(ParameterProvider& provider);
200
201 dwTraceCollectorNode(const dwTraceCollectorNodeParams& params, const dwContextHandle_t ctx); // context handle is not required in this node
202
203 dwStatus setAsyncReset() override
204 {
206 // coverity[autosar_cpp14_a8_5_2_violation] FP: nvbugs/3904083
207 auto asyncResetNode = dynamic_cast<IAsyncResetable*>(m_impl.get());
208 if (asyncResetNode != nullptr)
209 {
210 return asyncResetNode->setAsyncReset();
211 }
212 return DW_FAILURE;
213 },
214 dw::core::Logger::Verbosity::DEBUG);
215 }
216
217 dwStatus executeAsyncReset() override
218 {
220 // coverity[autosar_cpp14_a8_5_2_violation] FP: nvbugs/3904083
221 auto asyncResetNode = dynamic_cast<IAsyncResetable*>(m_impl.get());
222 if (asyncResetNode != nullptr)
223 {
224 return asyncResetNode->executeAsyncReset();
225 }
226 return DW_FAILURE;
227 },
228 dw::core::Logger::Verbosity::DEBUG);
229 }
230};
231
232} // namespace framework
233} // namespace dw
234
235#endif // DWFRAMEWORK_DWNODES_DWTRACE_TRACECOLLECTORNODE_DWTRACECOLLECTORNODE_HPP_
#define DW_DESCRIBE_UNNAMED_PARAMETER(TYPE_NAME, args...)
#define DW_DESCRIBE_PARAMETER(TYPE_NAME, args...)
#define DW_DESCRIBE_PORT_ARRAY(TYPE_NAME, ARRAYSIZE, args...)
static dwStatus guardWithReturn(TryBlock const &tryBlock, ::dw::core::Logger::Verbosity verbosity=::dw::core::Logger::Verbosity::ERROR)
Definition: Exception.hpp:171
virtual dwStatus setAsyncReset()=0
Set the async reset flag.
virtual dwStatus executeAsyncReset()=0
Executes a reset if the async reset flag is set.
The interface to access parameter values identified by name and/or (semantic) type.
dwTraceCollectorNode(const dwTraceCollectorNodeParams &params, const dwContextHandle_t ctx)
static std::unique_ptr< dwTraceCollectorNode > create(ParameterProvider &provider)
dw::core::FixedString< 16 > ipAddr
constexpr auto describeConstructorArgument(const Args &&... args) -> dw::core::Tuple< Args... >
dw::core::FixedString< 384 > filePath
constexpr std::tuple< dw::core::StringView, dwProcessorType > describePass(dw::core::StringView const &&name, dwProcessorType processorType)
constexpr auto describePassCollection(const Args &&... args) -> std::tuple< Args... >
constexpr auto describePortCollection(Args &&... args) -> dw::core::Tuple< Args... >
dwTraceCollectorNodeParams { bool stmControlTracing dwTraceCollectorNodeParams
static constexpr uint32_t MAX_INPUT_TRACE_PORTS
Definition: Buffer.hpp:40