1 #ifndef FWCore_Utilities_RunningAverage_H 2 #define FWCore_Utilities_RunningAverage_H 9 namespace running_average {
24 for (
auto&
i : m_buffer)
28 int mean()
const {
return m_mean /
N; }
37 while (!m_curr.compare_exchange_weak(e, e + 1))
40 int old = m_buffer[
k];
41 if (!m_buffer[k].compare_exchange_strong(old, q))
RunningAverage(unsigned int k=4)
Abs< T >::type abs(const T &t)
std::array< std::atomic< int >, N > m_buffer
std::atomic< int > m_mean
std::atomic< int > m_curr
void update(unsigned int q)