From: Stephan Bosch Date: Mon, 17 Feb 2020 23:06:53 +0000 (+0100) Subject: dict: Make proctitle more consistent and clear. X-Git-Tag: 2.3.11.2~554 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87e49885ce3f2d28a38f3a949301e9cf6cc6d1b8;p=thirdparty%2Fdovecot%2Fcore.git dict: Make proctitle more consistent and clear. --- diff --git a/src/dict/Makefile.am b/src/dict/Makefile.am index b08988d539..279f0d285a 100644 --- a/src/dict/Makefile.am +++ b/src/dict/Makefile.am @@ -23,7 +23,8 @@ dict_LDADD = \ $(libs) \ $(LIBDOVECOT) \ $(DICT_LIBS) \ - $(SQL_LIBS) + $(SQL_LIBS) \ + -lm dict_DEPENDENCIES = $(libs) $(LIBDOVECOT_DEPS) diff --git a/src/dict/main.c b/src/dict/main.c index 722ed025f3..04941a6804 100644 --- a/src/dict/main.c +++ b/src/dict/main.c @@ -20,6 +20,8 @@ #include "dict-settings.h" #include "main.h" +#include + static struct module *modules; static struct timeout *to_proctitle; static bool proctitle_updated; @@ -27,10 +29,19 @@ static bool proctitle_updated; static void add_stats_string(string_t *str, struct stats_dist *stats, const char *name) { - str_printfa(str, ", %u %s:%"PRIu64"/%.02f/%"PRIu64"/%"PRIu64, + uint64_t min, max, p95; + double avg; + + min = stats_dist_get_min(stats); + avg = stats_dist_get_avg(stats); + p95 = stats_dist_get_95th(stats); + max = stats_dist_get_max(stats); + + str_printfa(str, ", %u %s:%llu/%lld/%llu/%llu", stats_dist_get_count(stats), name, - stats_dist_get_min(stats)/1000, stats_dist_get_avg(stats)/1000, - stats_dist_get_95th(stats)/1000, stats_dist_get_max(stats)/1000); + (unsigned long long)min/1000, llrint(avg/1000), + (unsigned long long)p95/1000, + (unsigned long long)max/1000); stats_dist_reset(stats); }