Skip to content

Commit

Permalink
stats: Support dumping any given percentile
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen authored and cmouse committed Aug 7, 2018
1 parent d2ec507 commit 023a023
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/stats/client-reader.c
Expand Up @@ -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 */
}
}
Expand Down

0 comments on commit 023a023

Please sign in to comment.