20 #ifndef RIPPLE_BASICS_DECAYINGSAMPLE_H_INCLUDED
21 #define RIPPLE_BASICS_DECAYINGSAMPLE_H_INCLUDED
31 template <
int Window,
typename Clock>
79 std::chrono::duration_cast<std::chrono::seconds>(now -
m_when)
85 if (elapsed > 4 * Window)
111 template <
int HalfLife,
class Clock>
136 static_assert(HalfLife > 0,
"half life must be positive");
void decay(time_point now)
typename abstract_clock< std::chrono::steady_clock > ::duration::rep value_type
value_type value(time_point now)
Retrieve the current value in normalized units.
Sampling function using exponential decay to provide a continuous value.
typename abstract_clock< std::chrono::steady_clock > ::time_point time_point
DecayingSample(time_point now)
typename Clock::time_point time_point
value_type add(value_type value, time_point now)
Add a new sample.
DecayWindow(time_point now)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
double value(time_point now)
void add(double value, time_point now)
Sampling function using exponential decay to provide a continuous value.
void decay(time_point now)