[Xfce4-commits] <xfce4-systemload-plugin:master> Conditional retrieval of system stats

Mike Massonnet noreply at xfce.org
Sun Jan 22 11:06:06 CET 2012


Updating branch refs/heads/master
         to 6b2205d9642436f675c0d72e5dab37a016b3c1af (commit)
       from 9d7f39c86c656a9ae14c3f297f682e86c60941cd (commit)

commit 6b2205d9642436f675c0d72e5dab37a016b3c1af
Author: David Schneider <dnschneid at gmail.com>
Date:   Fri Jan 20 23:39:02 2012 -0800

    Conditional retrieval of system stats

 panel-plugin/systemload.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/panel-plugin/systemload.c b/panel-plugin/systemload.c
index 92e0f4b..745f70a 100644
--- a/panel-plugin/systemload.c
+++ b/panel-plugin/systemload.c
@@ -106,11 +106,15 @@ update_monitors(t_global_monitor *global)
     gulong mem, swap, MTotal, MUsed, STotal, SUsed;
     gint count, days, hours, mins;
 
-    global->monitor[0]->history[0] = read_cpuload();
-    read_memswap(&mem, &swap, &MTotal, &MUsed, &STotal, &SUsed);
-    global->monitor[1]->history[0] = mem;
-    global->monitor[2]->history[0] = swap;
-    global->uptime->value_read = read_uptime();
+    if (global->monitor[0]->options.enabled)
+        global->monitor[0]->history[0] = read_cpuload();
+    if (global->monitor[1]->options.enabled || global->monitor[2]->options.enabled) {
+        read_memswap(&mem, &swap, &MTotal, &MUsed, &STotal, &SUsed);
+        global->monitor[1]->history[0] = mem;
+        global->monitor[2]->history[0] = swap;
+    }
+    if (global->uptime->enabled)
+        global->uptime->value_read = read_uptime();
 
     for(count = 0; count < 3; count++)
     {


More information about the Xfce4-commits mailing list