diff options
author | jim-p <jimp@pfsense.org> | 2013-08-30 13:35:48 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2013-08-30 13:37:42 -0400 |
commit | b097a7cfa9f42d513823f0db7f047684faf8fe28 (patch) | |
tree | 779fe4b0f530d75e3ecf94e1f5101f712c8f4446 /usr/local | |
parent | beb7cd97eb496e2d1f1e933344566e8e1927378f (diff) | |
download | pfsense-b097a7cfa9f42d513823f0db7f047684faf8fe28.zip pfsense-b097a7cfa9f42d513823f0db7f047684faf8fe28.tar.gz |
Show a count of the CPUs if more than one is detected, and show how those CPUs are supplied by the hardware.
Diffstat (limited to 'usr/local')
-rw-r--r-- | usr/local/www/includes/functions.inc.php | 13 | ||||
-rw-r--r-- | usr/local/www/widgets/widgets/system_information.widget.php | 5 |
2 files changed, 18 insertions, 0 deletions
diff --git a/usr/local/www/includes/functions.inc.php b/usr/local/www/includes/functions.inc.php index 2d3295a..6a60fcf 100644 --- a/usr/local/www/includes/functions.inc.php +++ b/usr/local/www/includes/functions.inc.php @@ -242,6 +242,19 @@ function get_cpufreq() { return $out; } +function get_cpu_count($show_detail = false) { + $cpucount = ""; + exec("/sbin/sysctl -n kern.smp.cpus", $cpucount); + $cpucount = $cpucount[0]; + + if ($show_detail) { + $cpudetail = ""; + exec("/usr/bin/grep 'SMP.*package.*core' /var/log/dmesg.boot | /usr/bin/cut -f2- -d' '", $cpudetail); + $cpucount = $cpudetail[0]; + } + return $cpucount; +} + function get_load_average() { $load_average = ""; exec("/usr/bin/uptime | /usr/bin/sed 's/^.*: //'", $load_average); diff --git a/usr/local/www/widgets/widgets/system_information.widget.php b/usr/local/www/widgets/widgets/system_information.widget.php index 398fc47..c2cf67a 100644 --- a/usr/local/www/widgets/widgets/system_information.widget.php +++ b/usr/local/www/widgets/widgets/system_information.widget.php @@ -165,6 +165,11 @@ $curcfg = $config['system']['firmware']; echo (htmlspecialchars($cpumodel)); ?> <div id="cpufreq"><?= get_cpufreq(); ?></div> + <?php $cpucount = get_cpu_count(); + if ($cpucount > 1): ?> + <div id="cpucount"> + <?= htmlspecialchars($cpucount) ?> CPUs: <?= htmlspecialchars(get_cpu_count(true)); ?></div> + <?php endif; ?> </td> </tr> <?php if ($hwcrypto): ?> |