RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
rtctk::componentFramework::BufferMonitor< ClockType > Class Template Reference

Monitors min, mean and max occupation of a buffer and publishes them to OLDB. More...

#include <rtctk/componentFramework/bufferMonitor.hpp>

Classes

struct  Result
 

Public Member Functions

 BufferMonitor (ComponentMetricsIf &metrics, const std::string &desc, const std::string &prefix="")
 Construct instance.
 
void Tick (size_t elements, size_t capacity) noexcept
 Method to be called repeatedly from within the hot loop that should be measured.
 
Result GetValue () const
 Method to get the measured durations in microseconds.
 
void Reset ()
 Method to reset the monitor.
 

Detailed Description

template<typename ClockType = std::chrono::steady_clock>
class rtctk::componentFramework::BufferMonitor< ClockType >

Monitors min, mean and max occupation of a buffer and publishes them to OLDB.

Thread Safety
thread-compatible
Template Parameters
ClockTypeclock type to enable unit testing

Constructor & Destructor Documentation

◆ BufferMonitor()

template<typename ClockType = std::chrono::steady_clock>
rtctk::componentFramework::BufferMonitor< ClockType >::BufferMonitor ( ComponentMetricsIf & metrics,
const std::string & desc,
const std::string & prefix = "" )
inline

Construct instance.

Parameters
[in,out]metricsThe metrics service object to which the counter will be published.
[in]descTextual description of the counter.
[in]prefixOptional prefix for counter location in OLDB (needed if multiple instances are required).

Member Function Documentation

◆ GetValue()

template<typename ClockType = std::chrono::steady_clock>
Result rtctk::componentFramework::BufferMonitor< ClockType >::GetValue ( ) const
inline

Method to get the measured durations in microseconds.

Useful if the measured value is also needed for other purpose, e.g. when it should also show up in statistics log messages, etc.

There is no guarantee that all three values stem from the same cycle.

Thread Safety
thread-safe

◆ Reset()

template<typename ClockType = std::chrono::steady_clock>
void rtctk::componentFramework::BufferMonitor< ClockType >::Reset ( )
inline

Method to reset the monitor.

Method must only be called from single thread (same as Tick)!!

◆ Tick()

template<typename ClockType = std::chrono::steady_clock>
void rtctk::componentFramework::BufferMonitor< ClockType >::Tick ( size_t elements,
size_t capacity )
inlinenoexcept

Method to be called repeatedly from within the hot loop that should be measured.

Parameters
elementsnumber of elements currently in buffer.
capacitytotal capacity of the buffer.

Monitors the occupancy every ten seconds and writes results to performance counters that are published to ODLB by the metrics service thread.

Method must only be called from single thread!!


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