Exemplo n.º 1
0
 double UAWMean::predictUtility(double u) const {
   double s = currentSum;
   // need to subtract oldest entry
   s -= oldest();
   s += u;
   return s / getSize();
 }
Exemplo n.º 2
0
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);
}
Exemplo n.º 3
0
 void UAWMean::addHook(double u) {
   currentSum -= oldest();
   UAWindow::addHook(u);
   currentSum += u;
 }