X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fxencpu.c;h=93575df22887ff9e3935f9ee741654918079807b;hb=3e36ac34460b6be8388ac376ab7a4e2e990870ec;hp=59fbcb982d70bbd7b9668b44adffeef8abe564fd;hpb=063a5e75b36173e89ffa18d32d47509f6ef968ec;p=collectd.git diff --git a/src/xencpu.c b/src/xencpu.c index 59fbcb98..93575df2 100644 --- a/src/xencpu.c +++ b/src/xencpu.c @@ -108,14 +108,11 @@ static int xencpu_shutdown (void) return 0; } /* static int xencpu_shutdown */ -static void submit_value (int cpu_num, gauge_t percent) +static void submit_value (int cpu_num, gauge_t value) { - value_t values[1]; value_list_t vl = VALUE_LIST_INIT; - values[0].gauge = percent; - - vl.values = values; + vl.values = &(value_t) { .gauge = value }; vl.values_len = 1; sstrncpy (vl.host, hostname_g, sizeof (vl.host)); @@ -142,12 +139,13 @@ static int xencpu_read (void) return (-1); } - int cpu, status; - for (cpu = 0; cpu < nr_cpus; cpu++) { + int status; + for (int cpu = 0; cpu < nr_cpus; cpu++) { gauge_t rate = NAN; - value_t value = {.derive = cpu_info[cpu].idletime}; - status = value_to_rate (&rate, value, DS_TYPE_DERIVE, now, &cpu_states[cpu]); + status = value_to_rate (&rate, + (value_t) { .derive = cpu_info[cpu].idletime }, DS_TYPE_DERIVE, + now, &cpu_states[cpu]); if (status == 0) { submit_value(cpu, 100 - rate/10000000); }