diff options
author | Guy Harris <guy@alum.mit.edu> | 1999-08-10 04:13:37 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 1999-08-10 04:13:37 +0000 |
commit | 86a8ad1dcd6af20f8982e39cc70f3debaa2a8352 (patch) | |
tree | c8fb7d5a71eab0ef89a425465a8e37b9fb9ccb90 /summary.c | |
parent | 5ad4d240bbcc9382d85dbdf67ece60295816ebca (diff) | |
download | wireshark-86a8ad1dcd6af20f8982e39cc70f3debaa2a8352.tar.gz wireshark-86a8ad1dcd6af20f8982e39cc70f3debaa2a8352.tar.bz2 wireshark-86a8ad1dcd6af20f8982e39cc70f3debaa2a8352.zip |
Building a GList by adding elements to the end with "g_list_append()" is
N^2 in the ultimate size of the list (as "g_list_append()" is linear in
the size of the list, at least when used in the way the GLib
documentation says to use it); instead, maintain our own linked list of
"frame_data" structures for all packets read, including a pointer to the
last element.
"gtk_clist_set_row_data()" is linear in the row number, so if it's used
to attach a pointer to the "frame_data" structure for a packet to the
packet list GtkClist row for each packet, that's also N^2 in the number
of packets in that packet list; instead, store the row number in the
"frame_data" structure, and find the packet for a given row by scanning
the list for it (we were already scanning the list linearly to find that
packet's index in the list of all packets; that's only done when a
packet's selected, so it's not *too* bad, but it might be nice to avoid
having to do that scan).
svn path=/trunk/; revision=457
Diffstat (limited to 'summary.c')
-rw-r--r-- | summary.c | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -1,7 +1,7 @@ /* summary.c * Routines for capture file summary window * - * $Id: summary.c,v 1.7 1999/08/02 02:04:27 guy Exp $ + * $Id: summary.c,v 1.8 1999/08/10 04:13:36 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -128,10 +128,10 @@ summary_prep_cb(GtkWidget *w, gpointer d) { guint32 traffic_bytes, i; double seconds; - GList *cur_glist; + frame_data *cur_glist; /* initialize the tally */ - first_frame = (frame_data *)(cf.plist->data); + first_frame = cf.plist; st = (summary_tally *)g_malloc(sizeof(summary_tally)); st->start_time = secs_usecs(first_frame->abs_secs,first_frame->abs_usecs) ; @@ -142,12 +142,10 @@ summary_prep_cb(GtkWidget *w, gpointer d) { cur_glist = cf.plist; for (i = 0; i < cf.count; i++){ - cur_frame = (frame_data *)cur_glist->data; + cur_frame = cur_glist; tally_frame_data(cur_frame, st); cur_glist = cur_glist->next; - } - - /* g_list_foreach(cf.plist_first, (GFunc)tally_frame_data, st); */ + } /* traffic_bytes will be computed here */ traffic_bytes = st->bytes; |