|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
Timer data with percentile calculations. More...
#include <metric_types.h>

Classes | |
| struct | snapshot |
| Get snapshot of current statistics. More... | |
Public Member Functions | |
| timer_data () | |
| Construct timer with default reservoir size. | |
| timer_data (size_t reservoir_size) | |
| Construct timer with custom reservoir size. | |
| void | record (double duration_ms) |
| Record a duration sample (in milliseconds) | |
| template<typename Rep , typename Period > | |
| void | record (std::chrono::duration< Rep, Period > duration) |
| Record a duration using chrono duration. | |
| double | get_percentile (double percentile) const |
| Get percentile value (0-100) | |
| double | median () const |
| Get median (p50) | |
| double | p90 () const |
| Get p90 value. | |
| double | p95 () const |
| Get p95 value. | |
| double | p99 () const |
| Get p99 value. | |
| double | p999 () const |
| Get p999 value (99.9th percentile) | |
| double | mean () const noexcept |
| Get mean value. | |
| uint64_t | count () const noexcept |
| Get sample count. | |
| double | min () const noexcept |
| Get minimum recorded value. | |
| double | max () const noexcept |
| Get maximum recorded value. | |
| double | stddev () const |
| Get standard deviation. | |
| void | reset () |
| Reset all data. | |
| snapshot | get_snapshot () const |
Public Attributes | |
| std::vector< double > | samples |
| size_t | max_samples |
| uint64_t | total_count = 0 |
| double | sum = 0.0 |
| double | min_value = (std::numeric_limits<double>::max)() |
| double | max_value = (std::numeric_limits<double>::lowest)() |
| bool | sorted = false |
Static Public Attributes | |
| static constexpr size_t | DEFAULT_RESERVOIR_SIZE = 1024 |
Private Member Functions | |
| void | ensure_sorted () const |
Timer data with percentile calculations.
Stores duration samples and provides percentile calculations. Uses a reservoir sampling approach for memory efficiency.
Definition at line 359 of file metric_types.h.
|
inline |
Construct timer with default reservoir size.
Definition at line 373 of file metric_types.h.
References max_samples, and samples.
|
inlineexplicit |
Construct timer with custom reservoir size.
Definition at line 380 of file metric_types.h.
References max_samples, and samples.
|
inlinenoexcept |
Get sample count.
Definition at line 485 of file metric_types.h.
References total_count.
Referenced by demonstrate_timer_scope().

|
inlineprivate |
Definition at line 564 of file metric_types.h.
References samples, and sorted.
Referenced by get_percentile().

|
inline |
Get percentile value (0-100)
| percentile | The percentile to calculate (e.g., 50 for median, 99 for p99) |
Definition at line 420 of file metric_types.h.
References ensure_sorted(), max_value, min_value, and samples.
Referenced by median(), p90(), p95(), p99(), and p999().


|
inline |
Definition at line 548 of file metric_types.h.
References max(), mean(), median(), min(), p90(), p95(), p99(), p999(), stddev(), and total_count.
Referenced by demonstrate_timer(), and TEST_F().


|
inlinenoexcept |
Get maximum recorded value.
Definition at line 499 of file metric_types.h.
References max_value, and total_count.
Referenced by demonstrate_timer_scope(), and get_snapshot().

|
inlinenoexcept |
Get mean value.
Definition at line 478 of file metric_types.h.
References sum, and total_count.
Referenced by demonstrate_timer_scope(), get_snapshot(), and stddev().

|
inline |
Get median (p50)
Definition at line 443 of file metric_types.h.
References get_percentile().
Referenced by get_snapshot(), and TEST_F().


|
inlinenoexcept |
Get minimum recorded value.
Definition at line 492 of file metric_types.h.
References min_value, and total_count.
Referenced by demonstrate_timer_scope(), and get_snapshot().

|
inline |
Get p90 value.
Definition at line 450 of file metric_types.h.
References get_percentile().
Referenced by get_snapshot().


|
inline |
Get p95 value.
Definition at line 457 of file metric_types.h.
References get_percentile().
Referenced by demonstrate_timer_scope(), and get_snapshot().


|
inline |
Get p99 value.
Definition at line 464 of file metric_types.h.
References get_percentile().
Referenced by get_snapshot().


|
inline |
Get p999 value (99.9th percentile)
Definition at line 471 of file metric_types.h.
References get_percentile().
Referenced by get_snapshot().


|
inline |
Record a duration sample (in milliseconds)
Definition at line 388 of file metric_types.h.
References max_samples, max_value, min_value, samples, sorted, sum, and total_count.
Referenced by demonstrate_timer(), record(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and kcenon::monitoring::timer_scope::~timer_scope().

|
inline |
Record a duration using chrono duration.
Definition at line 410 of file metric_types.h.
References record().

|
inline |
Reset all data.
Definition at line 522 of file metric_types.h.
References max_samples, max_value, min_value, samples, sorted, sum, and total_count.
|
inline |
Get standard deviation.
Definition at line 506 of file metric_types.h.
References mean(), and samples.
Referenced by get_snapshot().


|
staticconstexpr |
Definition at line 360 of file metric_types.h.
| size_t kcenon::monitoring::timer_data::max_samples |
Definition at line 363 of file metric_types.h.
Referenced by record(), reset(), timer_data(), and timer_data().
| double kcenon::monitoring::timer_data::max_value = (std::numeric_limits<double>::lowest)() |
Definition at line 367 of file metric_types.h.
Referenced by get_percentile(), max(), record(), and reset().
| double kcenon::monitoring::timer_data::min_value = (std::numeric_limits<double>::max)() |
Definition at line 366 of file metric_types.h.
Referenced by get_percentile(), min(), record(), and reset().
| std::vector<double> kcenon::monitoring::timer_data::samples |
Definition at line 362 of file metric_types.h.
Referenced by ensure_sorted(), get_percentile(), record(), reset(), stddev(), timer_data(), and timer_data().
|
mutable |
Definition at line 368 of file metric_types.h.
Referenced by ensure_sorted(), record(), and reset().
| double kcenon::monitoring::timer_data::sum = 0.0 |
Definition at line 365 of file metric_types.h.
| uint64_t kcenon::monitoring::timer_data::total_count = 0 |
Definition at line 364 of file metric_types.h.
Referenced by count(), get_snapshot(), max(), mean(), min(), record(), and reset().