#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 27 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 30 of file sliding_interval.hpp.
|
inline |
Complexity: O(window_size)
Definition at line 57 of file sliding_interval.hpp.
|
inline |
Complexity: O(window_size)
Definition at line 52 of file sliding_interval.hpp.
|
inline |
Complexity: O(window_size)
Definition at line 45 of file sliding_interval.hpp.
|
inline |
window_size
passed to constructor. Definition at line 61 of file sliding_interval.hpp.
|
inline |
replaces the oldest value in interval with value
, i.e slides the interval.
Definition at line 34 of file sliding_interval.hpp.