From 2a03c008acc2f6d289da37f853158e6687f77e1f Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 5 May 2017 11:09:21 -0400 Subject: [PATCH] clean up code artifacts closes #314 Change-Id: Ie6762654adc67a2cc2fd34c0bdda7a514928d389 --- daemon/call.c | 9 +++++---- daemon/call.h | 2 -- daemon/statistics.c | 2 ++ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index 833477c85..ee266913a 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -119,6 +119,8 @@ const int num_transport_protocols = G_N_ELEMENTS(transport_protocols); static void __monologue_destroy(struct call_monologue *monologue); static int monologue_destroy(struct call_monologue *ml); +static struct timeval add_ongoing_calls_dur_in_interval(struct callmaster *m, + struct timeval *interval_start, struct timeval *interval_duration); /* called with call->master_lock held in R */ static int call_timer_delete_monologues(struct call *c) { @@ -1775,11 +1777,11 @@ void add_total_calls_duration_in_interval(struct callmaster *cm, mutex_unlock(&cm->totalstats_interval.total_calls_duration_lock); } -struct timeval add_ongoing_calls_dur_in_interval(struct callmaster *m, +static struct timeval add_ongoing_calls_dur_in_interval(struct callmaster *m, struct timeval *interval_start, struct timeval *interval_duration) { GHashTableIter iter; gpointer key, value; - struct timeval call_duration, now, res = {0}; + struct timeval call_duration, res = {0}; struct call *call; struct call_monologue *ml; @@ -1794,8 +1796,7 @@ struct timeval add_ongoing_calls_dur_in_interval(struct callmaster *m, if (timercmp(interval_start, &ml->started, >)) { timeval_add(&res, &res, interval_duration); } else { - gettimeofday(&now, NULL); - timeval_subtract(&call_duration, &now, &ml->started); + timeval_subtract(&call_duration, &g_now, &ml->started); timeval_add(&res, &res, &call_duration); } } diff --git a/daemon/call.h b/daemon/call.h index 6c2cec72e..d4858c6e2 100644 --- a/daemon/call.h +++ b/daemon/call.h @@ -442,8 +442,6 @@ struct callmaster { struct callmaster *callmaster_new(struct poller *); void callmaster_get_all_calls(struct callmaster *m, GQueue *q); -struct timeval add_ongoing_calls_dur_in_interval(struct callmaster *m, - struct timeval *iv_start, struct timeval *iv_duration); //void calls_dump_redis(struct callmaster *); //void calls_dump_redis_read(struct callmaster *); diff --git a/daemon/statistics.c b/daemon/statistics.c index db20c3505..3d7b12643 100644 --- a/daemon/statistics.c +++ b/daemon/statistics.c @@ -176,6 +176,8 @@ void statistics_update_oneway(struct call* c) { if (c->monologues.head) { ml = c->monologues.head->data; + timeval_subtract(&tim_result_duration, &g_now, &ml->started); + if (IS_OWN_CALL(c)) { if (ml->term_reason==TIMEOUT) { atomic64_inc(&m->totalstats.total_timeout_sess);