Compute Graph Framework SDK Reference  5.10
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 DWFRAMEWORK_DWNODES_DWTRACE_TRACECOLLECTORNODE_DWTRACECOLLECTORNODE_HPP_
32#define DWFRAMEWORK_DWNODES_DWTRACE_TRACECOLLECTORNODE_DWTRACECOLLECTORNODE_HPP_
33
34#include <dw/trace/core/TraceTypes.hpp>
35#include <dwcgf/node/Node.hpp>
38#include <dwcgf/port/Port.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 static constexpr char LOG_TAG[] = "dwTraceCollectorNode";
95
96 static constexpr auto describeInputPorts()
97 {
100 }
101
102 static constexpr auto describeOutputPorts()
103 {
104 return describePortCollection();
105 }
106
107 static constexpr auto describePasses()
108 {
110 describePass("SETUP"_sv, DW_PROCESSOR_TYPE_CPU),
111 describePass("PASS_PROCESS"_sv, DW_PROCESSOR_TYPE_CPU),
112 describePass("TEARDOWN"_sv, DW_PROCESSOR_TYPE_CPU));
113 }
114
115 static constexpr auto describeParameters()
116 {
117 return describeConstructorArguments<dwTraceCollectorNodeParams, dwContextHandle_t>(
120 bool,
121 "stmControlTracing"_sv,
122 &dwTraceCollectorNodeParams::stmControlTracing),
124 bool,
125 "enabled"_sv,
128 dw::core::FixedString<384>,
129 "filePath"_sv,
132 uint64_t,
133 "channelMask"_sv,
136 bool,
137 "fileBackendEnabled"_sv,
140 bool,
141 "networkBackendEnabled"_sv,
144 dw::core::FixedString<16>,
145 "ipAddr"_sv,
148 uint16_t,
149 "serverPort"_sv,
152 bool,
153 "nvtxBackendEnabled"_sv,
156 uint32_t,
157 "tracingLevel"_sv,
160 bool,
161 "ftraceBackendEnabled"_sv,
164 bool,
165 "memTraceEnabled"_sv,
168 bool,
169 "fullMemUsage"_sv,
172 bool,
173 "diskIOStatsEnabled"_sv,
176 uint32_t,
177 "maxFileSizeMB"_sv,
181 dwContextHandle_t)));
182 }
183
184 static std::unique_ptr<dwTraceCollectorNode> create(ParameterProvider& provider);
185
186 dwTraceCollectorNode(const dwTraceCollectorNodeParams& params, const dwContextHandle_t ctx); // context handle is not required in this node
187
188 dwStatus setAsyncReset() override
189 {
190 return Exception::guardWithReturn([&]() {
191 auto asyncResetNode = dynamic_cast<IAsyncResetable*>(m_impl.get());
192 if (asyncResetNode != nullptr)
193 {
194 return asyncResetNode->setAsyncReset();
195 }
196 return DW_FAILURE;
197 },
198 dw::core::Logger::Verbosity::DEBUG);
199 }
200
201 dwStatus executeAsyncReset() override
202 {
203 return Exception::guardWithReturn([&]() {
204 auto asyncResetNode = dynamic_cast<IAsyncResetable*>(m_impl.get());
205 if (asyncResetNode != nullptr)
206 {
207 return asyncResetNode->executeAsyncReset();
208 }
209 return DW_FAILURE;
210 },
211 dw::core::Logger::Verbosity::DEBUG);
212 }
213};
214
215} // namespace framework
216} // namespace dw
217
218#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...)
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 describePortCollection(Args &&... args)
dw::core::FixedString< 384 > filePath
constexpr std::tuple< dw::core::StringView, dwProcessorType > describePass(dw::core::StringView const &&name, dwProcessorType processorType)
uint32_t channelMask
Definition: dwTraceNode.hpp:53
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: Buffer.hpp:40