8#ifndef PXR_BASE_TRACE_EVENT_NODE_H
9#define PXR_BASE_TRACE_EVENT_NODE_H
13#include "pxr/base/trace/api.h"
14#include "pxr/base/trace/event.h"
15#include "pxr/base/trace/eventData.h"
18#include "pxr/base/tf/pointerAndBits.h"
25PXR_NAMESPACE_OPEN_SCOPE
42 using AttributeMap = std::multimap<TfToken, AttributeData>;
46 TRACE_API
static TraceEventNodeRefPtr
New();
52 const TimeStamp beginTime,
53 const TimeStamp endTime,
54 const bool separateEvents) {
55 return TfCreateRefPtr(
57 key, category, beginTime, endTime, separateEvents)
62 TRACE_API
void Append(TraceEventNodeRefPtr &&node);
65 void Append(
const TraceEventNodeRefPtr &node) {
66 Append(TraceEventNodeRefPtr { node });
113 return _attributesAndSeparateEvents.
BitsAs<
bool>();
119 friend class Trace_EventTreeBuilder;
121 void _SetIsSeparateEvents(
bool isSeparate) {
122 _attributesAndSeparateEvents.
SetBits(isSeparate);
130 : _category(category)
132 , _beginTime(beginTime)
134 , _attributesAndSeparateEvents(nullptr, separateEvents)
141 TimeStamp _beginTime;
148PXR_NAMESPACE_CLOSE_SCOPE
uint32_t TraceCategoryId
Categories that a TraceReporter can use to filter events.
This class stores a T * and a small integer in the space of a T *.
void SetBits(Integral val) noexcept
Set the stored bits. No static range checking is performed.
constexpr Integral BitsAs() const noexcept
Retrieve the stored bits as the integral type Integral.
Enable a concrete base class for use with TfRefPtr that inhibits the "unique changed" facility of TfR...
This is a small-vector class with local storage optimization, the local storage can be specified via ...
Represents a range of contiguous elements.
Token for efficient comparison, assignment, and hashing of known strings.
This class holds data that can be stored in TraceEvents.
uint64_t TimeStamp
Time in "ticks".
TraceEventNode is used to represents call tree of a trace.
void Append(const TraceEventNodeRefPtr &node)
Appends node as a child node.
bool IsFromSeparateEvents() const
Returns whether this node was created from a Begin-End pair or a single Timespan event.
TRACE_API const AttributeMap & GetAttributes() const
Return the data associated with this node.
TimeStamp GetTimeDuration() const
Returns the time duration of this scope as GetEndTime() - GetBeginTime()
TimeStamp GetBeginTime() const
Returns the time that this scope started.
TfSpan< const TraceEventNodeRefPtr > GetChildrenRef() const
Returns a TfSpan of references to the children of this node.
TRACE_API void AddAttribute(const TfToken &key, AttributeData &&attr)
Add data to this node.
TraceCategoryId GetCategory() const
Returns the category of this node.
const TfToken & GetKey() const
Returns the name of this node.
TRACE_API void Append(TraceEventNodeRefPtr &&node)
Appends node as a child node.
TimeStamp GetEndTime() const
Returns the time that this scope ended.
TRACE_API void SetBeginAndEndTimesFromChildren()
Sets this node's begin and end time to the time extents of its direct children.
static TraceEventNodeRefPtr New(const TfToken &key, const TraceCategoryId category, const TimeStamp beginTime, const TimeStamp endTime, const bool separateEvents)
Creates a new node with key, category, beginTime and endTime.
static TRACE_API TraceEventNodeRefPtr New()
Creates a new root node.
Standard pointer typedefs.
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...