]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
stats: Use duration field from events
authorAki Tuomi <aki.tuomi@dovecot.fi>
Tue, 16 Oct 2018 06:03:05 +0000 (09:03 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Wed, 14 Nov 2018 12:08:50 +0000 (14:08 +0200)
src/stats/stats-metrics.c

index aba60bfaf84151f775b619c1d63b9f9d8dff5dad..f2a022ba7dc174ba157f52a096f2b268c737a944 100644 (file)
@@ -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++) {