diff options
-rw-r--r-- | usr/local/www/includes/functions.inc.php | 16 | ||||
-rw-r--r-- | usr/local/www/javascript/index/ajax.js | 6 | ||||
-rw-r--r-- | usr/local/www/widgets/widgets/system_information.widget.php | 12 |
3 files changed, 23 insertions, 11 deletions
diff --git a/usr/local/www/includes/functions.inc.php b/usr/local/www/includes/functions.inc.php index 8ceea4d..3039c35 100644 --- a/usr/local/www/includes/functions.inc.php +++ b/usr/local/www/includes/functions.inc.php @@ -19,6 +19,7 @@ function get_stats() { $stats['interfacestatistics'] = get_interfacestats(); $stats['interfacestatus'] = get_interfacestatus(); $stats['gateways'] = get_gatewaystats(); + $stats['cpufreq'] = get_cpufreq(); $stats = join("|", $stats); return $stats; } @@ -215,6 +216,21 @@ function update_date_time() { return $datetime; } +function get_cpufreq() { + $cpufreqs = ""; + $out = ""; + exec("/sbin/sysctl -n dev.cpu.0.freq_levels", $cpufreqs); + $cpufreqs = explode(" ", trim($cpufreqs[0])); + $maxfreq = explode("/", $cpufreqs[0]); + $maxfreq = $maxfreq[0]; + $curfreq = ""; + exec("/sbin/sysctl -n dev.cpu.0.freq", $curfreq); + $curfreq = trim($curfreq[0]); + if ($curfreq != $maxfreq) + $out = "Current: {$curfreq} MHz, Max: {$maxfreq} MHz"; + return $out; +} + function get_interfacestats() { global $config; diff --git a/usr/local/www/javascript/index/ajax.js b/usr/local/www/javascript/index/ajax.js index fffb5c0..eab0119 100644 --- a/usr/local/www/javascript/index/ajax.js +++ b/usr/local/www/javascript/index/ajax.js @@ -41,6 +41,7 @@ function stats(x) { updateInterfaceStats(values[6]); updateInterfaces(values[7]); updateGatewayStats(values[8]); + updateCpuFreq(values[9]); } function updateMemory(x) { @@ -100,6 +101,11 @@ function updateGatewayStats(x){ } } +function updateCpuFreq(x) { + if(jQuery('#cpufreq')) + jQuery("#cpufreq").html(x); +} + function updateInterfaceStats(x){ if (widgetActive("interface_statistics")){ statistics_split = x.split(","); diff --git a/usr/local/www/widgets/widgets/system_information.widget.php b/usr/local/www/widgets/widgets/system_information.widget.php index 5658c54..776679a 100644 --- a/usr/local/www/widgets/widgets/system_information.widget.php +++ b/usr/local/www/widgets/widgets/system_information.widget.php @@ -135,18 +135,8 @@ $curcfg = $config['system']['firmware']; exec("/sbin/sysctl -n hw.model", $cpumodel); $cpumodel = implode(" ", $cpumodel); echo (htmlspecialchars($cpumodel)); - - $cpufreqs = ""; - exec("/sbin/sysctl -n dev.cpu.0.freq_levels", $cpufreqs); - $cpufreqs = explode(" ", trim($cpufreqs[0])); - $maxfreq = explode("/", $cpufreqs[0]); - $maxfreq = $maxfreq[0]; - $curfreq = ""; - exec("/sbin/sysctl -n dev.cpu.0.freq", $curfreq); - $curfreq = trim($curfreq[0]); - if ($curfreq != $maxfreq) - echo "<br/>Current: {$curfreq} MHz, Max: {$maxfreq} MHz"; ?> + <div id="cpufreq"><?= get_cpufreq(); ?></div> </td> </tr> <?php if ($hwcrypto): ?> |