Compute Graph Framework SDK Reference  5.8
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-2022 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 DW_FRAMEWORK_TRACECOLLECTOR_NODE_H_
32#define DW_FRAMEWORK_TRACECOLLECTOR_NODE_H_
33
34#include <dwcgf/node/Node.hpp>
37#include <dwcgf/port/Port.hpp>
39/* Need to include the appropriate ChannelPacketTypes.hpp since port initialization requires
40 the parameter_trait overrides. Otherwise, it will be considered as a packet of generic type. */
42
43namespace dw
44{
45namespace framework
46{
47static constexpr uint32_t MAX_INPUT_TRACE_PORTS = 16; // Keep in-sync with ports description of dwTraceCollectorNode
48
50{
51 // Use this flag when traces are deterministic. When there is uncontrollably large amount of trace(Ex. DW Channel traces),
52 // it is good to disable this flag. After disabling this flag traces won't be dropped.
53 bool stmControlTracing;
54 // Enable tracing.
55 bool enabled;
56 // File path where Trace*.txt will be stored if fileBackend is enabled.
57 std::string filePath;
58 // DWTrace supports total 32 channels. Following mask allows to enable/disable specific channels.
59 // Only Enabled channels allocated buffers for their channel. This value must match channelMask provided to dwTraceNode.
60 uint64_t channelMask;
61 // Enable filebased backend. For this backend post processing script dwTrace.py is needed to infer results.
63 // Enable network socket backend. For this backend post processing
65 // customer's ipAddr
66 std::string ipAddr;
67 // customer's serverPort
68 uint16_t serverPort;
69 // Enable NVTx backend.
71 // Global tracing level, any trace which has level greater than this level will be ignored.
72 uint32_t tracingLevel;
73 // Enable ftrace backend.
75 // Enable mem trace.
77 // Enable full MemUsage.
79 // Enable disk io usage(read/write bytes, io delay total) trace. Disk IO operation
80 // mainly happens when running application after boot. After that data is cached(Depends upon OS and System memory)
81 // 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.
83 // Max file size of generated filebackend based dwtrace. After this file limit reached log rotation will start.
84 uint32_t maxFileSizeMB;
85};
86
91{
92public:
93 static constexpr char LOG_TAG[] = "dwTraceCollectorNode";
94
95 static constexpr auto describeInputPorts()
96 {
99 }
100
101 static constexpr auto describeOutputPorts()
102 {
103 return describePortCollection();
104 }
105
106 static constexpr auto describePasses()
107 {
109 describePass("SETUP"_sv, DW_PROCESSOR_TYPE_CPU),
110 describePass("PASS_PROCESS"_sv, DW_PROCESSOR_TYPE_CPU),
111 describePass("TEARDOWN"_sv, DW_PROCESSOR_TYPE_CPU));
112 }
113
114 static constexpr auto describeParameters()
115 {
116 return describeConstructorArguments<dwTraceCollectorNodeParams, dwContextHandle_t>(
119 bool,
120 "stmControlTracing"_sv,
121 &dwTraceCollectorNodeParams::stmControlTracing),
123 bool,
124 "enabled"_sv,
127 std::string,
128 "filePath"_sv,
131 uint64_t,
132 "channelMask"_sv,
135 bool,
136 "fileBackendEnabled"_sv,
139 bool,
140 "networkBackendEnabled"_sv,
143 std::string,
144 "ipAddr"_sv,
147 uint16_t,
148 "serverPort"_sv,
151 bool,
152 "nvtxBackendEnabled"_sv,
155 uint32_t,
156 "tracingLevel"_sv,
159 bool,
160 "ftraceBackendEnabled"_sv,
163 bool,
164 "memTraceEnabled"_sv,
167 bool,
168 "fullMemUsage"_sv,
171 bool,
172 "diskIOStatsEnabled"_sv,
175 uint32_t,
176 "maxFileSizeMB"_sv,
180 dwContextHandle_t)));
181 }
182
183 static std::unique_ptr<dwTraceCollectorNode> create(ParameterProvider& provider);
184
185 dwTraceCollectorNode(const dwTraceCollectorNodeParams& params, const dwContextHandle_t ctx); // context handle is not required in this node
186
187 dwStatus setAsyncReset() override
188 {
189 return Exception::guardWithReturn([&]() {
190 auto asyncResetNode = dynamic_cast<IAsyncResetable*>(m_impl.get());
191 if (asyncResetNode != nullptr)
192 {
193 return asyncResetNode->setAsyncReset();
194 }
195 return DW_FAILURE;
196 });
197 }
198
199 dwStatus executeAsyncReset() override
200 {
201 return Exception::guardWithReturn([&]() {
202 auto asyncResetNode = dynamic_cast<IAsyncResetable*>(m_impl.get());
203 if (asyncResetNode != nullptr)
204 {
205 return asyncResetNode->executeAsyncReset();
206 }
207 return DW_FAILURE;
208 });
209 }
210};
211
212} // namespace framework
213} // namespace dw
214
215#endif // DW_FRAMEWORK_TRACECOLLECTOR_NODE_H_
#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 tryBlock, dw::core::Logger::Verbosity verbosity=dw::core::Logger::Verbosity::DEBUG)
Definition: Exception.hpp:122
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)
dwTraceNodeData { size_t maxDataSize dwTraceNodeData
constexpr auto describePortCollection(Args &&... args)
constexpr std::tuple< dw::core::StringView, dwProcessorType > describePass(dw::core::StringView const &&name, dwProcessorType processorType)
uint32_t channelMask
Definition: dwTraceNode.hpp:55
constexpr auto describeConstructorArgument(const Args &&... args)
constexpr auto describePassCollection(const Args &&... args)
dwTraceCollectorNodeParams { bool stmControlTracing dwTraceCollectorNodeParams
static constexpr uint32_t MAX_INPUT_TRACE_PORTS
Definition: Exception.hpp:47