diff options
author | Evan Huus <eapache@gmail.com> | 2013-10-12 21:01:17 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2013-10-12 21:01:17 +0000 |
commit | c2b2d204db58fe40cecd28ba21c72d4d1038d1c8 (patch) | |
tree | 78df0fdc9aa2cc25450823e9c563eaf80669d0f8 /epan/proto.h | |
parent | 2e1497b532a3fa35dbfbcfb2b29c49c38e2c7e06 (diff) |
Redo r52569 in a way that doesn't break the GUI. Add a mem_pool member to
tree_data and reference it directly when allocating/freeing tree items. This
lets us keep multiple around when we need them, and still lets us use
wmem_free_all for a major speedup. It also, coincidentally, lets us get rid of
the annoying fi_tmp hack that was needed before, since that element gets swept
up in the free_all with everything else.
Keep one pool cached to avoid creating/destroying a pool for each packet,
another minor performance win.
The various changes in approach seem to balance out pretty much exactly, this
still gives ~11% over pre-52569.
svn path=/trunk/; revision=52573
Diffstat (limited to 'epan/proto.h')
-rw-r--r-- | epan/proto.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/epan/proto.h b/epan/proto.h index 5083db6100..204b565278 100644 --- a/epan/proto.h +++ b/epan/proto.h @@ -46,6 +46,7 @@ #include <glib.h> #include <epan/emem.h> +#include <epan/wmem/wmem.h> #include "ipv4.h" #include "wsutil/nstime.h" @@ -485,7 +486,7 @@ typedef struct { gboolean fake_protocols; gint count; struct _packet_info *pinfo; - field_info *fi_tmp; + wmem_allocator_t *mem_pool; } tree_data_t; /** Each proto_tree, proto_item is one of these. */ @@ -609,6 +610,9 @@ WS_DLL_PUBLIC void proto_tree_children_foreach(proto_tree *tree, /** Retrieve the tree_data_t from a proto_tree */ #define PTREE_DATA(proto_tree) ((proto_tree)->tree_data) +/** Retrieve the wmem_allocator_t from a proto_node */ +#define PNODE_POOL(proto_node) ((proto_node)->tree_data->mem_pool) + /** Sets up memory used by proto routines. Called at program startup */ void proto_init(void (register_all_protocols_func)(register_cb cb, gpointer client_data), void (register_all_handoffs_func)(register_cb cb, gpointer client_data), |