summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 42b8eb7)
raw | patch | inline | side by side (parent: 42b8eb7)
author | Pierre-Yves Ritschard <pyr@spootnik.org> | |
Wed, 15 Jan 2014 22:43:18 +0000 (23:43 +0100) | ||
committer | Pierre-Yves Ritschard <pyr@spootnik.org> | |
Wed, 15 Jan 2014 22:43:18 +0000 (23:43 +0100) |
src/cpu.c | patch | blob | history |
diff --git a/src/cpu.c b/src/cpu.c
index a85eba760904ce09d7420e919511d3f6a4173f5e..3882c6fdee197c99820e0fb6f825008d86cafb18 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
static gauge_t percents[CPU_SUBMIT_MAX] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
-int cpu_num = 0;
+int cpu_count = 0;
static _Bool report_by_cpu = 1;
static _Bool report_percent = 0;
if (cpu_num > 0) {
ssnprintf (vl.plugin_instance, sizeof (vl.plugin_instance),
- "%i", plugin_instance);
+ "%i", cpu_num);
}
plugin_dispatch_values (&vl);
}
value_t value;
value.gauge = percent;
- submit_value (cpu_num, cpu_state, "percent", value;)
+ submit_value (cpu_num, cpu_state, "percent", value);
}
static void submit_derive(int cpu_num, int cpu_state, derive_t derive)
value_t value;
value.derive = derive;
- submit_value (cpu_num, cpu_state, "cpu", value;)
+ submit_value (cpu_num, cpu_state, "cpu", value);
}
static void submit_flush (void)
for (i = 1; i < CPU_SUBMIT_MAX; i++) {
if (percents[i] == -1)
continue;
- submit_percent (-1, i, percents[i] / numcpu);
+ submit_percent (-1, i, percents[i] / cpu_count);
}
- numcpu = 0;
+ cpu_count = 0;
memset(percents, 0, sizeof(percents));
}
else
derives[CPU_SUBMIT_ACTIVE] = -1;
- numcpu++;
+ cpu_count++;
for (i = 1; i < CPU_SUBMIT_MAX; i++) {
if (derives[i] == -1) {
percents[i] = -1;
if (report_by_cpu)
{
- submit_percent (cpu_num, i, gauges[i]);
+ submit_percent (cpu_num, i, percent);
} else if (percents[i] != -1) {
percents[i] += percent;
}