25 #ifndef PXR_BASE_TRACE_COLLECTION_H 26 #define PXR_BASE_TRACE_COLLECTION_H 30 #include "pxr/base/trace/api.h" 31 #include "pxr/base/trace/event.h" 32 #include "pxr/base/trace/eventList.h" 33 #include "pxr/base/trace/threads.h" 38 #include <unordered_map> 40 PXR_NAMESPACE_OPEN_SCOPE
51 TF_MALLOC_TAG_NEW(
"Trace",
"TraceCollection");
56 using EventListPtr = std::unique_ptr<EventList>;
123 using KeyTokenCache =
124 std::unordered_map<TraceKey, TfToken, TraceKey::HashFunctor>;
128 void _Iterate(
Visitor& visitor,
bool doReverse)
const;
133 void _IterateEvents(
Visitor&, KeyTokenCache&,
136 using EventTable = std::map<TraceThreadId, EventListPtr>;
138 EventTable _eventsPerThread;
141 PXR_NAMESPACE_CLOSE_SCOPE
143 #endif // PXR_BASE_TRACE_COLLECTION_H TraceCollection & operator=(TraceCollection &&)=default
Move assignment operator.
virtual void OnBeginCollection()=0
Called at the beginning of an iteration.
virtual void OnEndCollection()=0
Called at the end of an iteration.
This class represents an identifier for a thread.
TRACE_API void Iterate(Visitor &visitor) const
Forward iterates over the events of the collection and calls the visitor callbacks.
TRACE_API void ReverseIterate(Visitor &visitor) const
Reverse iterates over the events of the collection and calls the visitor callbacks.
Token for efficient comparison, assignment, and hashing of known strings.
This represents an event recorded by a TraceCollector.
virtual void OnEvent(const TraceThreadId &threadId, const TfToken &key, const TraceEvent &event)=0
Called for every event event with key on thread threadId if AcceptsCategory returns true.
This interface provides a way to access data a TraceCollection.
virtual TRACE_API ~Visitor()
Destructor.
This class represents an ordered collection of TraceEvents and the TraceDynamicKeys and data that the...
virtual void OnEndThread(const TraceThreadId &threadId)=0
Called after the last event of from the thread with threadId is encountered.
This class owns lists of TraceEvent instances per thread, and allows read access to them.
virtual bool AcceptsCategory(TraceCategoryId categoryId)=0
Called before an event with categoryId is visited.
TRACE_API void AddToCollection(const TraceThreadId &id, EventListPtr &&events)
Appends events to the collection.
uint32_t TraceCategoryId
Categories that a TraceReporter can use to filter events.
TraceCollection()=default
Constructor.
virtual void OnBeginThread(const TraceThreadId &threadId)=0
Called before the first event of from the thread with threadId is encountered.