diff options
author | Espen Johansen <lsf@pfsense.org> | 2005-09-15 03:29:35 +0000 |
---|---|---|
committer | Espen Johansen <lsf@pfsense.org> | 2005-09-15 03:29:35 +0000 |
commit | 4fe00253c2fe8d0a3171bf47721e6a9682bc8e9a (patch) | |
tree | 92c35ec75f524c09c8506a7a9409f11aefccb58b | |
parent | 2b357d1cd0809d97f42f2fa064cc21f32be16597 (diff) | |
download | pfsense-4fe00253c2fe8d0a3171bf47721e6a9682bc8e9a.zip pfsense-4fe00253c2fe8d0a3171bf47721e6a9682bc8e9a.tar.gz |
Just another CPU meter fix :p
-rw-r--r-- | usr/local/www/includes/functions.inc.php | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/usr/local/www/includes/functions.inc.php b/usr/local/www/includes/functions.inc.php index 9878105..15ed51d 100644 --- a/usr/local/www/includes/functions.inc.php +++ b/usr/local/www/includes/functions.inc.php @@ -1,8 +1,9 @@ <? -function cpu_usage() { - return get_cpuusage(get_cputicks(), get_cputicks()); -} - +/* +*function cpu_usage() { +* return get_cpuusage(get_cputicks(), get_cputicks()); +*} +*/ function get_uptime() { exec("/sbin/sysctl -n kern.boottime", $boottime); @@ -26,14 +27,21 @@ function get_uptime() { $uptimestr .= sprintf("%02d:%02d", $uphours, $upmins); return $uptimestr; } +/* +*function get_cputicks() { +* sleep(5); +* $cputicks = explode(" ", `/sbin/sysctl -n kern.cp_time`); +* return $cputicks; +*} +*/ -function get_cputicks() { +function cpu_usage() { + usleep(250); + $cpuTicks = explode(" ", `/sbin/sysctl -n kern.cp_time`); sleep(1); - $cputicks = explode(" ", `/sbin/sysctl -n kern.cp_time`); - return $cputicks; -} - -function get_cpuusage($cpuTicks, $cpuTicks2) { + $cpuTicks2 = explode(" ", `/sbin/sysctl -n kern.cp_time`); + sleep(1); + $diff = array(); $diff['user'] = ($cpuTicks2[0] - $cpuTicks[0]); $diff['nice'] = ($cpuTicks2[1] - $cpuTicks[1]); |