diff --git a/daemon/cli.c b/daemon/cli.c index e01e7aafd..f07d34423 100644 --- a/daemon/cli.c +++ b/daemon/cli.c @@ -21,7 +21,7 @@ static void cli_incoming_list_totals(char* buffer, int len, struct callmaster* m int printlen=0; struct timeval avg, calls_dur_iv; u_int64_t num_sessions, min_sess_iv, max_sess_iv; - struct request_time offer, answer, delete; + struct request_time offer_iv, answer_iv, delete_iv; mutex_lock(&m->totalstats.total_average_lock); avg = m->totalstats.total_average_call_dur; @@ -59,24 +59,15 @@ static void cli_incoming_list_totals(char* buffer, int len, struct callmaster* m calls_dur_iv = m->totalstats_lastinterval.total_calls_duration_interval; min_sess_iv = m->totalstats_lastinterval.managed_sess_min; max_sess_iv = m->totalstats_lastinterval.managed_sess_max; - mutex_unlock(&m->totalstats_lastinterval_lock); - - mutex_lock(&m->totalstats_interval.offer.lock); - offer = m->totalstats_interval.offer; - mutex_unlock(&m->totalstats_interval.offer.lock); - - mutex_lock(&m->totalstats_interval.answer.lock); - answer = m->totalstats_interval.answer; - mutex_unlock(&m->totalstats_interval.answer.lock); - - mutex_lock(&m->totalstats_interval.delete.lock); - delete = m->totalstats_interval.delete; - mutex_unlock(&m->totalstats_interval.delete.lock); + offer_iv = m->totalstats_lastinterval.offer; + answer_iv = m->totalstats_lastinterval.answer; + delete_iv = m->totalstats_lastinterval.delete; + mutex_unlock(&m->totalstats_lastinterval_lock); // compute average offer/answer/delete time - timeval_divide(&offer.time_avg, &offer.time_avg, offer.count); - timeval_divide(&answer.time_avg, &answer.time_avg, answer.count); - timeval_divide(&delete.time_avg, &delete.time_avg, delete.count); + timeval_divide(&offer_iv.time_avg, &offer_iv.time_avg, offer_iv.count); + timeval_divide(&answer_iv.time_avg, &answer_iv.time_avg, answer_iv.count); + timeval_divide(&delete_iv.time_avg, &delete_iv.time_avg, delete_iv.count); printlen = snprintf(replybuffer,(outbufend-replybuffer), "\nGraphite interval statistics (last reported values to graphite):\n"); ADJUSTLEN(printlen,outbufend,replybuffer); @@ -87,19 +78,19 @@ static void cli_incoming_list_totals(char* buffer, int len, struct callmaster* m printlen = snprintf(replybuffer,(outbufend-replybuffer), " Max managed sessions :"UINT64F"\n", max_sess_iv); ADJUSTLEN(printlen,outbufend,replybuffer); printlen = snprintf(replybuffer,(outbufend-replybuffer), " Min/Max/Avg offer processing delay :%llu.%06llu/%llu.%06llu/%llu.%06llu sec\n", - (unsigned long long)offer.time_min.tv_sec,(unsigned long long)offer.time_min.tv_usec, - (unsigned long long)offer.time_max.tv_sec,(unsigned long long)offer.time_max.tv_usec, - (unsigned long long)offer.time_avg.tv_sec,(unsigned long long)offer.time_avg.tv_usec); + (unsigned long long)offer_iv.time_min.tv_sec,(unsigned long long)offer_iv.time_min.tv_usec, + (unsigned long long)offer_iv.time_max.tv_sec,(unsigned long long)offer_iv.time_max.tv_usec, + (unsigned long long)offer_iv.time_avg.tv_sec,(unsigned long long)offer_iv.time_avg.tv_usec); ADJUSTLEN(printlen,outbufend,replybuffer); printlen = snprintf(replybuffer,(outbufend-replybuffer), " Min/Max/Avg answer processing delay :%llu.%06llu/%llu.%06llu/%llu.%06llu sec\n", - (unsigned long long)answer.time_min.tv_sec,(unsigned long long)answer.time_min.tv_usec, - (unsigned long long)answer.time_max.tv_sec,(unsigned long long)answer.time_max.tv_usec, - (unsigned long long)answer.time_avg.tv_sec,(unsigned long long)answer.time_avg.tv_usec); + (unsigned long long)answer_iv.time_min.tv_sec,(unsigned long long)answer_iv.time_min.tv_usec, + (unsigned long long)answer_iv.time_max.tv_sec,(unsigned long long)answer_iv.time_max.tv_usec, + (unsigned long long)answer_iv.time_avg.tv_sec,(unsigned long long)answer_iv.time_avg.tv_usec); ADJUSTLEN(printlen,outbufend,replybuffer); printlen = snprintf(replybuffer,(outbufend-replybuffer), " Min/Max/Avg delete processing delay :%llu.%06llu/%llu.%06llu/%llu.%06llu sec\n", - (unsigned long long)delete.time_min.tv_sec,(unsigned long long)delete.time_min.tv_usec, - (unsigned long long)delete.time_max.tv_sec,(unsigned long long)delete.time_max.tv_usec, - (unsigned long long)delete.time_avg.tv_sec,(unsigned long long)delete.time_avg.tv_usec); + (unsigned long long)delete_iv.time_min.tv_sec,(unsigned long long)delete_iv.time_min.tv_usec, + (unsigned long long)delete_iv.time_max.tv_sec,(unsigned long long)delete_iv.time_max.tv_usec, + (unsigned long long)delete_iv.time_avg.tv_sec,(unsigned long long)delete_iv.time_avg.tv_usec); ADJUSTLEN(printlen,outbufend,replybuffer); printlen = snprintf(replybuffer,(outbufend-replybuffer), "\n\n");