28 #include <type_traits> 32 #include <gsl_p/iterator.h> 34 #include "phosphor/platform/core.h" 39 #ifndef PHOSPHOR_CHUNK_PAGE_COUNT 40 #define PHOSPHOR_CHUNK_PAGE_COUNT 1 51 static constexpr
auto chunk_page_count = PHOSPHOR_CHUNK_PAGE_COUNT;
52 static constexpr
auto page_size = 4096;
53 static constexpr
auto array_offset = 64;
54 static constexpr
auto chunk_size =
55 (((page_size * chunk_page_count) - array_offset) /
57 using event_array = std::array<TraceEvent, chunk_size>;
59 using const_iterator = event_array::const_iterator;
90 const TraceEvent& operator[](
const int index)
const;
105 size_t count()
const;
110 const_iterator begin()
const;
115 const_iterator end()
const;
118 unsigned short next_free;
173 virtual void returnChunk(
TraceChunk& chunk) = 0;
182 virtual bool isFull()
const = 0;
218 virtual const TraceChunk& operator[](
const int index)
const = 0;
225 virtual size_t chunk_count()
const = 0;
230 virtual size_t getGeneration()
const = 0;
247 :
public std::iterator<std::bidirectional_iterator_tag,
257 const_reference operator*()
const;
326 return buffer.chunk_begin();
333 return buffer.chunk_end();
354 using buffer_ptr = std::unique_ptr<TraceBuffer>;
360 std::function<buffer_ptr(size_t generation, size_t buffer_size)>;
363 buffer_ptr make_fixed_buffer(
size_t generation,
size_t buffer_size);
366 buffer_ptr make_ring_buffer(
size_t generation,
size_t buffer_size);
chunk_iterable chunks() const
Definition: trace_buffer.h:349
Definition: trace_buffer.h:246
Definition: trace_buffer.h:315
Definition: trace_event.h:40
chunk_iterable(const TraceBuffer &buffer_)
Definition: trace_buffer.h:320
chunk_iterator end()
Definition: trace_buffer.h:332
Definition: trace_buffer.h:148
chunk_iterator begin()
Definition: trace_buffer.h:325
Definition: trace_buffer.h:49
Definition: category_registry.h:32
std::function< buffer_ptr(size_t generation, size_t buffer_size)> trace_buffer_factory
Definition: trace_buffer.h:360
Definition: stats_callback.h:45