[asterisk-commits] russell: branch russell/heap r175847 - in /team/russell/heap: include/asteris...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun Feb 15 15:20:42 CST 2009
Author: russell
Date: Sun Feb 15 15:20:42 2009
New Revision: 175847
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=175847
Log:
Finish conversion of scheduler debugging routines
Modified:
team/russell/heap/include/asterisk/sched.h
team/russell/heap/main/sched.c
Modified: team/russell/heap/include/asterisk/sched.h
URL: http://svn.digium.com/svn-view/asterisk/team/russell/heap/include/asterisk/sched.h?view=diff&rev=175847&r1=175846&r2=175847
==============================================================================
--- team/russell/heap/include/asterisk/sched.h (original)
+++ team/russell/heap/include/asterisk/sched.h Sun Feb 15 15:20:42 2009
@@ -257,7 +257,7 @@
* Debugging: Dump the contents of the scheduler to stderr
* \param con Context to dump
*/
-void ast_sched_dump(const struct sched_context *con);
+void ast_sched_dump(struct sched_context *con);
/*! \brief Returns the number of seconds before an event takes place
* \param con Context to use
Modified: team/russell/heap/main/sched.c
URL: http://svn.digium.com/svn-view/asterisk/team/russell/heap/main/sched.c?view=diff&rev=175847&r1=175846&r2=175847
==============================================================================
--- team/russell/heap/main/sched.c (original)
+++ team/russell/heap/main/sched.c Sun Feb 15 15:20:42 2009
@@ -517,8 +517,9 @@
ast_str_set(buf, 0, " Highwater = %d\n schedcnt = %d\n", con->highwater, con->schedcnt);
+ ast_mutex_lock(&con->lock);
+
heap_size = ast_heap_size(con->sched_heap);
-
for (x = 1; x <= heap_size; x++) {
cur = ast_heap_peek(con->sched_heap, x);
/* match the callback to the cblist */
@@ -534,6 +535,8 @@
}
}
+ ast_mutex_unlock(&con->lock);
+
for (i = 0; i < cbnames->numassocs; i++) {
ast_str_append(buf, 0, " %s : %d\n", cbnames->list[i], countlist[i]);
}
@@ -542,10 +545,12 @@
}
/*! \brief Dump the contents of the scheduler to LOG_DEBUG */
-void ast_sched_dump(const struct sched_context *con)
-{
- //struct sched *q;
- //struct timeval when = ast_tvnow();
+void ast_sched_dump(struct sched_context *con)
+{
+ struct sched *q;
+ struct timeval when = ast_tvnow();
+ int x;
+ size_t heap_size;
#ifdef SCHED_MAX_CACHE
ast_debug(1, "Asterisk Schedule Dump (%d in Q, %d Total, %d Cache, %d high-water)\n", con->schedcnt, con->eventcnt - 1, con->schedccnt, con->highwater);
#else
@@ -555,10 +560,12 @@
ast_debug(1, "=============================================================\n");
ast_debug(1, "|ID Callback Data Time (sec:ms) |\n");
ast_debug(1, "+-----+-----------------+-----------------+-----------------+\n");
-#if 0
- AST_DLLIST_TRAVERSE(&con->schedq, q, list) {
- struct timeval delta = ast_tvsub(q->when, when);
-
+ ast_mutex_lock(&con->lock);
+ heap_size = ast_heap_size(con->sched_heap);
+ for (x = 1; x <= heap_size; x++) {
+ struct timeval delta;
+ q = ast_heap_peek(con->sched_heap, x);
+ delta = ast_tvsub(q->when, when);
ast_debug(1, "|%.4d | %-15p | %-15p | %.6ld : %.6ld |\n",
q->id,
q->callback,
@@ -566,9 +573,8 @@
(long)delta.tv_sec,
(long int)delta.tv_usec);
}
-#endif
+ ast_mutex_unlock(&con->lock);
ast_debug(1, "=============================================================\n");
-
}
/*! \brief
More information about the asterisk-commits
mailing list