simple function to get the cpu load with availability to most os platforms because I haven't actually been able to find a similar protocol if you happen to be testing out various os platforms...
function cpu_load():?string {
$load='';
if(strtolower(PHP_OS_FAMILY)=="windows") {
exec("wmic cpu get loadpercentage /all",$out);
if($out) {
foreach($out as $line) {
if($line&&preg_match("/^[0-9]+\$/",$line)) {
$load=$line;
break;
}
}
}
} else {
$load=sys_getloadavg();
}
return $load;
}