aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2003-06-21 05:57:34 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2003-06-21 05:57:34 +0000
commit99addd9f7abf84f7fc2f567aa0c84e2dbb932e97 (patch)
tree025c0ab190418f614dfd842163602aca3c346f92
parentf97314ba3d5053534b2fc1fe5bc03cdcb848bee9 (diff)
Make the default sorting for the list be column 2 in descending order so we
get the rocedures with the most number of calls at the top. Fix a bug added in previous checkin. When the table can be sorted in different ways than just the procedure number sorted in ascending order, the row for a specific procedure may change everytime we drawi/sort the table. Add code to keep track of which row a procedure is currently positioned at in the list so that we statistics are added to the correct entry. svn path=/trunk/; revision=7906
-rw-r--r--gtk/service_response_time_table.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/gtk/service_response_time_table.c b/gtk/service_response_time_table.c
index eec7026f7f..893a3def4a 100644
--- a/gtk/service_response_time_table.c
+++ b/gtk/service_response_time_table.c
@@ -3,7 +3,7 @@
* Helper routines common to all service response time statistics
* tap.
*
- * $Id: service_response_time_table.c,v 1.2 2003/06/21 05:39:45 sahlberg Exp $
+ * $Id: service_response_time_table.c,v 1.3 2003/06/21 05:57:34 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -173,8 +173,8 @@ init_srt_table(srt_stat_table *rst, int num_procs, GtkWidget *vbox)
gtk_clist_column_titles_show(GTK_CLIST(rst->table));
gtk_clist_set_compare_func(rst->table, srt_sort_column);
- gtk_clist_set_sort_column(rst->table, 0);
- gtk_clist_set_sort_type(rst->table, GTK_SORT_ASCENDING);
+ gtk_clist_set_sort_column(rst->table, 2);
+ gtk_clist_set_sort_type(rst->table, GTK_SORT_DESCENDING);
/*XXX instead of this we should probably have some code to
@@ -228,7 +228,8 @@ init_srt_table_row(srt_stat_table *rst, int index, char *procedure)
rst->procedures[index].entries[4]=g_strdup("0");
rst->procedures[index].entries[5]=g_strdup("0");
- gtk_clist_append(rst->table, rst->procedures[index].entries);
+ gtk_clist_insert(rst->table, index, rst->procedures[index].entries);
+ gtk_clist_set_row_data(rst->table, index, (gpointer) index);
}
void
@@ -285,7 +286,7 @@ add_srt_table_data(srt_stat_table *rst, int index, nstime_t *req_time, packet_in
void
draw_srt_table_data(srt_stat_table *rst)
{
- int i;
+ int i,j;
#ifdef G_HAVE_UINT64
guint64 td;
#else
@@ -304,29 +305,31 @@ draw_srt_table_data(srt_stat_table *rst)
td=0;
}
+ j=gtk_clist_find_row_from_data(rst->table, (gpointer)i);
+
sprintf(str,"%d", rst->procedures[i].num);
strp=g_strdup(str);
- gtk_clist_set_text(rst->table, i, 2, strp);
+ gtk_clist_set_text(rst->table, j, 2, strp);
g_free(rst->procedures[i].entries[2]);
rst->procedures[i].entries[2]=strp;
sprintf(str,"%3d.%05d", (int)rst->procedures[i].min.secs,rst->procedures[i].min.nsecs/10000);
strp=g_strdup(str);
- gtk_clist_set_text(rst->table, i, 3, strp);
+ gtk_clist_set_text(rst->table, j, 3, strp);
g_free(rst->procedures[i].entries[3]);
rst->procedures[i].entries[3]=strp;
sprintf(str,"%3d.%05d", (int)rst->procedures[i].max.secs,rst->procedures[i].max.nsecs/10000);
strp=g_strdup(str);
- gtk_clist_set_text(rst->table, i, 4, strp);
+ gtk_clist_set_text(rst->table, j, 4, strp);
g_free(rst->procedures[i].entries[4]);
rst->procedures[i].entries[4]=strp;
sprintf(str,"%3d.%05d", td/100000, td%100000);
strp=g_strdup(str);
- gtk_clist_set_text(rst->table, i, 5, strp);
+ gtk_clist_set_text(rst->table, j, 5, strp);
g_free(rst->procedures[i].entries[5]);
rst->procedures[i].entries[5]=strp;
}