Hi
i want to display runtime server load using php code. I find the below code from other website but i dont know i am going on the correct way.
Pleae help me.
function get_server_load()
{
$load=array();
if (stristr(PHP_OS, 'win'))
{
$wmi = new COM("Winmgmts://");
$server = $wmi->execquery("SELECT LoadPercentage FROM Win32_Processor");
$cpu_num = 0;
$load_total = 0;
foreach($server as $cpu)
{
$cpu_num++;
$load_total += $cpu->loadpercentage;
}
$load[]= round($load_total/$cpu_num);
}
else
{
$load = sys_getloadavg();
}
return $load;
}
echo implode(' ',get_server_load());