Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
Loading...
Searching...
No Matches
kcenon::monitoring::summary_data Struct Reference

Summary statistics for metrics. More...

#include <metric_types.h>

Collaboration diagram for kcenon::monitoring::summary_data:
Collaboration graph

Public Member Functions

void add_sample (double value)
 Add sample to summary.
 
double mean () const noexcept
 Get mean value.
 
void reset ()
 Reset summary.
 

Public Attributes

uint64_t count = 0
 
double sum = 0.0
 
double min_value = (std::numeric_limits<double>::max)()
 
double max_value = (std::numeric_limits<double>::lowest)()
 

Detailed Description

Summary statistics for metrics.

Examples
custom_metric_types_example.cpp.

Definition at line 318 of file metric_types.h.

Member Function Documentation

◆ add_sample()

void kcenon::monitoring::summary_data::add_sample ( double value)
inline

Add sample to summary.

Examples
custom_metric_types_example.cpp.

Definition at line 327 of file metric_types.h.

327 {
328 count++;
329 sum += value;
330 min_value = (std::min)(min_value, value);
331 max_value = (std::max)(max_value, value);
332 }

References count, max_value, min_value, and sum.

Referenced by demonstrate_summary(), TEST_F(), and TEST_F().

Here is the caller graph for this function:

◆ mean()

double kcenon::monitoring::summary_data::mean ( ) const
inlinenoexcept

Get mean value.

Examples
custom_metric_types_example.cpp.

Definition at line 337 of file metric_types.h.

337 {
338 return count > 0 ? sum / count : 0.0;
339 }

References count, and sum.

Referenced by demonstrate_summary().

Here is the caller graph for this function:

◆ reset()

void kcenon::monitoring::summary_data::reset ( )
inline

Reset summary.

Examples
custom_metric_types_example.cpp.

Definition at line 344 of file metric_types.h.

344 {
345 count = 0;
346 sum = 0.0;
347 min_value = (std::numeric_limits<double>::max)();
348 max_value = (std::numeric_limits<double>::lowest)();
349 }

References count, max_value, min_value, and sum.

Referenced by demonstrate_summary().

Here is the caller graph for this function:

Member Data Documentation

◆ count

uint64_t kcenon::monitoring::summary_data::count = 0
Examples
custom_metric_types_example.cpp.

Definition at line 319 of file metric_types.h.

Referenced by add_sample(), demonstrate_summary(), mean(), and reset().

◆ max_value

double kcenon::monitoring::summary_data::max_value = (std::numeric_limits<double>::lowest)()
Examples
custom_metric_types_example.cpp.

Definition at line 322 of file metric_types.h.

Referenced by add_sample(), demonstrate_summary(), and reset().

◆ min_value

double kcenon::monitoring::summary_data::min_value = (std::numeric_limits<double>::max)()
Examples
custom_metric_types_example.cpp.

Definition at line 321 of file metric_types.h.

Referenced by add_sample(), demonstrate_summary(), and reset().

◆ sum

double kcenon::monitoring::summary_data::sum = 0.0
Examples
custom_metric_types_example.cpp.

Definition at line 320 of file metric_types.h.

Referenced by add_sample(), demonstrate_summary(), mean(), and reset().


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