diff options
author | mogorman <mogorman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-10-03 15:53:07 +0000 |
---|---|---|
committer | mogorman <mogorman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-10-03 15:53:07 +0000 |
commit | 4a1aaf52ae4189e660ad57ba69253f54603a2beb (patch) | |
tree | 27a80e26cf8f6ea1728ab5b2b8cc7573fd9f7cdc /main/sched.c | |
parent | 1bd1494da59a95dce73628aafc4ba892036b82b2 (diff) |
bug #8076 check option_debug before printing to debug channel.
patch provided in bugnote, with minor changes.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44253 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/sched.c')
-rw-r--r-- | main/sched.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/main/sched.c b/main/sched.c index 30b0af243..5fc0ef9ed 100644 --- a/main/sched.c +++ b/main/sched.c @@ -201,7 +201,8 @@ static int sched_settime(struct timeval *tv, int when) *tv = now; *tv = ast_tvadd(*tv, ast_samp2tv(when, 1000)); if (ast_tvcmp(*tv, now) < 0) { - ast_log(LOG_DEBUG, "Request to schedule in the past?!?!\n"); + if (option_debug) + ast_log(LOG_DEBUG, "Request to schedule in the past?!?!\n"); *tv = now; } return 0; @@ -296,26 +297,29 @@ void ast_sched_dump(const struct sched_context *con) struct sched *q; struct timeval tv = ast_tvnow(); #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); + if (option_debug) + 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); + if (option_debug) + ast_log(LOG_DEBUG, "Asterisk Schedule Dump (%d in Q, %d Total)\n", con->schedcnt, con->eventcnt - 1); #endif + if (option_debug) { ast_log(LOG_DEBUG, "=============================================================\n"); ast_log(LOG_DEBUG, "|ID Callback Data Time (sec:ms) |\n"); ast_log(LOG_DEBUG, "+-----+-----------------+-----------------+-----------------+\n"); - AST_LIST_TRAVERSE(&con->schedq, q, list) { - struct timeval delta = ast_tvsub(q->when, tv); - - ast_log(LOG_DEBUG, "|%.4d | %-15p | %-15p | %.6ld : %.6ld |\n", - q->id, - q->callback, - q->data, - delta.tv_sec, - (long int)delta.tv_usec); + AST_LIST_TRAVERSE(&con->schedq, q, list) { + struct timeval delta = ast_tvsub(q->when, tv); + + ast_log(LOG_DEBUG, "|%.4d | %-15p | %-15p | %.6ld : %.6ld |\n", + q->id, + q->callback, + q->data, + delta.tv_sec, + (long int)delta.tv_usec); + } + ast_log(LOG_DEBUG, "=============================================================\n"); } - ast_log(LOG_DEBUG, "=============================================================\n"); - } /*! \brief |