summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cb48bb1)
raw | patch | inline | side by side (parent: cb48bb1)
author | Pavel Rochnyack <pavel2000@ngs.ru> | |
Mon, 9 Oct 2017 20:08:38 +0000 (03:08 +0700) | ||
committer | Pavel Rochnyack <pavel2000@ngs.ru> | |
Mon, 9 Oct 2017 20:08:38 +0000 (03:08 +0700) |
If there is no requests, NAN is reported as hitratio.
If there is no hits - zero is reported.
If there is no hits - zero is reported.
src/memcached.c | patch | blob | history |
diff --git a/src/memcached.c b/src/memcached.c
index 5a9faf32a0a84ff6dfe333ed57dd2e12001dfc35..85794a5ccfcf3055923fbd8ef4191e2be21fd6ce 100644 (file)
--- a/src/memcached.c
+++ b/src/memcached.c
*prev_part = part;
*prev_total = total;
- if (num == 0 || denom == 0)
+ if (denom == 0)
return NAN;
+ if (num == 0)
+ return 0;
+
return 100.0 * (gauge_t)num / (gauge_t)denom;
}
*prev1 = part1;
*prev2 = part2;
- if (num == 0 || denom == 0)
+ if (denom == 0)
return NAN;
+ if (num == 0)
+ return 0;
+
return 100.0 * (gauge_t)num / (gauge_t)denom;
}