[gnome-system-monitor] Fixed non-stacked area chart CPU graph showing wrong CPU usage



commit 4acb2577176055ee1cbdebfa7f2e676ca01cb053
Author: Robert Roth <robert roth off gmail com>
Date:   Sat Jan 26 00:25:10 2013 +0200

    Fixed non-stacked area chart CPU graph showing wrong CPU usage

 src/load-graph.cpp |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/load-graph.cpp b/src/load-graph.cpp
index 9cff2f9..11a81bc 100644
--- a/src/load-graph.cpp
+++ b/src/load-graph.cpp
@@ -321,6 +321,7 @@ get_load (LoadGraph *graph)
     // that value has no meaning, we just want all the
     // graphs to be aligned, so the CPU graph needs to start
     // immediately
+    bool drawStacked = graph->type == LOAD_GRAPH_CPU && ProcmanApp::get()->config.draw_stacked;
 
     for (i = 0; i < graph->n; i++) {
         float load;
@@ -331,9 +332,12 @@ get_load (LoadGraph *graph)
         used  = NOW[i][CPU_USED]  - LAST[i][CPU_USED];
 
         load = used / MAX(total, 1.0f);
-        graph->data[0][i] = load / graph->n;
-        if (i > 0) {
-            graph->data[0][i] += graph->data[0][i-1];
+        graph->data[0][i] = load;
+        if (drawStacked) {
+            graph->data[0][i] /= graph->n;
+            if (i > 0) {
+                graph->data[0][i] += graph->data[0][i-1];
+            }
         }
 
         /* Update label */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]