[asterisk-commits] murf: branch murf/bug11210 r94897 - in /team/murf/bug11210: channels/ main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Dec 27 10:32:30 CST 2007
Author: murf
Date: Thu Dec 27 10:32:29 2007
New Revision: 94897
URL: http://svn.digium.com/view/asterisk?view=rev&rev=94897
Log:
Reduce some of log messages, especially those that come up during reload. Add a little output to the show objects, show users commands. reloads on a 4600 objects take 1-2 sec. Under current trunk, reload took 3-7 sec on the same configs.
Modified:
team/murf/bug11210/channels/chan_sip.c
team/murf/bug11210/main/sched.c
Modified: team/murf/bug11210/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/channels/chan_sip.c?view=diff&rev=94897&r1=94896&r2=94897
==============================================================================
--- team/murf/bug11210/channels/chan_sip.c (original)
+++ team/murf/bug11210/channels/chan_sip.c Thu Dec 27 10:32:29 2007
@@ -97,6 +97,7 @@
#include <signal.h>
#include <sys/signal.h>
#include <regex.h>
+#include <time.h>
#include "asterisk/network.h"
#include "asterisk/paths.h" /* need ast_config_AST_SYSTEM_NAME */
@@ -2068,22 +2069,19 @@
*/
static void *unref_peer(struct sip_peer *peer, char *tag)
{
- int rc = ao2_t_ref(peer,-1,tag);
- ast_log(LOG_NOTICE,"Unref peer %s prev refcount=%d\n", peer->name, rc);
+ ao2_t_ref(peer,-1,tag);
return NULL;
}
static void *unref_user(struct sip_user *user, char *tag)
{
- int rc = ao2_t_ref(user,-1, tag);
- ast_log(LOG_NOTICE,"Unref user %s prev refcount=%d\n", user->name, rc);
+ ao2_t_ref(user,-1, tag);
return NULL;
}
static struct sip_peer *ref_peer(struct sip_peer *peer, char *tag)
{
- int rc = ao2_t_ref(peer,1,tag);
- ast_log(LOG_NOTICE,"Ref peer %s prev refcount=%d\n", peer->name, rc);
+ ao2_t_ref(peer,1,tag);
return peer;
}
@@ -2483,7 +2481,6 @@
struct sip_pkt *pkt = (struct sip_pkt *)data, *prev, *cur = NULL;
int reschedule = DEFAULT_RETRANS;
int xmitres = 0;
- ast_log(LOG_NOTICE,"SCHED: Retrans_pkt called---\n");
/* Lock channel PVT */
sip_pvt_lock(pkt->owner);
@@ -3208,7 +3205,6 @@
static void sip_destroy_peer(struct sip_peer *peer)
{
ast_debug(3, "Destroying SIP peer %s\n", peer->name);
- ast_log(LOG_NOTICE,"Destroying SIP peer %s\n", peer->name);
if (peer->outboundproxy)
ast_free(peer->outboundproxy);
peer->outboundproxy = NULL;
@@ -3546,7 +3542,6 @@
static void sip_destroy_user(struct sip_user *user)
{
ast_debug(3, "Destroying user object from memory: %s\n", user->name);
- ast_log(LOG_NOTICE,"Destroying SIP user %s\n", user->name);
ast_free_ha(user->ha);
if (user->chanvars) {
ast_variables_destroy(user->chanvars);
@@ -9247,12 +9242,10 @@
peer->addr.sin_port = htons(port);
if (sipsock < 0) {
/* SIP isn't up yet, so schedule a poke only, pretty soon */
- ast_log(LOG_WARNING,"About to sched_replace peer pokeexpire(%d) for peer in reg_source_db\n", peer->pokeexpire);
peer->pokeexpire = ast_sched_replace(peer->pokeexpire, sched,
ast_random() % 5000 + 1, sip_poke_peer_s, peer);
} else
sip_poke_peer(peer);
- ast_log(LOG_WARNING,"About to sched_replace peer expire(%d) for peer in reg_source_db\n", peer->expire);
peer->expire = ast_sched_replace(peer->expire, sched,
(expiry + 10) * 1000, expire_register, peer);
register_peer_exten(peer, TRUE);
@@ -11266,6 +11259,7 @@
{
regex_t regexbuf;
int havepattern = FALSE;
+ int count = 0;
struct sip_user *user;
struct ao2_iterator i;
@@ -11302,7 +11296,7 @@
i = ao2_iterator_init(users, 0);
while ((user = ao2_t_iterator_next(&i, "iterate thru user table"))) {
-
+ count++;
if (havepattern && regexec(®exbuf, user->name, 0, NULL, 0)) {
ao2_unlock(user);
continue;
@@ -11319,7 +11313,8 @@
if (havepattern)
regfree(®exbuf);
-
+ ast_cli(a->fd,"Total of %d user entries\n", count);
+
return CLI_SUCCESS;
#undef FORMAT
}
@@ -11576,7 +11571,7 @@
int *fd = arg;
char s[1000];
- snprintf(s,sizeof(s), "name: %s\nobjflags: %d\nrefcount: %d\n\n",
+ snprintf(s,sizeof(s), "name: %s\ntype: user\nobjflags: %d\nrefcount: %d\n\n",
user->name, 0, refc);
ast_cli(*fd, s);
return 0;
@@ -11589,8 +11584,21 @@
int *fd = arg;
char s[1000];
- snprintf(s,sizeof(s), "name: %s\nobjflags: %d\nrefcount: %d\n\n",
+ snprintf(s,sizeof(s), "name: %s\ntype: peer\nobjflags: %d\nrefcount: %d\n\n",
peer->name, 0, refc);
+ ast_cli(*fd, s);
+ return 0;
+}
+
+static int dialog_dump_func(void *userobj, void *arg, int flags)
+{
+ struct sip_pvt *pvt = userobj;
+ int refc = ao2_t_ref(userobj,0,"");
+ int *fd = arg;
+ char s[1000];
+
+ snprintf(s,sizeof(s), "name: %s\ntype: dialog\nobjflags: %d\nrefcount: %d\n\n",
+ pvt->callid, 0, refc);
ast_cli(*fd, s);
return 0;
}
@@ -11620,6 +11628,8 @@
ao2_t_callback(peers, OBJ_NODATA, peer_dump_func, &a->fd,"initiate ao2_callback to dump peers");
ast_cli(a->fd, "-= Registry objects: %d =-\n\n", regobjs);
ASTOBJ_CONTAINER_DUMP(a->fd, tmp, sizeof(tmp), ®l);
+ ast_cli(a->fd, "-= Dialog objects:\n\n");
+ ao2_t_callback(dialogs, OBJ_NODATA, dialog_dump_func, &a->fd,"initiate ao2_callback to dump dialogs");
return CLI_SUCCESS;
}
/*! \brief Print call group and pickup group */
@@ -18386,8 +18396,6 @@
struct ast_flags userflags[2] = {{(0)}};
struct ast_flags mask[2] = {{(0)}};
- ast_log(LOG_NOTICE,"Allocating USER object for %s\n", name);
-
if (!(user = ao2_t_alloc(sizeof(*user), sip_destroy_user_fn, "allocate a user struct")))
return NULL;
@@ -18606,7 +18614,6 @@
*/
strcpy(tmp_peer.name, name);
/* peer = ASTOBJ_CONTAINER_FIND_UNLINK_FULL(&peerl, name, name, 0, 0, strcmp); */
- ast_log(LOG_NOTICE,"UNLINK peer %s\n", name);
peer = ao2_t_find(peers, &tmp_peer, OBJ_POINTER|OBJ_UNLINK,"find and unlink peer from peers table");
}
@@ -18616,8 +18623,6 @@
if (!(peer->theMark))
firstpass = 0;
} else {
- ast_log(LOG_NOTICE,"Allocating PEER object to %s\n", name);
-
if (!(peer = ao2_t_alloc(sizeof(*peer),sip_destroy_peer_fn, "allocate a peer struct")))
return NULL;
@@ -18915,8 +18920,10 @@
int auto_sip_domains = FALSE;
struct sockaddr_in old_bindaddr = bindaddr;
int registry_count = 0, peer_count = 0, user_count = 0;
-
+ time_t run_start, run_end;
+
ast_log(LOG_NOTICE,"reload_config begun...\n");
+ run_start = time(0);
cfg = ast_config_load(config, config_flags);
@@ -19571,7 +19578,8 @@
ast_log(LOG_NOTICE,"reload_config 12...\n");
/* Done, tell the manager */
manager_event(EVENT_FLAG_SYSTEM, "ChannelReload", "ChannelType: SIP\r\nReloadReason: %s\r\nRegistry_Count: %d\r\nPeer_Count: %d\r\nUser_Count: %d\r\n", channelreloadreason2txt(reason), registry_count, peer_count, user_count);
- ast_log(LOG_NOTICE,"reload_config done...\n");
+ run_end = time(0);
+ ast_log(LOG_NOTICE,"reload_config done...Runtime= %d sec\n", (int)(run_end-run_start));
return 0;
}
@@ -20046,7 +20054,6 @@
while ((peer = ao2_t_iterator_next(&i, "iterate thru peers table"))) {
ms += 100;
- ast_log(LOG_WARNING,"About to sched_replace peer pokeexpire(%d) for peer in sip_poke_all_peers\n", peer->pokeexpire);
peer->pokeexpire = ast_sched_replace(peer->pokeexpire,
sched, ms, sip_poke_peer_s, peer);
unref_peer(peer,"toss iterator peer ptr");
@@ -20067,7 +20074,6 @@
ASTOBJ_CONTAINER_TRAVERSE(®l, 1, do {
ASTOBJ_WRLOCK(iterator); /* was WRLOCK */
ms += regspacing;
- ast_log(LOG_WARNING,"About to sched_replace reg expire(%d) for reg in sip_send_all_registers\n", iterator->expire);
iterator->expire = ast_sched_replace(iterator->expire,
sched, ms, sip_reregister, iterator);
ASTOBJ_UNLOCK(iterator);
@@ -20078,8 +20084,11 @@
/*! \brief Reload module */
static int sip_do_reload(enum channelreloadreason reason)
{
+ time_t start_poke, end_poke;
+
reload_config(reason);
+ start_poke = time(0);
/* Prune peers who still are supposed to be deleted */
ast_log(LOG_NOTICE,"Callback to prune marked peers\n");
ao2_t_callback(peers, OBJ_NODATA|OBJ_UNLINK, peer_is_marked, 0, "callback to remove marked peers");
@@ -20091,6 +20100,9 @@
/* Register with all services */
sip_send_all_registers();
+ end_poke = time(0);
+
+ ast_log(LOG_NOTICE, "do_reload finished. peer poke/prune reg contact time = %d sec.\n", (int)(end_poke-start_poke));
ast_debug(4, "--------------- SIP reload done\n");
Modified: team/murf/bug11210/main/sched.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/main/sched.c?view=diff&rev=94897&r1=94896&r2=94897
==============================================================================
--- team/murf/bug11210/main/sched.c (original)
+++ team/murf/bug11210/main/sched.c Thu Dec 27 10:32:29 2007
@@ -236,7 +236,6 @@
res = tmp->id;
}
}
- ast_log(LOG_ERROR,"SCHED: add schedule entry in %d! ID=%d\n", when, res);
#ifdef DUMP_SCHEDULER
/* Dump contents of the context while we have the lock so nothing gets screwed up by accident. */
if (option_debug)
@@ -269,7 +268,6 @@
struct sched *s;
DEBUG(ast_debug(1, "ast_sched_del()\n"));
- ast_log(LOG_ERROR,"SCHED: delete schedule entry %d!\n", id);
ast_mutex_lock(&con->lock);
AST_LIST_TRAVERSE_SAFE_BEGIN(&con->schedq, s, list) {
More information about the asterisk-commits
mailing list