[Goodies-commits] r5192 - in xfce4-taskmanager/trunk: . src

Mike Massonnet mmassonnet at xfce.org
Sun Aug 3 22:54:03 CEST 2008


Author: mmassonnet
Date: 2008-08-03 20:54:03 +0000 (Sun, 03 Aug 2008)
New Revision: 5192

Modified:
   xfce4-taskmanager/trunk/ChangeLog
   xfce4-taskmanager/trunk/src/functions.c
   xfce4-taskmanager/trunk/src/interface.c
Log:
Fix int compare function; Drop useless cast which makes the CPU usage per process worky again

Modified: xfce4-taskmanager/trunk/ChangeLog
===================================================================
--- xfce4-taskmanager/trunk/ChangeLog	2008-08-03 20:02:28 UTC (rev 5191)
+++ xfce4-taskmanager/trunk/ChangeLog	2008-08-03 20:54:03 UTC (rev 5192)
@@ -1,6 +1,9 @@
 2008-08-03	Mike Massonnet <mmassonnet at xfce.org>
 
 	* New function to get the full and short cmdline (Linux)
+	* Fix int compare function (to work with floats)
+	* Drop useless cast which makes the CPU usage per process worky again
+	for multi-cores
 
 2008-08-02	Mike Massonnet <mmassonnet at xfce.org>
 

Modified: xfce4-taskmanager/trunk/src/functions.c
===================================================================
--- xfce4-taskmanager/trunk/src/functions.c	2008-08-03 20:02:28 UTC (rev 5191)
+++ xfce4-taskmanager/trunk/src/functions.c	2008-08-03 20:54:03 UTC (rev 5192)
@@ -57,7 +57,7 @@
 				tmp->time = new_tmp->time;
 
 				tmp->old_time_percentage = tmp->time_percentage;
-				tmp->time_percentage = (gdouble)(tmp->time - tmp->old_time) * (gdouble)(1/num_cpus);
+				tmp->time_percentage = (gdouble)(tmp->time - tmp->old_time) * (1.0/num_cpus);
 #endif
 				if(
 				    tmp->ppid != new_tmp->ppid ||

Modified: xfce4-taskmanager/trunk/src/interface.c
===================================================================
--- xfce4-taskmanager/trunk/src/interface.c	2008-08-03 20:02:28 UTC (rev 5191)
+++ xfce4-taskmanager/trunk/src/interface.c	2008-08-03 20:54:03 UTC (rev 5192)
@@ -526,19 +526,19 @@
 	gchar *s1 = "";
 	gchar *s2 = "";
 
+	gdouble i1 = 0;
+	gdouble i2 = 0;
+
 	gint ret = 0;
 
 	gtk_tree_model_get(model, iter1, column, &s1, -1);
 	gtk_tree_model_get(model, iter2, column, &s2, -1);
 
-	gint i1 = 0;
-	gint i2 = 0;
-
 	if(s1 != NULL)
-		i1 = atoi(s1);
+		i1 = 100 * g_strtod(s1, NULL);
 
 	if(s2 != NULL)
-		i2 = atoi(s2);
+		i2 = 100 * g_strtod(s2, NULL);
 
 	ret = i2 - i1;
 
@@ -561,7 +561,7 @@
 	gtk_tree_model_get(model, iter2, GPOINTER_TO_INT(column), &s2, -1);
 
 	if(s1 != NULL && s2 != NULL)
-		ret = strcmp(s2, s1);
+		ret = strcasecmp(s2, s1);
 	else
 		ret = 0;
 




More information about the Goodies-commits mailing list