Skip to content

Commit b839678

Browse files
cvjpixar-oss
authored andcommitted
Change existing TRACE_DISABLE preprocessor define to TRACE_ENABLE.
Tracing remains enabled by default. (adapted from github pull request #3645) Closes #3645 (Internal change: 2379816)
1 parent 229a25c commit b839678

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

pxr/base/trace/overview.dox

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ Adding trace instrumentation macros has the following overhead:
174174
The dynamic versions of the macros TRACE_FUNCTION_DYNAMIC(), TRACE_SCOPE_DYNAMIC() have a much higher overhead than the static versions. The reason for this is that for the static versions, the names of the scopes are compiled as constexpr data, but the dynamic versions construct strings at runtime. This overhead of dynamic macros is true whether tracing is enabled or not. Because of this, the static versions should be preferred whenever possible.
175175
</li>
176176
</ul>
177-
It is possible to disable TRACE macros from generating code by defining TRACE_DISABLE in the preprocessor.
177+
It is possible to disable TRACE macros from generating code by defining TRACE_ENABLE to 0 in the preprocessor. TRACE macros are enabled by default.
178178

179179
The TraceCollector class and TRACE macros are thread-safe.
180180

pxr/base/trace/trace.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919

2020
#include <atomic>
2121

22-
#if !defined(TRACE_DISABLE)
22+
#if !defined(TRACE_ENABLE)
23+
#define TRACE_ENABLE 1
24+
#endif
25+
26+
#if TRACE_ENABLE
2327

2428
/// Records a timestamp when constructed and a timespan event when destructed,
2529
/// using the name of the function or method as the key.
@@ -166,7 +170,7 @@ PXR_NS::TraceAuto TF_PP_CAT(TraceAuto_, instance)(str)
166170
#define _TRACE_MARKER_DYNAMIC_INSTANCE(instance, name) \
167171
TraceCollector::GetInstance().MarkerEvent(name);
168172

169-
#else // TRACE_DISABLE
173+
#else // TRACE_ENABLE
170174

171175
#define TRACE_FUNCTION()
172176
#define TRACE_FUNCTION_DYNAMIC(name)
@@ -175,8 +179,10 @@ PXR_NS::TraceAuto TF_PP_CAT(TraceAuto_, instance)(str)
175179
#define TRACE_FUNCTION_SCOPE(name)
176180
#define TRACE_MARKER(name)
177181
#define TRACE_MARKER_DYNAMIC(name)
182+
#define TRACE_COUNTER_DELTA(name, delta)
183+
#define TRACE_COUNTER_VALUE(name, value)
178184

179-
#endif // TRACE_DISABLE
185+
#endif // TRACE_ENABLE
180186

181187
PXR_NAMESPACE_OPEN_SCOPE
182188

0 commit comments

Comments
 (0)