From 785567892de3114fe9452f40943d72f97943d7e3 Mon Sep 17 00:00:00 2001 From: Christopher Rienzo Date: Wed, 4 Jan 2012 14:51:56 +0000 Subject: [PATCH] added logging for when mod_posix_timer starts and stops --- src/mod/timers/mod_posix_timer/mod_posix_timer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mod/timers/mod_posix_timer/mod_posix_timer.c b/src/mod/timers/mod_posix_timer/mod_posix_timer.c index 97002a86c7..f5b9a61a1f 100644 --- a/src/mod/timers/mod_posix_timer/mod_posix_timer.c +++ b/src/mod/timers/mod_posix_timer/mod_posix_timer.c @@ -44,6 +44,8 @@ typedef struct { switch_size_t tick; switch_mutex_t *mutex; switch_thread_cond_t *cond; + int interval; + int id; } interval_timer_t; static struct { @@ -91,6 +93,7 @@ static switch_status_t posix_timer_start_interval(interval_timer_t *it, int inte } if (it->users <= 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "starting %d ms timer #%d\n", it->interval, it->id + 1); /* reset */ it->tick = 0; it->users = 0; @@ -133,6 +136,7 @@ static switch_status_t posix_timer_stop_interval(interval_timer_t *it) if (it->users > 0) { it->users--; if (it->users == 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "stopping %d ms timer #%d\n", it->interval, it->id + 1); switch_mutex_lock(it->mutex); timer_delete(it->timer); memset(&it->timer, 0, sizeof(it->timer)); @@ -164,6 +168,8 @@ static switch_status_t posix_timer_init(switch_timer_t *timer) } it = &globals.interval_timers[timer->interval][interval_timer_id]; + it->id = interval_timer_id; + it->interval = timer->interval; status = posix_timer_start_interval(it, timer->interval); timer->private_info = it; switch_mutex_unlock(globals.interval_timers_mutex);