summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (from parent 1: a673944)
raw | patch | inline | side by side (from parent 1: a673944)
author | Florian Forster <ff@octo.it> | |
Sun, 12 Oct 2014 15:32:06 +0000 (17:32 +0200) | ||
committer | Florian Forster <ff@octo.it> | |
Sun, 12 Oct 2014 15:32:06 +0000 (17:32 +0200) |
src/oping.c | patch | blob | history |
diff --git a/src/oping.c b/src/oping.c
index 6496331d63994545786687048ad7869874c77113..5e63392092acbaa7b3dea0d76be3161c5e846cbd 100644 (file)
--- a/src/oping.c
+++ b/src/oping.c
double threshold = percentile / 100.0;
double index_to_ms_factor;
size_t i;
+ double ret;
if (ctx->histogram_ratio == NULL)
return (NAN);
/* Multiply with i+1, because we're interested in the _upper_ bound of
* each bucket. */
- return (index_to_ms_factor * ((double) (i + 1)));
+ ret = (index_to_ms_factor * ((double) (i + 1)));
+
+ /* Avoid reporting a higher latency than latency_max. */
+ if (ret > ctx->latency_max)
+ ret = ctx->latency_max;
+
+ return (ret);
} /* }}} double context_get_percentile */
static double context_get_stddev (ping_context_t *ctx) /* {{{ */