diff --git a/src/utils_latency.c b/src/utils_latency.c
index cfe90e27ac97f8869d31cf68c33f32d37f3f55fb..7f60e11da80796466819241d4966d0c31bb5bf69 100644 (file)
--- a/src/utils_latency.c
+++ b/src/utils_latency.c
/**
* collectd - src/utils_latency.c
/**
* collectd - src/utils_latency.c
- * Copyright (C) 2013 Florian Forster
+ * Copyright (C) 2013 Florian Forster
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
DEBUG("utils_latency: change_bin_width: fixed all bins");
}
DEBUG("utils_latency: change_bin_width: fixed all bins");
}
- DEBUG("utils_latency: change_bin_width: val-[%ld], oldBinWidth-[%d], "
+ DEBUG("utils_latency: change_bin_width: val-[%zu], oldBinWidth-[%d], "
"newBinWidth-[%d], required_bin_width-[%f], "
"required_bin_width_logbase2-[%f]",
val, old_bin_width, new_bin_width, required_bin_width,
"newBinWidth-[%d], required_bin_width-[%f], "
"required_bin_width_logbase2-[%f]",
val, old_bin_width, new_bin_width, required_bin_width,
{
double average;
{
double average;
- if (lc == NULL)
+ if ((lc == NULL) || (lc->num == 0))
return (0);
average = CDTIME_T_TO_DOUBLE (lc->sum) / ((double) lc->num);
return (0);
average = CDTIME_T_TO_DOUBLE (lc->sum) / ((double) lc->num);
int sum;
size_t i;
int sum;
size_t i;
- if ((lc == NULL) || !((percent > 0.0) && (percent < 100.0)))
+ if ((lc == NULL) || (lc->num == 0) || !((percent > 0.0) && (percent < 100.0)))
return (0);
/* Find index i so that at least "percent" events are within i+1 ms. */
return (0);
/* Find index i so that at least "percent" events are within i+1 ms. */