File size: 8,268 Bytes
d8ab1df |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
Trace module — pxr-usd-api 105.1 documentation
pxr-usd-api
»
Modules »
Trace module
# Trace module
Summary: The Trace module provides performance tracking utility classes for counting, timing, measuring, recording, and reporting events.
Trace – Utilities for counting and recording events.
Classes:
AggregateNode
A representation of a call tree.
Collector
This is a singleton class that records TraceEvent instances and populates TraceCollection instances.
Reporter
This class converts streams of TraceEvent objects into call trees which can then be used as a data source to a GUI or written out to a file.
Functions:
TraceFunction(obj)
A decorator that enables tracing the function that it decorates.
TraceMethod(obj)
A convenience.
TraceScope(label)
A context manager that calls BeginEvent on the global collector on enter and EndEvent on exit.
class pxr.Trace.AggregateNode
A representation of a call tree. Each node represents one or more
calls that occurred in the trace. Multiple calls to a child node are
aggregated into one node.
Attributes:
children
list[TraceAggregateNodePtr]
count
int
exclusiveCount
int
exclusiveTime
TimeStamp
expanded
bool
expired
True if this object has expired, False otherwise.
id
Id
inclusiveTime
TimeStamp
key
str
property children
list[TraceAggregateNodePtr]
Type
type
property count
int
Returns the call count of this node.
recursive determines if recursive calls are counted.
Type
type
property exclusiveCount
int
Returns the exclusive count.
Type
type
property exclusiveTime
TimeStamp
Returns the time spent in this node but not its children.
Type
type
property expanded
bool
Returns whether this node is expanded in a gui.
type : None
Sets whether or not this node is expanded in a gui.
Type
type
property expired
True if this object has expired, False otherwise.
property id
Id
Returns the node’s id.
Type
type
property inclusiveTime
TimeStamp
Returns the total time of this node ands its children.
Type
type
property key
str
Returns the node’s key.
Type
type
class pxr.Trace.Collector
This is a singleton class that records TraceEvent instances and
populates TraceCollection instances.
All public methods of TraceCollector are safe to call from any thread.
Methods:
BeginEvent(key)
Record a begin event with key if Category is enabled.
BeginEventAtTime(key, ms)
Record a begin event with key at a specified time if Category is enabled.
Clear()
Clear all pending events from the collector.
EndEvent(key)
Record an end event with key if Category is enabled.
EndEventAtTime(key, ms)
Record an end event with key at a specified time if Category is enabled.
GetLabel()
Return the label associated with this collector.
Attributes:
enabled
bool
expired
True if this object has expired, False otherwise.
pythonTracingEnabled
None
BeginEvent(key) → TimeStamp
Record a begin event with key if Category is enabled.
A matching end event is expected some time in the future.
If the key is known at compile time BeginScope and Scope
methods are preferred because they have lower overhead.
The TimeStamp of the TraceEvent or 0 if the collector is disabled.
BeginScope
Scope
Parameters
key (Key) –
BeginEventAtTime(key, ms) → None
Record a begin event with key at a specified time if Category is
enabled.
This version of the method allows the passing of a specific number of
elapsed milliseconds, ms, to use for this event. This method is used
for testing and debugging code.
Parameters
key (Key) –
ms (float) –
Clear() → None
Clear all pending events from the collector.
No TraceCollection will be made for these events.
EndEvent(key) → TimeStamp
Record an end event with key if Category is enabled.
A matching begin event must have preceded this end event.
If the key is known at compile time EndScope and Scope methods are
preferred because they have lower overhead.
The TimeStamp of the TraceEvent or 0 if the collector is disabled.
EndScope
Scope
Parameters
key (Key) –
EndEventAtTime(key, ms) → None
Record an end event with key at a specified time if Category is
enabled.
This version of the method allows the passing of a specific number of
elapsed milliseconds, ms, to use for this event. This method is used
for testing and debugging code.
Parameters
key (Key) –
ms (float) –
GetLabel() → str
Return the label associated with this collector.
property enabled
bool
Returns whether collection of events is enabled for DefaultCategory.
type : None
Enables or disables collection of events for DefaultCategory.
Type
classmethod type
property expired
True if this object has expired, False otherwise.
property pythonTracingEnabled
None
Set whether automatic tracing of all python scopes is enabled.
type : bool
Returns whether automatic tracing of all python scopes is enabled.
Type
type
class pxr.Trace.Reporter
This class converts streams of TraceEvent objects into call trees
which can then be used as a data source to a GUI or written out to a
file.
Methods:
ClearTree()
Clears event tree and counters.
GetLabel()
Return the label associated with this reporter.
Report(s, iterationCount)
Generates a report to the ostream s, dividing all times by iterationCount.
ReportChromeTracing(s)
Generates a timeline trace report suitable for viewing in Chrome's trace viewer.
ReportChromeTracingToFile
ReportTimes(s)
Generates a report of the times to the ostream s.
UpdateTraceTrees()
This fully re-builds the event and aggregate trees from whatever the current collection holds.
Attributes:
aggregateTreeRoot
AggregateNode
expired
True if this object has expired, False otherwise.
foldRecursiveCalls
bool
globalReporter
groupByFunction
bool
shouldAdjustForOverheadAndNoise
None
ClearTree() → None
Clears event tree and counters.
GetLabel() → str
Return the label associated with this reporter.
Report(s, iterationCount) → None
Generates a report to the ostream s, dividing all times by
iterationCount.
Parameters
s (ostream) –
iterationCount (int) –
ReportChromeTracing(s) → None
Generates a timeline trace report suitable for viewing in Chrome’s
trace viewer.
Parameters
s (ostream) –
ReportChromeTracingToFile()
ReportTimes(s) → None
Generates a report of the times to the ostream s.
Parameters
s (ostream) –
UpdateTraceTrees() → None
This fully re-builds the event and aggregate trees from whatever the
current collection holds.
It is ok to call this multiple times in case the collection gets
appended on inbetween.
If we want to have multiple reporters per collector, this will need to
be changed so that all reporters reporting on a collector update their
respective trees.
property aggregateTreeRoot
AggregateNode
Returns the root node of the aggregated call tree.
Type
type
property expired
True if this object has expired, False otherwise.
property foldRecursiveCalls
bool
Returns the current setting for recursion folding for stack trace
event reporting.
type : None
When stack trace event reporting, this sets whether or not recursive
calls are folded in the output.
Recursion folding is useful when the stacks contain deep recursive
structures.
Type
type
globalReporter = <pxr.Trace.Reporter object>
property groupByFunction
bool
Returns the current group-by-function state.
type : None
This affects only stack trace event reporting.
If true then all events in a function are grouped together
otherwise events are split out by address.
Type
type
property shouldAdjustForOverheadAndNoise
None
Set whether or not the reporter should adjust scope times for overhead
and noise.
Type
type
pxr.Trace.TraceFunction(obj)
A decorator that enables tracing the function that it decorates.
If you decorate with ‘TraceFunction’ the function will be traced in the
global collector.
pxr.Trace.TraceMethod(obj)
A convenience. Same as TraceFunction but changes the recorded
label to use the term ‘method’ rather than ‘function’.
pxr.Trace.TraceScope(label)
A context manager that calls BeginEvent on the global collector on enter
and EndEvent on exit.
© Copyright 2019-2023, NVIDIA.
Last updated on Nov 14, 2023.
|