Fix int compare function; Drop useless cast which makes the CPU usage per process worky again

(Old svn revision: 5192)
This commit is contained in:
Mike Massonnet
2008-08-03 20:54:03 +00:00
parent f3c2ad4706
commit 2e736532c4
3 changed files with 10 additions and 7 deletions

View File

@@ -1,6 +1,9 @@
2008-08-03 Mike Massonnet <mmassonnet@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@xfce.org>

View File

@@ -57,7 +57,7 @@ gboolean refresh_task_list(void)
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 ||

View File

@@ -526,19 +526,19 @@ gint compare_int_list_item(GtkTreeModel *model, GtkTreeIter *iter1, GtkTreeIter
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 @@ gint compare_string_list_item(GtkTreeModel *model, GtkTreeIter *iter1, GtkTreeIt
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;