Fix statistics error

statistics.quantiles doesn't handle the case of having only one data sample.
This commit is contained in:
sparky8512 2021-02-13 17:21:11 -08:00
parent 80e752a510
commit 2ac5944824

View file

@ -1018,10 +1018,12 @@ def history_stats(parse_samples, start=None, verbose=False, context=None):
rtt_all.sort(key=lambda x: x[0])
wmean_all, wdeciles_all = weighted_mean_and_quantiles(rtt_all, 10)
if rtt_full:
if len(rtt_full) > 1:
deciles_full = [min(rtt_full)]
deciles_full.extend(statistics.quantiles(rtt_full, n=10, method="inclusive"))
deciles_full.append(max(rtt_full))
elif rtt_full:
deciles_full = [rtt_full[0]] * 11
else:
deciles_full = [None] * 11