Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv12980
Modified Files:
Makefile sched.c
Log Message:
clean up scheduler debugging and expose defines in the Makefile (bug #4703)
Index: Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/Makefile,v
retrieving revision 1.180
retrieving revision 1.181
diff -u -d -r1.180 -r1.181
--- Makefile 15 Jul 2005 00:39:01 -0000 1.180
+++ Makefile 15 Jul 2005 22:21:31 -0000 1.181
@@ -52,7 +52,7 @@
#endif
# Optional debugging parameters
-DEBUG_THREADS = #-DDEBUG_THREADS #-DDO_CRASH #-DDETECT_DEADLOCKS
+DEBUG_THREADS = #-DDUMP_SCHEDULER #-DDEBUG_SCHEDULER #-DDEBUG_THREADS
#-DDO_CRASH #-DDETECT_DEADLOCKS
# Uncomment next one to enable ast_frame tracing (for debugging)
TRACE_FRAMES = #-DTRACE_FRAMES
Index: sched.c
===================================================================
RCS file: /usr/cvsroot/asterisk/sched.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- sched.c 6 Jun 2005 22:12:18 -0000 1.20
+++ sched.c 15 Jul 2005 22:21:31 -0000 1.21
@@ -260,6 +260,10 @@
res = tmp->id;
}
}
+#ifdef DUMP_SCHEDULER
+ /* Dump contents of the context while we have the lock so nothing gets
screwed up by accident. */
+ ast_sched_dump(con);
+#endif
ast_mutex_unlock(&con->lock);
return res;
}
@@ -289,6 +293,10 @@
last = s;
s = s->next;
}
+#ifdef DUMP_SCHEDULER
+ /* Dump contents of the context while we have the lock so nothing gets
screwed up by accident. */
+ ast_sched_dump(con);
+#endif
ast_mutex_unlock(&con->lock);
if (!s) {
ast_log(LOG_NOTICE, "Attempted to delete nonexistent schedule
entry %d!\n", id);
@@ -300,7 +308,7 @@
return 0;
}
-void ast_sched_dump(struct sched_context *con)
+void ast_sched_dump(const struct sched_context *con)
{
/*
* Dump the contents of the scheduler to
@@ -311,16 +319,14 @@
time_t s, ms;
gettimeofday(&tv, NULL);
#ifdef SCHED_MAX_CACHE
- ast_log(LOG_DEBUG, "Asterisk Schedule Dump (%d in Q, %d Total, %d
Cache)\n",
- con-> schedcnt,
con->eventcnt - 1, con->schedccnt);
+ ast_log(LOG_DEBUG, "Asterisk Schedule Dump (%d in Q, %d Total, %d
Cache)\n", con->schedcnt, con->eventcnt - 1, con->schedccnt);
#else
- ast_log(LOG_DEBUG, "Asterisk Schedule Dump (%d in Q, %d Total)\n",
- con-> schedcnt,
con->eventcnt - 1);
+ ast_log(LOG_DEBUG, "Asterisk Schedule Dump (%d in Q, %d Total)\n",
con->schedcnt, con->eventcnt - 1);
#endif
- ast_log(LOG_DEBUG,
"=================================================\n");
- ast_log(LOG_DEBUG, "|ID Callback Data Time (sec:ms)
|\n");
- ast_log(LOG_DEBUG,
"+-----+-----------+-----------+-----------------+\n");
+ ast_log(LOG_DEBUG,
"=============================================================\n");
+ ast_log(LOG_DEBUG, "|ID Callback Data Time
(sec:ms) |\n");
+ ast_log(LOG_DEBUG,
"+-----+-----------------+-----------------+-----------------+\n");
q = con->schedq;
while(q) {
s = q->when.tv_sec - tv.tv_sec;
@@ -329,7 +335,7 @@
ms += 1000000;
s--;
}
- ast_log(LOG_DEBUG, "|%.4d | %p | %p | %.6ld : %.6ld |\n",
+ ast_log(LOG_DEBUG, "|%.4d | %-15p | %-15p | %.6ld : %.6ld |\n",
q->id,
q->callback,
q->data,
@@ -337,7 +343,7 @@
(long)ms);
q=q->next;
}
- ast_log(LOG_DEBUG,
"=================================================\n");
+ ast_log(LOG_DEBUG,
"=============================================================\n");
}
_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs