projects
/
liboping.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c19bb6c
)
Ensure that impossibly latency values do not affect stats
author
Hamish Coleman
<hamish@zot.org>
Fri, 17 Feb 2017 05:02:21 +0000
(13:02 +0800)
committer
Hamish Coleman
<hamish@zot.org>
Fri, 17 Feb 2017 05:02:21 +0000
(13:02 +0800)
src/oping.c
patch
|
blob
|
history
diff --git
a/src/oping.c
b/src/oping.c
index
e439dbf
..
b4999c5
100644
(file)
--- a/
src/oping.c
+++ b/
src/oping.c
@@
-293,6
+293,11
@@
static void clean_history (ping_context_t *ctx) /* {{{ */
memcpy (ctx->history_by_value, ctx->history_by_time,
sizeof (ctx->history_by_time));
memcpy (ctx->history_by_value, ctx->history_by_time,
sizeof (ctx->history_by_time));
+ /* Remove impossible values */
+ for (i = 0; i < ctx->history_size; i++)
+ if (ctx->history_by_value[i]<0)
+ ctx->history_by_value[i]=NAN;
+
/* Sort all RTTs. */
qsort (ctx->history_by_value, ctx->history_size, sizeof
(ctx->history_by_value[0]), compare_double);
/* Sort all RTTs. */
qsort (ctx->history_by_value, ctx->history_size, sizeof
(ctx->history_by_value[0]), compare_double);
@@
-1046,6
+1051,10
@@
static int update_graph_prettyping (ping_context_t *ctx, /* {{{ */
index = (history_offset + x) % ctx->history_size;
latency = ctx->history_by_time[index];
index = (history_offset + x) % ctx->history_size;
latency = ctx->history_by_time[index];
+ if (latency < 0) {
+ continue;
+ }
+
if (latency >= 0.0)
{
double ratio;
if (latency >= 0.0)
{
double ratio;