]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
cpu plugin: Apply code review suggestions.
authorFlorian Forster <octo@collectd.org>
Fri, 19 Jan 2024 20:01:21 +0000 (21:01 +0100)
committerFlorian Forster <octo@collectd.org>
Mon, 22 Jan 2024 15:07:57 +0000 (16:07 +0100)
Co-authored-by: Eero Tamminen <eero.t.tamminen@intel.com>
src/collectd.conf.pod
src/cpu.c

index d0956097b1f730ed09a9976273a3b53afa704ef8..0de74a2917726260a12c64ef575963d02d4f03b6 100644 (file)
@@ -1790,7 +1790,7 @@ Sets whether CPU usage (in jiffies/seconds) is reported. Defaults to B<true>.
 
 =item B<ReportUtilization> B<true>|B<false>
 
-Sets whether CPU utilization (a ratio) is reported. Defaults to B<true>.
+Sets whether CPU utilization ratio is reported. Defaults to B<true>.
 
 When enabled, the B<ReportByState> and B<ReportByCpu> options can be used to
 report aggregated data.
index f25d80b6d62b7f5ba64786493c52882495fd3987..4c40dd6a81b80ce3a9e1db41a5aeb07d8e879a7f 100644 (file)
--- 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;