[asterisk-commits] murf: branch murf/mtxprof r135363 - in /team/murf/mtxprof: ./ build_tools/ ch...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Aug 2 11:37:22 CDT 2008
Author: murf
Date: Sat Aug 2 11:37:22 2008
New Revision: 135363
URL: http://svn.digium.com/view/asterisk?view=rev&rev=135363
Log:
some last few cleanups
Modified:
team/murf/mtxprof/Makefile
team/murf/mtxprof/build_tools/cflags-devmode.xml
team/murf/mtxprof/channels/chan_sip.c
team/murf/mtxprof/include/asterisk/lock.h
team/murf/mtxprof/main/channel.c
Modified: team/murf/mtxprof/Makefile
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/Makefile?view=diff&rev=135363&r1=135362&r2=135363
==============================================================================
--- team/murf/mtxprof/Makefile (original)
+++ team/murf/mtxprof/Makefile Sat Aug 2 11:37:22 2008
@@ -116,8 +116,9 @@
OVERWRITE=y
# Include debug and macro symbols in the executables (-g) and profiling info (-pg)
-DEBUG=-g3 -pg
-ASTLDFLAGS += -pg
+DEBUG=-g3
+#DEBUG=-g3 -pg
+#ASTLDFLAGS += -pg
# Define standard directories for various platforms
# These apply if they are not redefined in asterisk.conf
Modified: team/murf/mtxprof/build_tools/cflags-devmode.xml
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/build_tools/cflags-devmode.xml?view=diff&rev=135363&r1=135362&r2=135363
==============================================================================
--- team/murf/mtxprof/build_tools/cflags-devmode.xml (original)
+++ team/murf/mtxprof/build_tools/cflags-devmode.xml Sat Aug 2 11:37:22 2008
@@ -1,7 +1,6 @@
<category name="MENUSELECT_CFLAGS" displayname="Compiler Flags - Development">
<member name="MTX_PROFILE" displayname="Enable Code Profiling Using TSC Counters">
<conflict>DETECT_DEADLOCKS</conflict>
- <conflict>DEBUG_THREADS</conflict>
</member>
<member name="DEBUG_SCHEDULER" displayname="Enable Scheduler Debugging Output">
</member>
Modified: team/murf/mtxprof/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/channels/chan_sip.c?view=diff&rev=135363&r1=135362&r2=135363
==============================================================================
--- team/murf/mtxprof/channels/chan_sip.c (original)
+++ team/murf/mtxprof/channels/chan_sip.c Sat Aug 2 11:37:22 2008
@@ -17408,12 +17408,10 @@
/* Save Record-Route for any later requests we make on this dialogue */
build_route(p, req, 0);
-#ifdef WHAT_IF_WE_DONT_LOCK_THE_CHANNEL
if (c) {
/* Pre-lock the call */
ast_channel_lock(c);
}
-#endif
}
} else {
if (sipdebug) {
@@ -20142,7 +20140,15 @@
}
unref_peer(p, "unref_peer, from sip_devicestate, release ref from find_peer");
} else {
- res = AST_DEVICE_UNKNOWN;
+ /* res = AST_DEVICE_UNKNOWN; */
+ struct hostent *hp;
+ struct ast_hostent ahp;
+ char *port = strchr(host, ':');
+ if (port)
+ *port = '\0';
+ hp = ast_gethostbyname(host, &ahp);
+ if (hp)
+ res = AST_DEVICE_UNKNOWN;
}
return res;
Modified: team/murf/mtxprof/include/asterisk/lock.h
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/include/asterisk/lock.h?view=diff&rev=135363&r1=135362&r2=135363
==============================================================================
--- team/murf/mtxprof/include/asterisk/lock.h (original)
+++ team/murf/mtxprof/include/asterisk/lock.h Sat Aug 2 11:37:22 2008
@@ -1589,6 +1589,8 @@
#define ast_mutex_lock_assign(x,retval) {uint64_t start; static int mutprof=-1; retval = ast_mutex_lock2((x), __FILE__, __FUNCTION__, __LINE__, &start, &mutprof, #x);}
#define ast_mutex_trylock(x) {uint64_t start; static int mutprof=-1; ast_mutex_trylock2((x), __FILE__, __FUNCTION__, __LINE__, &start, &mutprof, #x);}
#define ast_mutex_trylock_assign(x,retval) {uint64_t start; static int mutprof=-1; retval = ast_mutex_trylock2((x), __FILE__, __FUNCTION__, __LINE__, &start, &mutprof, #x);}
+#define ast_mutex_unlock_assign(a,retval) retval=ast_mutex_unlock(a)
+
static inline int ast_mutex_lock2(ast_mutex_t *pmutex, char *file, const char *func, int lineno, uint64_t *start, int *mtx_prof, char *lockstr)
{
Modified: team/murf/mtxprof/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/main/channel.c?view=diff&rev=135363&r1=135362&r2=135363
==============================================================================
--- team/murf/mtxprof/main/channel.c (original)
+++ team/murf/mtxprof/main/channel.c Sat Aug 2 11:37:22 2008
@@ -83,6 +83,10 @@
static int uniqueint;
unsigned long global_fin, global_fout;
+
+#ifdef DEBUG_THREADS
+void log_show_lock(void *this_lock_addr);
+#endif
AST_THREADSTORAGE(state2str_threadbuf);
#define STATE2STR_BUFSIZE 32
@@ -1110,6 +1114,9 @@
* shorten the retry period and possibly cause failures.
* We should definitely go for a better scheme that is deadlock-free.
*/
+
+int profnum = -1;
+
static struct ast_channel *channel_find_locked(const struct ast_channel *prev,
const char *name, const int namelen,
const char *context, const char *exten)
@@ -1119,7 +1126,12 @@
int lockret;
struct ast_channel *c;
const struct ast_channel *_prev = prev;
-
+ uint64_t start_time = ast_mark2();
+
+ if (profnum == -1) {
+ profnum = ast_add_profile("channel_find_locked", 10);
+ }
+
for (retries = 0; retries < 200; retries++) {
int done;
AST_RWLIST_RDLOCK(&channels);
@@ -1172,8 +1184,10 @@
#ifdef HAVE_MTX_PROFILE
ast_log(LOG_NOTICE, "Failure, could not lock '%p' after %d retries (%d)!\n", &c->lock_dont_use, retries, lockret);
#endif
+#ifdef DEBUG_THREADS
if (c)
log_show_lock(&c->lock_dont_use);
+#endif
ast_debug(1, "Failure, could not lock '%p' after %d retries (%d)!\n", c, retries, lockret);
/* As we have deadlocked, we will skip this channel and
@@ -1188,8 +1202,11 @@
}
}
AST_RWLIST_UNLOCK(&channels);
- if (done)
+ if (done) {
+ ast_mark3(profnum, start_time);
return c;
+ }
+
/* If we reach this point we basically tried to lock a channel and failed. Instead of
* starting from the beginning of the list we can restore our saved pointer to the previous
* channel and start from there.
@@ -1197,7 +1214,7 @@
prev = _prev;
usleep(1); /* give other threads a chance before retrying */
}
-
+ ast_mark3(profnum, start_time);
return NULL;
}
@@ -1703,9 +1720,8 @@
log_show_lock(&chan->lock_dont_use);
#endif
- log_show_lock(&chan->lock_dont_use);
+ /* log_show_lock(&chan->lock_dont_use); */
ast_channel_lock(chan); /* in sip runs, this lock eats up a tremendous amount of time */
- log_show_lock(&chan->lock_dont_use);
/* You can't answer an outbound call */
if (ast_test_flag(chan, AST_FLAG_OUTGOING)) {
More information about the asterisk-commits
mailing list