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 TraceEventNodeRefPtrVector&& children,
55 const bool separateEvents) {
56 return TfCreateRefPtr(
75 TRACE_API
void Append(TraceEventNodeRefPtr node);
117 return _attributesAndSeparateEvents.
BitsAs<
bool>();
121 if (AttributeMap *attrMap = _attributesAndSeparateEvents.
Get()) {
122 _DeleteAttrMap(attrMap);
133 TraceEventNodeRefPtrVector&& children,
136 : _category(category)
138 , _beginTime(beginTime)
140 , _children(
std::make_move_iterator(children.begin()),
141 std::make_move_iterator(children.end()))
142 , _attributesAndSeparateEvents(nullptr, separateEvents)
147 TRACE_API
void _DeleteAttrMap(AttributeMap *attrMap);
152 TimeStamp _beginTime;
159PXR_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 *.
constexpr T * Get() const noexcept
Retrieve the pointer.
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.
TRACE_API void Append(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.
TRACE_API TraceEventNodeRefPtr Append(const TfToken &key, TraceCategoryId category, TimeStamp beginTime, TimeStamp endTime, bool separateEvents)
Appends a new child node with key, category, beginTime and endTime.
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.
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, TraceEventNodeRefPtrVector &&children, 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...