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: https://origsvn.digium.com/svn/asterisk/trunk@41278 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2006-08-29 20:50:36 +00:00
parent d22476348a
commit f7e7161607
16 changed files with 345 additions and 313 deletions

View File

@@ -3516,7 +3516,6 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
pthread_t threadid;
pthread_attr_t attr;
struct ast_channel *chan;
struct ast_frame dtmf_frame = { .frametype = AST_FRAME_DTMF };
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
@@ -3560,8 +3559,6 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
*/
p->subs[index].f.frametype = AST_FRAME_DTMF_BEGIN;
p->subs[index].f.subclass = res & 0xff;
dtmf_frame.subclass = res & 0xff;
p->subs[index].f.next = ast_frdup(&dtmf_frame);
#ifdef HAVE_PRI
}
#endif