projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gRPC plugin: Add Florian to copyright holders.
[collectd.git]
/
src
/
xencpu.c
diff --git
a/src/xencpu.c
b/src/xencpu.c
index
2b87235
..
93575df
100644
(file)
--- a/
src/xencpu.c
+++ b/
src/xencpu.c
@@
-20,6
+20,7
@@
**/
#include "collectd.h"
**/
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
#include "common.h"
#include "plugin.h"
@@
-53,7
+54,7
@@
static int xencpu_init (void)
{
ERROR ("xencpu: xc_interface_open() failed");
return (-1);
{
ERROR ("xencpu: xc_interface_open() failed");
return (-1);
- }
;
+ }
xc_physinfo_t *physinfo;
xc_physinfo_t *physinfo;
@@
-71,7
+72,7
@@
static int xencpu_init (void)
xc_interface_close(xc_handle);
free(physinfo);
return (-1);
xc_interface_close(xc_handle);
free(physinfo);
return (-1);
- }
;
+ }
num_cpus = physinfo->nr_cpus;
free(physinfo);
num_cpus = physinfo->nr_cpus;
free(physinfo);
@@
-107,14
+108,11
@@
static int xencpu_shutdown (void)
return 0;
} /* static int xencpu_shutdown */
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;
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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
@@
-141,12
+139,13
@@
static int xencpu_read (void)
return (-1);
}
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;
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);
}
if (status == 0) {
submit_value(cpu, 100 - rate/10000000);
}