double UAWMean::predictUtility(double u) const { double s = currentSum; // need to subtract oldest entry s -= oldest(); s += u; return s / getSize(); }
void LogBuffer::formatStatistics(char **strp, uid_t uid, unsigned int logMask) { log_time oldest(CLOCK_MONOTONIC); pthread_mutex_lock(&mLogElementsLock); // Find oldest element in the log(s) LogBufferElementCollection::iterator it; for (it = mLogElements.begin(); it != mLogElements.end(); ++it) { LogBufferElement *element = *it; if ((logMask & (1 << element->getLogId()))) { oldest = element->getMonotonicTime(); break; } } stats.format(strp, uid, logMask, oldest); pthread_mutex_unlock(&mLogElementsLock); }
void UAWMean::addHook(double u) { currentSum -= oldest(); UAWindow::addHook(u); currentSum += u; }