summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9008c5e)
raw | patch | inline | side by side (parent: 9008c5e)
author | Florian Forster <octo@huhu.verplant.org> | |
Tue, 20 Jan 2009 09:34:51 +0000 (10:34 +0100) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Tue, 20 Jan 2009 09:34:51 +0000 (10:34 +0100) |
It's a well-known fact only Chuck Norris can do that!
src/memcached.c | patch | blob | history |
diff --git a/src/memcached.c b/src/memcached.c
index fb33880ff5cc68aae4764723742e4cc3e0944f99..f139b7195591f637a51998b5fe132192414dabfa 100644 (file)
--- a/src/memcached.c
+++ b/src/memcached.c
if ((octets_rx != 0) || (octets_tx != 0))
submit_counter2 ("memcached_octets", NULL, octets_rx, octets_tx);
- if (! isnan (gets) && !isnan (hits))
- submit_gauge ("percent", "hitratio", (hits / gets) * 100.0);
+ if (!isnan (gets) && !isnan (hits))
+ {
+ gauge_t rate = NAN;
+
+ if (gets != 0.0)
+ rate = 100.0 * hits / gets;
+
+ submit_gauge ("percent", "hitratio", rate);
+ }
+
return 0;
}
/* }}} */