diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-03-25 22:07:07 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-03-25 22:07:07 +0000 |
commit | 7f1e0a8206adaaf5cdd9a41a26375d6b3938426a (patch) | |
tree | 605931dbae294ca1333c0b5cb1fe1e5c51b755f4 /apps | |
parent | 107356adb27a52cea7feed50b316caab15aee796 (diff) |
Merged revisions 184339 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r184339 | russell | 2009-03-25 16:57:19 -0500 (Wed, 25 Mar 2009) | 35 lines
Improve performance of the ast_event cache functionality.
This code comes from svn/asterisk/team/russell/event_performance/.
Here is a summary of the changes that have been made, in order of both
invasiveness and performance impact, from smallest to largest.
1) Asterisk 1.6.1 introduces some additional logic to be able to handle
distributed device state. This functionality comes at a cost.
One relatively minor change in this patch is that the extra processing
required for distributed device state is now completely bypassed if
it's not needed.
2) One of the things that I noticed when profiling this code was that a
_lot_ of time was spent doing string comparisons. I changed the way
strings are represented in an event to include a hash value at the front.
So, before doing a string comparison, we do an integer comparison on the
hash.
3) Finally, the code that handles the event cache has been re-written.
I tried to do this in a such a way that it had minimal impact on the API.
I did have to change one API call, though - ast_event_queue_and_cache().
However, the way it works now is nicer, IMO. Each type of event that
can be cached (MWI, device state) has its own hash table and rules for
hashing and comparing objects. This by far made the biggest impact on
performance.
For additional details regarding this code and how it was tested, please see the
review request.
(closes issue #14738)
Reported by: russell
Review: http://reviewboard.digium.com/r/205/
........
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@184343 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_minivm.c | 7 | ||||
-rw-r--r-- | apps/app_voicemail.c | 5 |
2 files changed, 3 insertions, 9 deletions
diff --git a/apps/app_minivm.c b/apps/app_minivm.c index c52675848..c4bbce43d 100644 --- a/apps/app_minivm.c +++ b/apps/app_minivm.c @@ -1785,13 +1785,10 @@ static void queue_mwi_event(const char *mbx, const char *ctx, int urgent, int ne AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_UINT, (new+urgent), AST_EVENT_IE_OLDMSGS, AST_EVENT_IE_PLTYPE_UINT, old, AST_EVENT_IE_END))) { - return; + return; } - ast_event_queue_and_cache(event, - AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, - AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, - AST_EVENT_IE_END); + ast_event_queue_and_cache(event); } /*! \brief Send MWI using interal Asterisk event subsystem */ diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 05dae3117..b2ec1e081 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -6215,10 +6215,7 @@ static void queue_mwi_event(const char *box, int urgent, int new, int old) return; } - ast_event_queue_and_cache(event, - AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, - AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, - AST_EVENT_IE_END); + ast_event_queue_and_cache(event); } /*! |