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

Real-time event latency and performance statistics tracker. Zero dynamic memory allocation. Tracks min, max, total queue latency and handler duration. More...

#include <ProfilerPolicies.hpp>

+ Inheritance diagram for corium::profiler::LatencyTracker< QueueCapacity >:
+ Collaboration diagram for corium::profiler::LatencyTracker< 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.
 
bool isEnabled () const noexcept
 Check if runtime profiling is enabled.
 
 LatencyTracker () noexcept=default
 
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 &, uint8_t, 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 QueueCapacity = 1024>
class corium::profiler::LatencyTracker< QueueCapacity >

Real-time event latency and performance statistics tracker. Zero dynamic memory allocation. Tracks min, max, total queue latency and handler duration.

Template Parameters
QueueCapacityCapacity of the parallel post-timestamp ring buffer (must match the event queue capacity for accurate per-event latency tracking).

Constructor & Destructor Documentation

◆ LatencyTracker()

template<std::size_t QueueCapacity = 1024>
corium::profiler::LatencyTracker< QueueCapacity >::LatencyTracker ( )
defaultnoexcept

Member Function Documentation

◆ averageExecutionDurationUs()

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

Average handler execution duration in microseconds.

◆ averageQueueLatencyUs()

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

Average queue latency in microseconds.

◆ disable()

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

Disable runtime profiling.

+ Here is the call graph for this function:

◆ enable()

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

Enable runtime profiling.

+ Here is the call graph for this function:

◆ isEnabled()

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

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
inlinenoexcept

Maximum handler execution duration in microseconds.

◆ maxQueueLatencyUs()

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

Maximum queue latency in microseconds.

◆ minQueueLatencyUs()

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

Minimum queue latency in microseconds.

◆ nowNs()

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

◆ onEventDispatched()

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

◆ onEventPosted()

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

◆ recordPostTime()

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

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 ( )
inlinenoexcept

Reset all accumulated statistics.

◆ setEnabled()

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

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 ( )
inlinenoexcept

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
inlinenoexcept

Total count of dispatched events.

◆ totalPosted()

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

Total count of posted events.


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