cpu plugin: Correct number of expected CPU states on Mac OS X.
authorRobert Viduya <robert@oit.gatech.edu>
Fri, 29 May 2015 21:47:21 +0000 (17:47 -0400)
committerFlorian Forster <octo@collectd.org>
Sat, 30 May 2015 17:19:26 +0000 (19:19 +0200)
This appears to be a regression introduced in f14ab935. Thanks to Robert Viduya
for reporting the bug.

Signed-off-by: Florian Forster <octo@collectd.org>
src/cpu.c

index 57af2dd..2a2a4a9 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
@@ -582,16 +582,16 @@ static int cpu_read (void)
                        continue;
                }
 
-               if (cpu_info_len < COLLECTD_CPU_STATE_MAX)
+               if (cpu_info_len < CPU_STATE_MAX)
                {
                        ERROR ("cpu plugin: processor_info returned only %i elements..", cpu_info_len);
                        continue;
                }
 
-               cpu_stage (cpu, COLLECTD_CPU_STATE_USER,   (derive_t) cpu_info.cpu_ticks[COLLECTD_CPU_STATE_USER],   now);
-               cpu_stage (cpu, COLLECTD_CPU_STATE_NICE,   (derive_t) cpu_info.cpu_ticks[COLLECTD_CPU_STATE_NICE],   now);
-               cpu_stage (cpu, COLLECTD_CPU_STATE_SYSTEM, (derive_t) cpu_info.cpu_ticks[COLLECTD_CPU_STATE_SYSTEM], now);
-               cpu_stage (cpu, COLLECTD_CPU_STATE_IDLE,   (derive_t) cpu_info.cpu_ticks[COLLECTD_CPU_STATE_IDLE],   now);
+               cpu_stage (cpu, COLLECTD_CPU_STATE_USER,   (derive_t) cpu_info.cpu_ticks[CPU_STATE_USER],   now);
+               cpu_stage (cpu, COLLECTD_CPU_STATE_NICE,   (derive_t) cpu_info.cpu_ticks[CPU_STATE_NICE],   now);
+               cpu_stage (cpu, COLLECTD_CPU_STATE_SYSTEM, (derive_t) cpu_info.cpu_ticks[CPU_STATE_SYSTEM], now);
+               cpu_stage (cpu, COLLECTD_CPU_STATE_IDLE,   (derive_t) cpu_info.cpu_ticks[CPU_STATE_IDLE],   now);
        }
 /* }}} #endif PROCESSOR_CPU_LOAD_INFO */