示例#1
0
文件: p.php 项目: php360/ltnmp
        $dif['iowait'] = $stat2[$i]['iowait'] - $stat1[$i]['iowait'];
        $dif['irq'] = $stat2[$i]['irq'] - $stat1[$i]['irq'];
        $dif['softirq'] = $stat2[$i]['softirq'] - $stat1[$i]['softirq'];
        $total = array_sum($dif);
        $cpu = array();
        foreach ($dif as $x => $y) {
            $cpu[$x] = round($y / $total * 100, 2);
        }
        $cpus['cpu' . $i] = $cpu;
    }
    return $cpus;
}
$stat1 = GetCoreInformation();
sleep(1);
$stat2 = GetCoreInformation();
$data = GetCpuPercentages($stat1, $stat2);
$cpu_show = $data['cpu0']['user'] . "%us,  " . $data['cpu0']['sys'] . "%sy,  " . $data['cpu0']['nice'] . "%ni, " . $data['cpu0']['idle'] . "%id,  " . $data['cpu0']['iowait'] . "%wa,  " . $data['cpu0']['irq'] . "%irq,  " . $data['cpu0']['softirq'] . "%softirq";
function makeImageUrl($title, $data)
{
    $api = 'http://api.yahei.net/tz/cpu_show.php?id=';
    $url .= $data['user'] . ',';
    $url .= $data['nice'] . ',';
    $url .= $data['sys'] . ',';
    $url .= $data['idle'] . ',';
    $url .= $data['iowait'];
    $url .= '&chdl=User|Nice|Sys|Idle|Iowait&chdlp=b&chl=';
    $url .= $data['user'] . '%25|';
    $url .= $data['nice'] . '%25|';
    $url .= $data['sys'] . '%25|';
    $url .= $data['idle'] . '%25|';
    $url .= $data['iowait'] . '%25';
示例#2
0
文件: tz.php 项目: noikiy/mdwp
if(isset($_POST['speed']))
{
	$speed=round(100/($_POST['speed']/1000),2);
}
elseif($_GET['speed']=="0")
{
	$speed=6666.67;
}
elseif(isset($_GET['speed']) and $_GET['speed']>0)
{
	$speed=round(100/($_GET['speed']/1000),2); //下载速度:$speed kb/s
}
else
{
	$speed="<font color=\"red\">&nbsp;未探测&nbsp;</font>";
}	
	
	

// 检测函数支持

function isfun($funName = '')
{

    if (!$funName || trim($funName) == '' || preg_match('~[^a-z0-9\_]+~i', $funName, $tmp)) return '错误';

	return (false !== function_exists($funName)) ? '<font color="green">√</font>' : '<font color="red">×</font>';
}
function isfun1($funName = '')
{
    if (!$funName || trim($funName) == '' || preg_match('~[^a-z0-9\_]+~i', $funName, $tmp)) return '错误';