diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-08-29 20:50:36 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-08-29 20:50:36 +0000 |
commit | 53f8d43e2945038fe3059fd6c1c00dd4ec117505 (patch) | |
tree | 0f3fc04bcb07ac328d54ffb2fed0333dfffb44de /channels/iax2-parser.h | |
parent | 562decf81af443d24afd3f1fc3d133b8b2b7cee3 (diff) |
Merge team/russell/frame_caching
There are some situations in Asterisk where ast_frame and/or iax_frame
structures are rapidly allocatted and freed (at least 50 times per second
for one call).
This code significantly improves the performance of ast_frame_header_new(),
ast_frdup(), ast_frfree(), iax_frame_new(), and iax_frame_free() by keeping
a thread-local cache of these structures and using frames from the cache
whenever possible instead of calling malloc/free every time.
This commit also converts the ast_frame and iax_frame structures to use the
linked list macros.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@41278 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/iax2-parser.h')
-rw-r--r-- | channels/iax2-parser.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/channels/iax2-parser.h b/channels/iax2-parser.h index b926b4b94..2970c9f61 100644 --- a/channels/iax2-parser.h +++ b/channels/iax2-parser.h @@ -18,6 +18,8 @@ #ifndef _IAX2_PARSER_H #define _IAX2_PARSER_H +#include "asterisk/linkedlists.h" + struct iax_ies { char *called_number; char *calling_number; @@ -115,10 +117,11 @@ struct iax_frame { /* Retransmission ID */ int retrans; /* Easy linking */ - struct iax_frame *next; - struct iax_frame *prev; + AST_LIST_ENTRY(iax_frame) list; /* Actual, isolated frame header */ struct ast_frame af; + /*! Amount of space _allocated_ for data */ + size_t mallocd_datalen; unsigned char unused[AST_FRIENDLY_OFFSET]; unsigned char afdata[0]; /* Data for frame */ }; |