8#ifndef PXR_BASE_TRACE_EVENT_CONTAINER_H
9#define PXR_BASE_TRACE_EVENT_CONTAINER_H
13#include "pxr/base/trace/api.h"
14#include "pxr/base/trace/event.h"
20PXR_NAMESPACE_OPEN_SCOPE
38 static _Node* New(
size_t capacity);
42 static void DestroyList(_Node *head);
45 static void Join(_Node *lhs, _Node *rhs);
48 bool IsFull()
const {
return _end == _sentinel; }
51 const char *p =
reinterpret_cast<const char *
>(
this);
53 return reinterpret_cast<const TraceEvent *
>(p);
60 _Node *GetPrevNode() {
64 const _Node *GetPrevNode()
const {
68 _Node *GetNextNode() {
72 const _Node *GetNextNode()
const {
76 void ClaimEventEntry() {
108 using iterator_category = std::bidirectional_iterator_tag;
110 using difference_type = int64_t;
123 return !operator==(other);
127 return _event == other._event;
160 if (_event == _node->end() && _node->GetNextNode()) {
161 _node = _node->GetNextNode();
162 _event = _node->begin();
167 if (_event == _node->begin()) {
168 _node = _node->GetPrevNode();
169 _event = _node->end();
180 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
200 template <
class... Args>
203 new (_nextEvent++)
TraceEvent(std::forward<Args>(args)...);
204 _back->ClaimEventEntry();
205 if (_back->IsFull()) {
211 const_iterator begin()
const {
212 return const_iterator(_front, _front ? _front->begin() :
nullptr);
215 const_iterator end()
const {
216 return const_iterator(_back, _back ? _back->end() :
nullptr);
219 const_reverse_iterator rbegin()
const {
220 return const_reverse_iterator(end());
223 const_reverse_iterator rend()
const {
224 return const_reverse_iterator(begin());
227 bool empty()
const {
return begin() == end(); }
236 TRACE_API
void Allocate();
242 size_t _blockSizeBytes;
245PXR_NAMESPACE_CLOSE_SCOPE
Bidirectional iterator of TraceEvents.
Holds TraceEvent instances.
TraceEventContainer(TraceEventContainer &&)
Move Constructor.
TraceEventContainer & operator=(TraceEventContainer &&)
Move Assignment.
TraceEventContainer()
Constructor.
TRACE_API void Append(TraceEventContainer &&other)
Append the events in other to the end of this container.
This represents an event recorded by a TraceCollector.