Logo Search packages:      
Sourcecode: kcpuload version File versions  Download package

void KCPULoad::takeReadingInternal (  )  [protected, virtual]

Take a fresh reading. Subclasses must override this routine.

This routine must update the array upper. If split readings are enabled, it must also update the array lower. If this pop-up is visible, it must also update the string fullReading.

Implements StatPopup.

Definition at line 111 of file kcpuload.cpp.

References StatPopup::dock, StatPopup::fullReading, StatPopup::isSplit(), StatPopup::lower, proc, KCPUProc::readLoad(), KCPUProc::systemPercent(), KCPUProc::systemPercent0(), KCPUProc::systemPercent1(), KCPUProc::totalPercent(), KCPUProc::totalPercent0(), KCPUProc::totalPercent1(), StatPopup::upper, KCPUProc::userPercent(), KCPUProc::userPercent0(), and KCPUProc::userPercent1().

                                   {
    proc->readLoad();

    if (dock[1]) {
        if (isSplit()) {
            upper[0] = proc->userPercent0();
            lower[0] = proc->systemPercent0();
            upper[1] = proc->userPercent1();
            lower[1] = proc->systemPercent1();
        } else {
            upper[0] = proc->totalPercent0();
            upper[1] = proc->totalPercent1();
        }
    } else {
        if (isSplit()) {
            upper[0] = proc->userPercent();
            lower[0] = proc->systemPercent();
        } else {
            upper[0] = proc->totalPercent();
        }
    }

    if (isVisible()) {
        if (dock[1]) {
            if (isSplit()) {
                fullReading.sprintf(i18n(
                    "Current CPU User: %d%%, C0: %d%%, C1: %d%%.\n"
                    "Current CPU System: %d%%, C0: %d%%, C1: %d%%.").latin1(),
                    proc->userPercent(), upper[0], upper[1],
                    proc->systemPercent(), lower[0], lower[1]);
            } else {
                fullReading.sprintf(i18n(
                    "Current CPU usage: %d%%, C0: %d%%, C1: %d%%.").latin1(),
                    proc->totalPercent(), upper[0], upper[1]);
            }
        } else {
            if (isSplit()) {
                fullReading.sprintf(i18n(
                    "Current CPU User: %d%%.\n"
                    "Current CPU System: %d%%.").latin1(),
                    upper[0], lower[0]);
            } else {
                fullReading.sprintf(i18n(
                    "Current CPU usage: %d%%.").latin1(), upper[0]);
            }
        }
    }
}


Generated by  Doxygen 1.6.0   Back to index