projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ea47de8
)
Statsd: avoid doing a division by zero when calculating the average if we didn't...
author
Wilfried Goesgens
<dothebart@citadel.org>
Sat, 21 Jun 2014 19:14:28 +0000
(21:14 +0200)
committer
Wilfried Goesgens
<dothebart@citadel.org>
Sat, 21 Jun 2014 19:14:28 +0000
(21:14 +0200)
src/utils_latency.c
patch
|
blob
|
history
diff --git
a/src/utils_latency.c
b/src/utils_latency.c
index
94da211
..
bfe91fd
100644
(file)
--- a/
src/utils_latency.c
+++ b/
src/utils_latency.c
@@
-128,7
+128,7
@@
cdtime_t latency_counter_get_average (latency_counter_t *lc) /* {{{ */
{
double average;
- if (
lc == NULL
)
+ if (
(lc == NULL) || (lc->num == 0)
)
return (0);
average = CDTIME_T_TO_DOUBLE (lc->sum) / ((double) lc->num);