|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
Welford's algorithm for computing streaming statistics. More...
#include <stream_aggregator.h>

Public Member Functions | |
| online_statistics ()=default | |
| void | add_value (double value) |
| Add a value to the statistics. | |
| size_t | count () const |
| Get sample count. | |
| double | mean () const |
| Get running mean. | |
| double | variance () const |
| Get running variance (sample variance) | |
| double | stddev () const |
| Get running standard deviation. | |
| double | min () const |
| Get minimum value. | |
| double | max () const |
| Get maximum value. | |
| double | sum () const |
| Get sum of all values. | |
| streaming_statistics | get_statistics () const |
| Get full statistics. | |
| void | reset () |
| Reset statistics. | |
Private Attributes | |
| std::shared_mutex | mutex_ |
| size_t | count_ = 0 |
| double | mean_ = 0.0 |
| double | m2_ = 0.0 |
| double | sum_ = 0.0 |
| double | min_value_ = 0.0 |
| double | max_value_ = 0.0 |
Welford's algorithm for computing streaming statistics.
This class computes running mean, variance, and standard deviation using Welford's numerically stable online algorithm.
Definition at line 58 of file stream_aggregator.h.
|
default |
|
inline |
Add a value to the statistics.
| value | The value to add |
Definition at line 66 of file stream_aggregator.h.
References count_, m2_, max_value_, mean_, min_value_, mutex_, and sum_.
Referenced by kcenon::monitoring::stream_aggregator::add_observation(), TEST_F(), and TEST_F().

|
inline |
Get sample count.
Definition at line 88 of file stream_aggregator.h.
References count_, and mutex_.
Referenced by kcenon::monitoring::stream_aggregator::add_observation(), kcenon::monitoring::stream_aggregator::count(), and TEST_F().

|
inline |
Get full statistics.
Definition at line 146 of file stream_aggregator.h.
References kcenon::monitoring::streaming_statistics::count, count_, m2_, kcenon::monitoring::streaming_statistics::max_value, max_value_, kcenon::monitoring::streaming_statistics::mean, mean_, kcenon::monitoring::streaming_statistics::min_value, min_value_, mutex_, kcenon::monitoring::streaming_statistics::std_deviation, kcenon::monitoring::streaming_statistics::sum, sum_, and kcenon::monitoring::streaming_statistics::variance.
Referenced by kcenon::monitoring::stream_aggregator::get_statistics(), TEST_F(), and TEST_F().

|
inline |
Get maximum value.
Definition at line 130 of file stream_aggregator.h.
References max_value_, and mutex_.
|
inline |
Get running mean.
Definition at line 96 of file stream_aggregator.h.
Referenced by kcenon::monitoring::stream_aggregator::add_observation(), kcenon::monitoring::stream_aggregator::mean(), and TEST_F().

|
inline |
Get minimum value.
Definition at line 122 of file stream_aggregator.h.
References min_value_, and mutex_.
|
inline |
Reset statistics.
Definition at line 166 of file stream_aggregator.h.
References count_, m2_, max_value_, mean_, min_value_, mutex_, and sum_.
Referenced by kcenon::monitoring::stream_aggregator::reset().

|
inline |
Get running standard deviation.
Definition at line 115 of file stream_aggregator.h.
References variance().
Referenced by kcenon::monitoring::stream_aggregator::add_observation(), and kcenon::monitoring::stream_aggregator::stddev().


|
inline |
|
inline |
Get running variance (sample variance)
Definition at line 104 of file stream_aggregator.h.
References count_, m2_, and mutex_.
Referenced by stddev(), TEST_F(), and kcenon::monitoring::stream_aggregator::variance().

|
private |
Definition at line 178 of file stream_aggregator.h.
Referenced by add_value(), count(), get_statistics(), reset(), and variance().
|
private |
Definition at line 180 of file stream_aggregator.h.
Referenced by add_value(), get_statistics(), reset(), and variance().
|
private |
Definition at line 183 of file stream_aggregator.h.
Referenced by add_value(), get_statistics(), max(), and reset().
|
private |
Definition at line 179 of file stream_aggregator.h.
Referenced by add_value(), get_statistics(), mean(), and reset().
|
private |
Definition at line 182 of file stream_aggregator.h.
Referenced by add_value(), get_statistics(), min(), and reset().
|
mutableprivate |
Definition at line 177 of file stream_aggregator.h.
Referenced by add_value(), count(), get_statistics(), max(), mean(), min(), reset(), sum(), and variance().
|
private |
Definition at line 181 of file stream_aggregator.h.
Referenced by add_value(), get_statistics(), reset(), and sum().