// Windows의 loadavg 가져오기. 문제가 있을 경우 false 반환.
function getWindowsLoadAvg()
{
    $wmi = new COM('Winmgmts://');
    if (is_object($wmi) === false) return false;

    $server = $wmi->execquery("SELECT LoadPercentage FROM Win32_Processor");
    if (is_object($server) === false) return false;

    $numCpu = 0;
    $totalLoadAvg = 0;
    foreach ($server as $k=>$cpu) {
        ++$numCpu;
        $totalLoadAvg += $cpu->loadpercentage / 100;
    }

    return round($totalLoadAvg / $numCpu, 2);
}








.

Posted by bloodguy
,