Implementation of ComponentMetricsIf.
More...
#include <componentMetrics.hpp>
|
using | CounterTypes = perfc::CounterTypes< perfc::CounterDouble, perfc::CounterU64, perfc::CounterI64 > |
| Defines standard performance counter types: More...
|
|
using | CounterVariant = typename CounterTypes::CounterVariant |
| std::variant of pointers to each supported type in CounterTypes. More...
|
|
using | CounterTypes = perfc::CounterTypes< perfc::CounterDouble, perfc::CounterU64, perfc::CounterI64 > |
| Defines standard performance counter types: More...
|
|
using | CounterVariant = typename CounterTypes::CounterVariant |
| std::variant of pointers to each supported type in CounterTypes. More...
|
|
Implementation of ComponentMetricsIf.
Telemetry metrics are published to OLDB using a common root specified during construction:
- Precondition
- <root>/counter/ base for all counters.
- Precondition
- <root>/counter/<id>/ base path for counter identified by CounterMetricInfo::GetId().
- Precondition
- <root>/counter/<id>/value counter value.
- Precondition
- <root>/counter/<id>/description CounterMetricInfo::GetDescription()
- Precondition
- <root>/thread/ base for all threads.
- Precondition
- <root>/thread/<id>/ base path for thread identified by ThreadMetricInfo::GetId().
- Precondition
- <root>/thread/<id>/description ThreadMetricInfo::GetDescription()
- Precondition
- <root>/thread/<id>/status Read from /proc/<pid>/task/<tid>/status.
- Precondition
- <root>/thread/<id>/sched Read from /proc/<pid>/task/<tid>/sched.
◆ CounterTypes
Defines standard performance counter types:
- Double without timestamp
- Unsigned 64bit integer without timestamp.
- Signed 64bit integer without timestamp.
◆ CounterVariant
std::variant of pointers to each supported type in CounterTypes.
I.e.: std::variant<perfc::CounterDouble*, ...>
◆ ComponentMetrics()
- Parameters
-
oldb | Interface used to publish metrics. |
root | Path to the root where all metrics will be published. |
logger | Logger instance to use. |
initial_params | initial parameters. If unspecified the poll intervals is set to 5s and thread nice to 5. |
◆ ~ComponentMetrics()
rtctk::componentFramework::ComponentMetrics::~ComponentMetrics |
( |
| ) |
|
|
noexcept |
Destructor will automatically stop monitoring.
◆ AddCounter()
Add a counter to be included in component metrics, identified by its address, together with info to the register.
- Precondition
- counter must point to a valid counter object.
- Note
- The caller must ensure that the counter is deregistered before the counter is deleted. The returned RAII object aims to facilitate this by unregistering on destruction.
- Parameters
-
counter | Pointer to any of the supported counter types. |
info | A info object to be associated with counter. |
- Returns
- Non-empty RAII registration management object that automatically deregisters the counter when destroyed (or manually released).
- Exceptions
-
Implements rtctk::componentFramework::ComponentMetricsIf.
◆ AddThread()
void rtctk::componentFramework::ComponentMetrics::AddThread |
( |
pid_t |
thread, |
|
|
ThreadMetricInfo |
info |
|
) |
| |
|
overridevirtual |
Add a thread to be included in component metrics.
Thread will be automatically removed if thread is destroyed.
- Note
- The thread is identified by pid_t not a pthread_t.
- Parameters
-
thread | Linux thread identifier (not std::thread/pthread). |
info | Associated information about thread. |
- Exceptions
-
Implements rtctk::componentFramework::ComponentMetricsIf.
◆ IsMonitoring()
bool rtctk::componentFramework::ComponentMetrics::IsMonitoring |
( |
| ) |
|
|
overridevirtualnoexcept |
◆ RemoveCounter()
bool rtctk::componentFramework::ComponentMetrics::RemoveCounter |
( |
CounterVariant |
counter | ) |
|
|
overridevirtual |
◆ RemoveThread()
void rtctk::componentFramework::ComponentMetrics::RemoveThread |
( |
pid_t |
thread | ) |
|
|
overridevirtual |
◆ StartMonitoring()
void rtctk::componentFramework::ComponentMetrics::StartMonitoring |
( |
| ) |
|
|
overridevirtual |
◆ StopMonitoring()
void rtctk::componentFramework::ComponentMetrics::StopMonitoring |
( |
| ) |
|
|
overridevirtualnoexcept |
◆ UpdateParams()
Updates parameters from params.
There is no guarantee that parameters are applied synchronously. For example if monitoring is already active an update of polling interval could be applied when scheduling next interval.
- Parameters
-
params | Parameters to update. Only members containing a value are considered. |
Implements rtctk::componentFramework::ComponentMetricsIf.
The documentation for this class was generated from the following files: