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

Estimates the frequency in which Tick is called and publishes result to OLDB. More...

#include <rtctk/componentFramework/frequencyEstimator.hpp>

Public Member Functions

 FrequencyEstimator (ComponentMetricsIf &metrics, const std::string &desc, const std::string &prefix="")
 Construct instance.
 
void Tick () noexcept
 Method to be called repeatedly from within the hot loop that should be measured.
 
double GetValue () const
 Method to get the measured frequency in Hz.
 
void Reset ()
 Method to reset the estimator.
 

Detailed Description

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

Estimates the frequency in which Tick is called and publishes result to OLDB.

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

Constructor & Destructor Documentation

◆ FrequencyEstimator()

template<typename ClockType = std::chrono::steady_clock>
rtctk::componentFramework::FrequencyEstimator< ClockType >::FrequencyEstimator ( 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 of FrequencyEstimator are required).

Member Function Documentation

◆ GetValue()

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

Method to get the measured frequency in Hz.

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

Thread Safety
thread-safe

◆ Reset()

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

Method to reset the estimator.

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

◆ Tick()

template<typename ClockType = std::chrono::steady_clock>
void rtctk::componentFramework::FrequencyEstimator< ClockType >::Tick ( )
inlinenoexcept

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

Computes the frequency every second and writes result to a performance counter that is 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: