[gnome-usage] process-row: Combine values for collapsed applications



commit e562b4a090d0c877d8e141b5029a4b7d90fd3f79
Author: Karuna Grewal <karunagrewal98 gmail com>
Date:   Wed Nov 1 15:04:39 2017 +0530

    process-row: Combine values for collapsed applications
    
    Performance tab showed separate values for multi-process
    applications.
    Now these values are being summed up in the process row label.
    
    Fixes #18

 src/process-row.vala | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/process-row.vala b/src/process-row.vala
index 6de92bb..b4ca3ae 100644
--- a/src/process-row.vala
+++ b/src/process-row.vala
@@ -131,15 +131,17 @@ namespace Usage
                 case ProcessListBoxType.PROCESSOR:
                     if(group)
                     {
-                        string values_string = "";
+                        string value_string = "";
                         var values = new GLib.List<uint64?>();
                         foreach(Process sub_process in process.sub_processes.get_values())
                             values.insert_sorted((uint64) sub_process.cpu_load, sort);
 
+                        uint64 total_value = 0;
                         foreach(uint64 value in values)
-                            values_string += "   " + value.to_string() + " %";
+                            total_value += value;
 
-                        load_label.label = values_string;
+                        value_string = total_value.to_string() + " %";
+                        load_label.label = value_string;
                     }
                     else
                         load_label.label = ((int) process.cpu_load).to_string() + " %";
@@ -147,15 +149,17 @@ namespace Usage
                 case ProcessListBoxType.MEMORY:
                     if(group)
                     {
-                        string values_string = "";
+                        string value_string = "";
                         var values = new GLib.List<uint64?>();
                         foreach(Process sub_process in process.sub_processes.get_values())
                             values.insert_sorted(sub_process.mem_usage, sort);
 
+                        uint64 total_value = 0;
                         foreach(uint64 value in values)
-                            values_string += "   " + Utils.format_size_values(value);
+                            total_value += value;
 
-                        load_label.label = values_string;
+                        value_string += Utils.format_size_values(total_value);
+                        load_label.label = value_string;
                     }
                     else
                         load_label.label = Utils.format_size_values(process.mem_usage);


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