From: Timo Sirainen Date: Tue, 24 Apr 2018 14:32:21 +0000 (+0300) Subject: stats: Support dumping any given percentile X-Git-Tag: 2.3.9~1946 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13f3f8e4db2bb658aa846d586cd2f2a5ea12bb94;p=thirdparty%2Fdovecot%2Fcore.git stats: Support dumping any given percentile --- diff --git a/src/stats/client-reader.c b/src/stats/client-reader.c index 8e609a6bb1..d4be3b8258 100644 --- a/src/stats/client-reader.c +++ b/src/stats/client-reader.c @@ -56,9 +56,10 @@ static void reader_client_dump_stats(string_t *str, struct stats_dist *stats, str_printfa(str, "%"PRIu64, stats_dist_get_median(stats)); else if (strcmp(field, "variance") == 0) str_printfa(str, "%.02f", stats_dist_get_variance(stats)); - else if (strcmp(field, "%95") == 0) - str_printfa(str, "%"PRIu64, stats_dist_get_95th(stats)); - else { + else if (field[0] == '%') { + str_printfa(str, "%"PRIu64, + stats_dist_get_percentile(stats, strtod(field+1, NULL)/100.0)); + } else { /* return unknown fields as empty */ } }