summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2013-08-30 13:35:48 -0400
committerjim-p <jimp@pfsense.org>2013-08-30 13:37:54 -0400
commit3fcb6a21a33f2260b18b59100aee3ec69a3e3988 (patch)
treece5d21df3c651ccc0b9aa9404b96d2bdf0df38f1 /usr
parent35eb76fa91915877924bdefdb35b39c0404d7969 (diff)
downloadpfsense-3fcb6a21a33f2260b18b59100aee3ec69a3e3988.zip
pfsense-3fcb6a21a33f2260b18b59100aee3ec69a3e3988.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')
-rw-r--r--usr/local/www/includes/functions.inc.php13
-rw-r--r--usr/local/www/widgets/widgets/system_information.widget.php5
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 4843a78..33cb585 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 81cda1e..97348be 100644
--- a/usr/local/www/widgets/widgets/system_information.widget.php
+++ b/usr/local/www/widgets/widgets/system_information.widget.php
@@ -148,6 +148,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): ?>
OpenPOWER on IntegriCloud