aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gtk/packet_list_store.c17
-rw-r--r--gtk/packet_list_store.h10
2 files changed, 26 insertions, 1 deletions
diff --git a/gtk/packet_list_store.c b/gtk/packet_list_store.c
index 32f8b3553a..b47fe9ddbb 100644
--- a/gtk/packet_list_store.c
+++ b/gtk/packet_list_store.c
@@ -26,7 +26,6 @@
/* This code is based on the GTK+ Tree View tutorial at http://scentric.net */
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -236,6 +235,10 @@ packet_list_init(PacketList *packet_list)
packet_list->columnized = FALSE;
packet_list->sort_id = 0; /* defaults to first column for now */
packet_list->sort_order = GTK_SORT_ASCENDING;
+
+#ifdef NEW_PACKET_LIST_STATISTICS
+ packet_list->const_strings = 0;
+#endif
}
/* This function is called just before a packet list is destroyed. Free
@@ -569,7 +572,13 @@ new_packet_list_store_clear(PacketList *packet_list)
g_ptr_array_free(packet_list->visible_rows, TRUE);
packet_list->physical_rows = g_ptr_array_new();
packet_list->visible_rows = g_ptr_array_new();
+
packet_list->columnized = FALSE;
+
+#ifdef NEW_PACKET_LIST_STATISTICS
+ g_warning("Const strings: %u", packet_list->const_strings);
+ packet_list->const_strings = 0;
+#endif
}
#if 0
@@ -693,6 +702,9 @@ packet_list_change_record(PacketList *packet_list, guint row, gint col, column_i
/* This is a constant string, so we don't have to copy it */
record->fdata->col_text[col] = (gchar *) cinfo->col_data[col];
record->fdata->col_text_len[col] = (guint) strlen(record->fdata->col_text[col]);
+#ifdef NEW_PACKET_LIST_STATISTICS
+ ++packet_list->const_strings;
+#endif
break;
case COL_PROTOCOL:
case COL_INFO:
@@ -706,6 +718,9 @@ packet_list_change_record(PacketList *packet_list, guint row, gint col, column_i
/* This is a constant string, so we don't have to copy it */
record->fdata->col_text[col] = (gchar *) cinfo->col_data[col];
record->fdata->col_text_len[col] = (guint) strlen(record->fdata->col_text[col]);
+#ifdef NEW_PACKET_LIST_STATISTICS
+ ++packet_list->const_strings;
+#endif
break;
}
/* !! FALL-THROUGH!! */
diff --git a/gtk/packet_list_store.h b/gtk/packet_list_store.h
index 93d9070a25..a0ee1007df 100644
--- a/gtk/packet_list_store.h
+++ b/gtk/packet_list_store.h
@@ -22,11 +22,16 @@
* USA.
*/
+/* Uncomment to track some statistics (const strings, etc.) */
+/* #define NEW_PACKET_LIST_STATISTICS */
+
#ifndef __NEW_PACKET_LIST_H__
#define __NEW_PACKET_LIST_H__
#ifdef NEW_PACKET_LIST
+#include <glib.h>
+
#include "epan/column_info.h"
#include "epan/frame_data.h"
@@ -85,6 +90,11 @@ struct _PacketList
/* Random integer to check whether an iter belongs to our model. */
gint stamp;
+
+#ifdef NEW_PACKET_LIST_STATISTICS
+ /* Statistics */
+ guint const_strings;
+#endif
};
/* PacketListClass: more boilerplate GObject stuff */