summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorErik Kristensen <ekristen@pfsense.org>2005-09-07 23:49:27 +0000
committerErik Kristensen <ekristen@pfsense.org>2005-09-07 23:49:27 +0000
commit03007a3facf46e763bc29a98e4fda84fd1b281a0 (patch)
treee691a4835f74011eb284b8e1e2602dd07f292a37 /usr
parent7f387ab00380719beb3612b0368514bafcf72dfd (diff)
downloadpfsense-03007a3facf46e763bc29a98e4fda84fd1b281a0.zip
pfsense-03007a3facf46e763bc29a98e4fda84fd1b281a0.tar.gz
Fixed CPU Calculations, code by lsf
Diffstat (limited to 'usr')
-rwxr-xr-xusr/local/www/index.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr/local/www/index.php b/usr/local/www/index.php
index d43f27e..d81dccf 100755
--- a/usr/local/www/index.php
+++ b/usr/local/www/index.php
@@ -130,9 +130,12 @@ $diff['intr'] = ($cpuTicks2[3] - $cpuTicks[3])+1;
$diff['idle'] = ($cpuTicks2[4] - $cpuTicks[4])+1;
//echo "<!-- user: {$diff['user']} nice {$diff['nice']} sys {$diff['sys']} intr {$diff['intr']} idle {$diff['idle']} -->";
-
$totalDiff = $diff['user'] + $diff['nice'] + $diff['sys'] + $diff['intr'] + $diff['idle'];
-$cpuUsage = round(100 * (1 - $diff['idle'] / $totalDiff), 0);
+$totalused = $diff['user'] + $diff['nice'] + $diff['sys'] + $diff['intr'] - 1;
+$cpuUsage = round(100 * ($totalused / $totalDiff), 0);
+
+#$totalDiff = $diff['user'] + $diff['nice'] + $diff['sys'] + $diff['intr'] + $diff['idle'];
+#$cpuUsage = round(100 * (1 - $diff['idle'] / $totalDiff), 0);
return $cpuUsage;
}
OpenPOWER on IntegriCloud