15 #ifndef LIBSTATISTICS_COLLECTOR__MOVING_AVERAGE_STATISTICS__MOVING_AVERAGE_HPP_
16 #define LIBSTATISTICS_COLLECTOR__MOVING_AVERAGE_STATISTICS__MOVING_AVERAGE_HPP_
24 #include <type_traits>
30 #include "rcpputils/thread_safety_annotations.hpp"
34 namespace moving_average_statistics
64 double Average()
const RCPPUTILS_TSA_REQUIRES(mutex_);
72 double Max()
const RCPPUTILS_TSA_REQUIRES(mutex_);
80 double Min()
const RCPPUTILS_TSA_REQUIRES(mutex_);
128 mutable std::mutex mutex_;
129 double average_ RCPPUTILS_TSA_GUARDED_BY(mutex_) = 0;
130 double min_ RCPPUTILS_TSA_GUARDED_BY(mutex_) = std::numeric_limits<double>::max();
131 double max_ RCPPUTILS_TSA_GUARDED_BY(mutex_) = std::numeric_limits<double>::min();
132 double sum_of_square_diff_from_mean_ RCPPUTILS_TSA_GUARDED_BY(mutex_) = 0;
133 uint64_t count_ RCPPUTILS_TSA_GUARDED_BY(mutex_) = 0;
139 #endif // LIBSTATISTICS_COLLECTOR__MOVING_AVERAGE_STATISTICS__MOVING_AVERAGE_HPP_