25 #ifndef PXR_BASE_TRACE_EVENT_H
26 #define PXR_BASE_TRACE_EVENT_H
30 #include "pxr/base/trace/api.h"
32 #include "pxr/base/trace/key.h"
36 PXR_NAMESPACE_OPEN_SCOPE
55 enum BeginTag { Begin };
57 enum TimespanTag { Timespan };
58 enum MarkerTag { Marker };
59 enum CounterDeltaTag { CounterDelta };
60 enum CounterValueTag { CounterValue };
61 enum DataTag { Data };
119 _type(_InternalEventType::Begin),
130 _type(_InternalEventType::Begin),
139 _type(_InternalEventType::End),
150 _type(_InternalEventType::End),
160 _type(_InternalEventType::Timespan),
167 TimespanTag,
const Key& key,
172 _type(_InternalEventType::Timespan),
182 _type(_InternalEventType::Marker),
193 _type(_InternalEventType::Marker),
204 _type(_InternalEventType::CounterDelta),
206 new (&_payload)
double(value);
216 _type(_InternalEventType::CounterValue),
218 new (&_payload)
double(value);
227 _type(_InternalEventType::ScopeData),
229 new (&_payload)
bool(data);
236 _type(_InternalEventType::ScopeData),
238 new (&_payload) int64_t(data);
245 _type(_InternalEventType::ScopeData),
247 new (&_payload) int64_t(data);
254 _type(_InternalEventType::ScopeData),
256 new (&_payload) uint64_t(data);
263 _type(_InternalEventType::ScopeData),
265 new (&_payload)
double(data);
272 _type(_InternalEventType::ScopeDataLarge),
274 new (&_payload)
const char*(data);
292 enum class _InternalEventType : uint8_t {
303 using PayloadStorage = std::aligned_storage<8, 8>::type;
308 _InternalEventType _type;
310 PayloadStorage _payload;
313 PXR_NAMESPACE_CLOSE_SCOPE
315 #endif // PXR_BASE_TRACE_EVENT_H
TRACE_API TimeStamp GetStartTimeStamp() const
Returns the start time of a timespan event.
TraceEvent(TimespanTag, const Key &key, TimeStamp startTime, TraceCategoryId cat)
Constructor for Timespan events that takes a TimeStamp starttime and automatically sets the end times...
TRACE_API EventType GetType() const
Returns the type of the event.
TraceEvent(TimespanTag, const Key &key, TimeStamp startTime, TimeStamp endTime, TraceCategoryId cat)
Constructor for Timespan events that takes the start time and end time.
The event represents the value of a counter.
TraceEvent(BeginTag, const Key &key, TimeStamp ts, TraceCategoryId cat)
Constructor for Begin events that takes a specific TimeStamp ts.
uint64_t ArchGetTickTime()
Return the current time in system-dependent units.
uint64_t TimeStamp
Time in "ticks".
The event represents the ending timestamp of a scope.
TRACE_API TraceEventData GetData() const
Returns the data stored in a data event.
TraceCategoryId GetCategory() const
Returns the event's category id.
TRACE_API TimeStamp GetEndTimeStamp() const
Returns the end time of a timespan event.
The event is storing a bool.
The event represents an marker without a duration.
TraceEvent(EndTag, const Key &key, TraceCategoryId cat)
Constructor for End events that will automatically set the timestamp from the current time...
This represents an event recorded by a TraceCollector.
The event is an unknown type.
TraceEvent(MarkerTag, const Key &key, TimeStamp ts, TraceCategoryId cat)
Constructor for Mark events that takes a specific TimeStamp ts.
TraceEvent(CounterDeltaTag, const Key &key, double value, TraceCategoryId cat)
Constructor for Counter delta events.
TRACE_API double GetCounterValue() const
Return the counter value associated with this event.
The event represents begin and end timestamp of a scope.
TraceEvent(MarkerTag, const Key &key, TraceCategoryId cat)
Constructor for Marker events that will automatically set the timestamp from the current time...
TraceEvent(CounterValueTag, const Key &key, double value, TraceCategoryId cat)
Constructor for Counter value events.
The event is storing an integer.
This class holds data that can be stored in TraceEvents.
TraceEvent(EndTag, const Key &key, TimeStamp ts, TraceCategoryId cat)
Constructor for End events that takes a specific TimeStamp ts.
DataType
The different types of data that can be stored in a TraceEvent instance.
The event represents the beginning timestamp of a scope.
EventType
Valid event types.
The event stores data that is associated with its enclosing scope.
The event is storing an unsigned integer.
void SetTimeStamp(TimeStamp time)
Sets the events timestamp to time.
The event represents a change in a counter.
TraceEvent(BeginTag, const Key &key, TraceCategoryId cat)
Constructor for Begin events that will automatically set the timestamp from the current time...
uint32_t TraceCategoryId
Categories that a TraceReporter can use to filter events.
const Key & GetKey() const
Return this event's key.
The event is storing a string.
TRACE_API TimeStamp GetTimeStamp() const
Return the time stamp associated with this event.
The event is not storing any data.
High-resolution, low-cost timing routines.
A wrapper around a TraceStaticKeyData pointer that is stored in TraceEvent instances.
The event is storing an double.