[asterisk-dev] Help needed for main/pbx.c
Russell Bryant
russell at digium.com
Tue Nov 2 21:06:35 CDT 2010
----- Original Message -----
> hello,
>
> i have finished the first part of my statechange patch and i have a
> question about the right way / place to bring it in.
>
> by now i have added one container for devices which are used in hints
> so there is no iteration through the whole hint link list, just a hash
> compare to the device (which we allready know) and a direct link to
> the hint which includes this device.
> the values i can see by now are just great but i have one problem.
>
> for example in chan_sip.c there is a load and unload module function
> where i can allocate and clean up a container but there is nothing in
> pbx.c like this. i have just written a function which checks if the
> container is allocated and if not, just allocate it if needed.
> But i dont have an idea where i should clean this up in pbx.c, so my
> patch would cause a memory leak.
>
> any ideas where i can build this in?
Many of the files in main/ have an _init() function. They are defined in include/asterisk/_private.h and executed by main/asterisk.c. main/pbx.c already has one - load_pbx(). Add your initialization code there.
> the next part of this patch would be the switch from a linklist for
> hints to a real container but the performance improvment for
> handlestatechange is nearly 85 times faster by now:
>
> handle_statechange called: 28008 overalltime: 16791 ms (orig trunk)
> handle_statechange called: 27952 overalltime: 200 ms (patched trunk)
>
> thanks for your help!
That looks great! I'm interested to see how you did it. I have a patch that converts hints to an astobj2 container, as well. We should look at combining the two patches in a branch. Jeff picked it up the patch from me before I left for AstriCon. Jeff, is that code posted anywhere yet?
--
Russell Bryant
Digium, Inc. | Engineering Manager, Open Source Software
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
jabber: rbryant at digium.com -=- skype: russell-bryant
www.digium.com -=- www.asterisk.org -=- blogs.asterisk.org
More information about the asterisk-dev
mailing list