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