From: Florian Forster Date: Fri, 19 Jan 2024 20:01:21 +0000 (+0100) Subject: cpu plugin: Apply code review suggestions. X-Git-Tag: 6.0.0-rc0~5^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb041043a6ec30a284d140ef9cae1d1e51965889;p=thirdparty%2Fcollectd.git cpu plugin: Apply code review suggestions. Co-authored-by: Eero Tamminen --- diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index d0956097b..0de74a291 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -1790,7 +1790,7 @@ Sets whether CPU usage (in jiffies/seconds) is reported. Defaults to B. =item B B|B -Sets whether CPU utilization (a ratio) is reported. Defaults to B. +Sets whether CPU utilization ratio is reported. Defaults to B. When enabled, the B and B options can be used to report aggregated data. diff --git a/src/cpu.c b/src/cpu.c index f25d80b6d..4c40dd6a8 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -428,6 +428,8 @@ static void usage_finalize(usage_t *u) { size_t cpu_num = u->states_num / STATE_MAX; gauge_t state_ratio[STATE_MAX] = {0}; + // Aggregate non-idle CPU states to STATE_ACTIVE and all CPUs' states to + // global states. for (size_t cpu = 0; cpu < cpu_num; cpu++) { size_t active_index = (cpu * STATE_MAX) + STATE_ACTIVE; usage_state_t *active = u->states + active_index;