#include <userver/utils/sliding_interval.hpp>
Sliding interval of values that provides functions to compute average, min and max values from the last window_size values of interval.
It fits for small window_size values because has O(window_size) complexity on most operations.
Definition at line 26 of file sliding_interval.hpp.
Public Member Functions | |
| SlidingInterval (std::size_t window_size) | |
Create a SlidingInterval of window_size values. | |
| void | Update (T value) |
replaces the oldest value in interval with value, i.e slides the interval. | |
| T | GetSmoothed () const |
| T | GetMinimal () const |
| T | GetMaximum () const |
| std::size_t | GetWindowSize () const |
|
inlineexplicit |
Create a SlidingInterval of window_size values.
Definition at line 29 of file sliding_interval.hpp.
|
inline |
Complexity: O(window_size)
Definition at line 62 of file sliding_interval.hpp.
|
inline |
Complexity: O(window_size)
Definition at line 55 of file sliding_interval.hpp.
|
inline |
Complexity: O(window_size)
Definition at line 46 of file sliding_interval.hpp.
|
inline |
window_size passed to constructor. Definition at line 68 of file sliding_interval.hpp.
|
inline |
replaces the oldest value in interval with value, i.e slides the interval.
Definition at line 35 of file sliding_interval.hpp.