From c410cf554603cd3640a36ef5beabb87b7d59de5e Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Wed, 2 Mar 2005 02:22:49 +0000 Subject: [PATCH] Use connection_aborted to detect if client still has index.php open. Use a 3 second sleep loop to DYNAMICALLY update the cpu status meter. Who needs SVG? --- usr/local/www/index.php | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/usr/local/www/index.php b/usr/local/www/index.php index fa3ed5e908..24154b2539 100755 --- a/usr/local/www/index.php +++ b/usr/local/www/index.php @@ -215,25 +215,29 @@ echo " \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 "\n"; + $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 "\n"; + +} ?>