From: Aki Tuomi Date: Tue, 16 Oct 2018 06:03:05 +0000 (+0300) Subject: stats: Use duration field from events X-Git-Tag: 2.3.9~1186 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fbe550d9e2cb33df3db086aa6162c6970b8197bd;p=thirdparty%2Fdovecot%2Fcore.git stats: Use duration field from events --- diff --git a/src/stats/stats-metrics.c b/src/stats/stats-metrics.c index aba60bfaf8..f2a022ba7d 100644 --- a/src/stats/stats-metrics.c +++ b/src/stats/stats-metrics.c @@ -144,13 +144,9 @@ stats_metrics_get_event_filter(struct stats_metrics *metrics) static void stats_metric_event(struct metric *metric, struct event *event) { - struct timeval tv_start, tv_end; - intmax_t duration = 0; + intmax_t duration; - if (event_get_last_send_time(event, &tv_end)) { - event_get_create_time(event, &tv_start); - duration = timeval_diff_usecs(&tv_end, &tv_start); - } + event_get_last_duration(event, &duration); stats_dist_add(metric->duration_stats, duration); for (unsigned int i = 0; i < metric->fields_count; i++) {