diff options
Diffstat (limited to 'usr')
-rwxr-xr-x | usr/local/www/index.php | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/usr/local/www/index.php b/usr/local/www/index.php index fa3ed5e..24154b2 100755 --- a/usr/local/www/index.php +++ b/usr/local/www/index.php @@ -215,25 +215,29 @@ echo "<input style='border: 0px solid white;' size='30' name='swapusagemeter' id </html> <?php -sleep(1); -$cpuTicks = explode(" ", `/sbin/sysctl -n kern.cp_time`); -sleep(2); -$cpuTicks2 = explode(" ", `/sbin/sysctl -n kern.cp_time`); - -$diff = array(); -$diff['user'] = ($cpuTicks2[0] - $cpuTicks[0])+1; -$diff['nice'] = ($cpuTicks2[1] - $cpuTicks[1])+1; -$diff['sys'] = ($cpuTicks2[2] - $cpuTicks[2])+1; -$diff['intr'] = ($cpuTicks2[3] - $cpuTicks[3])+1; -$diff['idle'] = ($cpuTicks2[4] - $cpuTicks[4])+1; -$totalDiff = $diff['user'] + $diff['nice'] + $diff['sys'] + $diff['intr'] + $diff['idle']; -$cpuUsage = round(100 * (1 - $diff['idle'] / $totalDiff), 0); +While(!Connection_Aborted()) { + + sleep(1); + $cpuTicks = explode(" ", `/sbin/sysctl -n kern.cp_time`); + sleep(2); + $cpuTicks2 = explode(" ", `/sbin/sysctl -n kern.cp_time`); + + $diff = array(); + $diff['user'] = ($cpuTicks2[0] - $cpuTicks[0])+1; + $diff['nice'] = ($cpuTicks2[1] - $cpuTicks[1])+1; + $diff['sys'] = ($cpuTicks2[2] - $cpuTicks[2])+1; + $diff['intr'] = ($cpuTicks2[3] - $cpuTicks[3])+1; + $diff['idle'] = ($cpuTicks2[4] - $cpuTicks[4])+1; + $totalDiff = $diff['user'] + $diff['nice'] + $diff['sys'] + $diff['intr'] + $diff['idle']; + $cpuUsage = round(100 * (1 - $diff['idle'] / $totalDiff), 0); + + echo "<script language='javascript'>\n"; + echo "document.cpuwidtha.style.width='" . $cpuUsage . "';\n"; + echo "document.cpuwidthb.style.width='" . (100 - $cpuUsage) . "';\n"; + echo "document.forms[0].cpumeter.value = '" . $cpuUsage . "%';\n"; + echo "</script>\n"; -echo "<script language='javascript'>\n"; -echo "document.cpuwidtha.style.width='" . $cpuUsage . "';\n"; -echo "document.cpuwidthb.style.width='" . (100 - $cpuUsage) . "';\n"; -echo "document.forms[0].cpumeter.value = '" . $cpuUsage . "%';\n"; -echo "</script>\n"; +} ?> |