summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/widgets
diff options
context:
space:
mode:
authorPiBa-NL <pba_2k3@yahoo.com>2017-03-26 15:25:16 +0200
committerPiBa-NL <pba_2k3@yahoo.com>2017-03-26 15:43:29 +0200
commit257dff159db8ada16622e8e3ea0ed4700dd377a2 (patch)
treea2d69afbfa32d3e8d70d2287e055cab591ca542e /src/usr/local/www/widgets
parentdd844c430622fa68de1f868b62ec375d7131ce16 (diff)
downloadpfsense-257dff159db8ada16622e8e3ea0ed4700dd377a2.zip
pfsense-257dff159db8ada16622e8e3ea0ed4700dd377a2.tar.gz
get_stats, optimizations. -dont call unused interface statistics functions -call get_mbuf only once (its netstat call is cpu intensive.) -dont stack multiple pending request in browser if responses are slow.
Diffstat (limited to 'src/usr/local/www/widgets')
-rw-r--r--src/usr/local/www/widgets/widgets/system_information.widget.php19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/usr/local/www/widgets/widgets/system_information.widget.php b/src/usr/local/www/widgets/widgets/system_information.widget.php
index 789cef9..f483d40 100644
--- a/src/usr/local/www/widgets/widgets/system_information.widget.php
+++ b/src/usr/local/www/widgets/widgets/system_information.widget.php
@@ -312,8 +312,7 @@ $rows_displayed = false;
<th><?=gettext("MBUF Usage");?></th>
<td>
<?php
- $mbufstext = get_mbuf();
- $mbufusage = get_mbuf(true);
+ get_mbuf($mbufstext, $mbufusage);
?>
<div class="progress">
<div id="mbufPB" class="progress-bar progress-bar-striped" role="progressbar" aria-valuenow="<?=$mbufusage?>" aria-valuemin="0" aria-valuemax="100" style="width: <?=$mbufusage?>%">
@@ -500,8 +499,12 @@ function systemStatusGetUpdateStatus() {
setTimeout('systemStatusGetUpdateStatus()', 4000);
<?php endif; ?>
-
+var updateMeters_running = false;
function updateMeters() {
+ if (updateMeters_running) {
+ return;
+ }
+ updateMeters_running = true;
url = '/getstats.php';
$.ajax(url, {
@@ -510,11 +513,9 @@ function updateMeters() {
response = data || "";
if (response != "")
stats(data);
+ updateMeters_running = false;
}
});
-
- setTimer();
-
}
var update_interval = "<?=$widgetperiod?>";
@@ -523,10 +524,6 @@ function setProgress(barName, percent) {
$('[id="' + barName + '"]').css('width', percent + '%').attr('aria-valuenow', percent);
}
-function setTimer() {
- timeout = window.setTimeout('updateMeters()', update_interval);
-}
-
function stats(x) {
var values = x.split("|");
if ($.each(values,function(key,value) {
@@ -699,7 +696,7 @@ function widgetActive(x) {
/* start updater */
events.push(function(){
- setTimer();
+ timeout = window.setInterval(updateMeters, update_interval);
});
<?php endif; // $widget_first_instance ?>
events.push(function(){
OpenPOWER on IntegriCloud