Phosphor
phosphor::TraceChunk Class Reference

#include <trace_buffer.h>

Public Types

using event_array = std::array< TraceEvent, chunk_size >
 
using const_iterator = event_array::const_iterator
 

Public Member Functions

 TraceChunk ()=default
 
void reset ()
 
TraceEventaddEvent ()
 
const TraceEventoperator[] (const int index) const
 
bool isFull () const
 
size_t count () const
 
const_iterator begin () const
 
const_iterator end () const
 

Static Public Attributes

static constexpr auto chunk_page_count = PHOSPHOR_CHUNK_PAGE_COUNT
 
static constexpr auto page_size = 4096
 
static constexpr auto array_offset = 64
 
static constexpr auto chunk_size
 

Detailed Description

TraceChunk represents an array of TraceEvents

The TraceChunk should be used from a single thread to store various events.

Constructor & Destructor Documentation

phosphor::TraceChunk::TraceChunk ( )
default

Constructor for a TraceChunk

Member Function Documentation

TraceEvent & phosphor::TraceChunk::addEvent ( )

Used for adding TraceEvents to the chunk

Returns
A reference to a TraceEvent to be replaced
TraceChunk::const_iterator phosphor::TraceChunk::begin ( ) const
Returns
Const iterator to the start of the chunk
size_t phosphor::TraceChunk::count ( ) const

Determine up to which index of events is initialised

Returns
The number of initialised events in the chunk
TraceChunk::const_iterator phosphor::TraceChunk::end ( ) const
Returns
Const iterator to the last initialised event in the chunk
bool phosphor::TraceChunk::isFull ( ) const

Determine if the chunk is full

Returns
true if the chunk is full (and should be replaced) or false otherwise.
const TraceEvent & phosphor::TraceChunk::operator[] ( const int  index) const

Used for reviewing TraceEvents in the chunk

Valid indexes are from 0 to count(). There is no bounds checking.

Returns
A const reference to a TraceEvent in the chunk that can be used to review the event data
void phosphor::TraceChunk::reset ( )

Reset the state of the TraceChunk

This should be called before the TraceChunk is first used as TraceChunk is a trivial type and requires initialisation.

Member Data Documentation

constexpr auto phosphor::TraceChunk::chunk_size
static
Initial value:
=
(((page_size * chunk_page_count) - array_offset) /
sizeof(TraceEvent))

The documentation for this class was generated from the following files: