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