Corium 1.1.0
High-Performance Zero-Heap C++20 MPSC Application Runtime
Loading...
Searching...
No Matches
corium::profiler::FlightRecorderProfiler< BufferCapacity, QueueCapacity > Class Template Reference

Combined Flight Recorder and Latency Tracker Profiler. Records historical event traces into a circular in-memory buffer with zero heap allocations. More...

#include <ProfilerPolicies.hpp>

+ Inheritance diagram for corium::profiler::FlightRecorderProfiler< BufferCapacity, QueueCapacity >:
+ Collaboration diagram for corium::profiler::FlightRecorderProfiler< BufferCapacity, QueueCapacity >:

Public Member Functions

double averageExecutionDurationUs () const noexcept
 Average handler execution duration in microseconds.
 
double averageQueueLatencyUs () const noexcept
 Average queue latency in microseconds.
 
void disable () noexcept
 Disable runtime profiling.
 
void enable () noexcept
 Enable runtime profiling.
 
void exportChromeTracingJson (std::ostream &os) const
 Export flight recorder traces to Chrome Tracing JSON.
 
const FlightRecorder< BufferCapacity > & flightRecorder () const noexcept
 Access reference to underlying circular flight recorder.
 
 FlightRecorderProfiler ()=default
 
bool isEnabled () const noexcept
 Check if runtime profiling is enabled.
 
double maxExecutionDurationUs () const noexcept
 Maximum handler execution duration in microseconds.
 
double maxQueueLatencyUs () const noexcept
 Maximum queue latency in microseconds.
 
double minQueueLatencyUs () const noexcept
 Minimum queue latency in microseconds.
 
template<typename EventVariant >
void onEventDispatched (const EventVariant &event, uint8_t priority, uint64_t postTimeNs, uint64_t dispatchTimeNs, uint64_t finishTimeNs) noexcept
 
template<typename EventVariant >
void onEventPosted (const EventVariant &, uint8_t) noexcept
 
void recordPostTime (uint64_t postNs) noexcept
 Record the wall-clock post timestamp for the event being pushed now. Called by EventBus::post() immediately after the event enters the queue.
 
void resetStats () noexcept
 Reset all accumulated statistics.
 
void setEnabled (bool enabled) noexcept
 Enable or disable runtime latency profiling.
 
uint64_t takePostTime () noexcept
 Pop and return the oldest post timestamp (called at dispatch time by EventBus).
 
uint64_t totalDispatched () const noexcept
 Total count of dispatched events.
 
uint64_t totalPosted () const noexcept
 Total count of posted events.
 

Static Public Member Functions

static uint64_t nowNs () noexcept
 

Detailed Description

template<std::size_t BufferCapacity = 256, std::size_t QueueCapacity = 1024>
class corium::profiler::FlightRecorderProfiler< BufferCapacity, QueueCapacity >

Combined Flight Recorder and Latency Tracker Profiler. Records historical event traces into a circular in-memory buffer with zero heap allocations.

Template Parameters
BufferCapacityCapacity of circular flight recorder (power of 2, e.g. 128, 256, 1024).
QueueCapacityCapacity of the parallel post-timestamp ring buffer (should match the event queue capacity for accurate latency measurement; default 1024).

Constructor & Destructor Documentation

◆ FlightRecorderProfiler()

template<std::size_t BufferCapacity = 256, std::size_t QueueCapacity = 1024>
corium::profiler::FlightRecorderProfiler< BufferCapacity, QueueCapacity >::FlightRecorderProfiler ( )
default

Member Function Documentation

◆ averageExecutionDurationUs()

template<std::size_t QueueCapacity = 1024>
double corium::profiler::LatencyTracker< QueueCapacity >::averageExecutionDurationUs ( ) const
inlinenoexceptinherited

Average handler execution duration in microseconds.

◆ averageQueueLatencyUs()

template<std::size_t QueueCapacity = 1024>
double corium::profiler::LatencyTracker< QueueCapacity >::averageQueueLatencyUs ( ) const
inlinenoexceptinherited

Average queue latency in microseconds.

◆ disable()

template<std::size_t QueueCapacity = 1024>
void corium::profiler::LatencyTracker< QueueCapacity >::disable ( )
inlinenoexceptinherited

Disable runtime profiling.

+ Here is the call graph for this function:

◆ enable()

template<std::size_t QueueCapacity = 1024>
void corium::profiler::LatencyTracker< QueueCapacity >::enable ( )
inlinenoexceptinherited

Enable runtime profiling.

+ Here is the call graph for this function:

◆ exportChromeTracingJson()

template<std::size_t BufferCapacity = 256, std::size_t QueueCapacity = 1024>
void corium::profiler::FlightRecorderProfiler< BufferCapacity, QueueCapacity >::exportChromeTracingJson ( std::ostream &  os) const
inline

Export flight recorder traces to Chrome Tracing JSON.

◆ flightRecorder()

template<std::size_t BufferCapacity = 256, std::size_t QueueCapacity = 1024>
const FlightRecorder< BufferCapacity > & corium::profiler::FlightRecorderProfiler< BufferCapacity, QueueCapacity >::flightRecorder ( ) const
inlinenoexcept

Access reference to underlying circular flight recorder.

◆ isEnabled()

template<std::size_t QueueCapacity = 1024>
bool corium::profiler::LatencyTracker< QueueCapacity >::isEnabled ( ) const
inlinenoexceptinherited

Check if runtime profiling is enabled.

+ Here is the caller graph for this function:

◆ maxExecutionDurationUs()

template<std::size_t QueueCapacity = 1024>
double corium::profiler::LatencyTracker< QueueCapacity >::maxExecutionDurationUs ( ) const
inlinenoexceptinherited

Maximum handler execution duration in microseconds.

◆ maxQueueLatencyUs()

template<std::size_t QueueCapacity = 1024>
double corium::profiler::LatencyTracker< QueueCapacity >::maxQueueLatencyUs ( ) const
inlinenoexceptinherited

Maximum queue latency in microseconds.

◆ minQueueLatencyUs()

template<std::size_t QueueCapacity = 1024>
double corium::profiler::LatencyTracker< QueueCapacity >::minQueueLatencyUs ( ) const
inlinenoexceptinherited

Minimum queue latency in microseconds.

◆ nowNs()

template<std::size_t QueueCapacity = 1024>
static uint64_t corium::profiler::LatencyTracker< QueueCapacity >::nowNs ( )
inlinestaticnoexceptinherited

◆ onEventDispatched()

template<std::size_t BufferCapacity = 256, std::size_t QueueCapacity = 1024>
template<typename EventVariant >
void corium::profiler::FlightRecorderProfiler< BufferCapacity, QueueCapacity >::onEventDispatched ( const EventVariant &  event,
uint8_t  priority,
uint64_t  postTimeNs,
uint64_t  dispatchTimeNs,
uint64_t  finishTimeNs 
)
inlinenoexcept
+ Here is the call graph for this function:

◆ onEventPosted()

template<std::size_t QueueCapacity = 1024>
template<typename EventVariant >
void corium::profiler::LatencyTracker< QueueCapacity >::onEventPosted ( const EventVariant &  ,
uint8_t   
)
inlinenoexceptinherited

◆ recordPostTime()

template<std::size_t QueueCapacity = 1024>
void corium::profiler::LatencyTracker< QueueCapacity >::recordPostTime ( uint64_t  postNs)
inlinenoexceptinherited

Record the wall-clock post timestamp for the event being pushed now. Called by EventBus::post() immediately after the event enters the queue.

+ Here is the call graph for this function:

◆ resetStats()

template<std::size_t QueueCapacity = 1024>
void corium::profiler::LatencyTracker< QueueCapacity >::resetStats ( )
inlinenoexceptinherited

Reset all accumulated statistics.

◆ setEnabled()

template<std::size_t QueueCapacity = 1024>
void corium::profiler::LatencyTracker< QueueCapacity >::setEnabled ( bool  enabled)
inlinenoexceptinherited

Enable or disable runtime latency profiling.

+ Here is the caller graph for this function:

◆ takePostTime()

template<std::size_t QueueCapacity = 1024>
uint64_t corium::profiler::LatencyTracker< QueueCapacity >::takePostTime ( )
inlinenoexceptinherited

Pop and return the oldest post timestamp (called at dispatch time by EventBus).

+ Here is the call graph for this function:

◆ totalDispatched()

template<std::size_t QueueCapacity = 1024>
uint64_t corium::profiler::LatencyTracker< QueueCapacity >::totalDispatched ( ) const
inlinenoexceptinherited

Total count of dispatched events.

◆ totalPosted()

template<std::size_t QueueCapacity = 1024>
uint64_t corium::profiler::LatencyTracker< QueueCapacity >::totalPosted ( ) const
inlinenoexceptinherited

Total count of posted events.


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