summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4de560d)
raw | patch | inline | side by side (parent: 4de560d)
author | Florian Forster <octo@collectd.org> | |
Fri, 26 Sep 2014 02:10:32 +0000 (19:10 -0700) | ||
committer | Florian Forster <octo@collectd.org> | |
Fri, 26 Sep 2014 02:10:32 +0000 (19:10 -0700) |
src/cpu.c | patch | blob | history |
diff --git a/src/cpu.c b/src/cpu.c
index 475d18ac4e8a83e2d51642da667acf5713c5e338..fae7ab9a07eaa47b185335fb9a624d54326ba82a 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
{
value_t value;
+ /* This function is called for all known CPU states, but each read
+ * method will only report a subset. The remaining states are left as
+ * NAN and we ignore them here. */
+ if (isnan (percent))
+ return;
+
value.gauge = percent;
submit_value (cpu_num, cpu_state, "percent", value);
}
cpu_state_t *tmp;
size_t sz;
- if (cpu_num < 0)
- return (EINVAL);
-
sz = (((size_t) cpu_num) + 1) * CPU_STATE_MAX;
assert (sz > 0);