projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove ProtectSystem from service file
[collectd.git]
/
src
/
cpu.c
diff --git
a/src/cpu.c
b/src/cpu.c
index
6db8629
..
e7f3c18
100644
(file)
--- a/
src/cpu.c
+++ b/
src/cpu.c
@@
-29,8
+29,8
@@
#include "collectd.h"
#include "collectd.h"
-#include "common.h"
#include "plugin.h"
#include "plugin.h"
+#include "utils/common/common.h"
#ifdef HAVE_MACH_KERN_RETURN_H
#include <mach/kern_return.h>
#ifdef HAVE_MACH_KERN_RETURN_H
#include <mach/kern_return.h>
@@
-187,12
+187,12
@@
struct cpu_state_s {
};
typedef struct cpu_state_s cpu_state_t;
};
typedef struct cpu_state_s cpu_state_t;
-static cpu_state_t *cpu_states
= NULL
;
-static size_t cpu_states_num
= 0
; /* #cpu_states allocated */
+static cpu_state_t *cpu_states;
+static size_t cpu_states_num; /* #cpu_states allocated */
/* Highest CPU number in the current iteration. Used by the dispatch logic to
* determine how many CPUs there were. Reset to 0 by cpu_reset(). */
/* Highest CPU number in the current iteration. Used by the dispatch logic to
* determine how many CPUs there were. Reset to 0 by cpu_reset(). */
-static size_t global_cpu_num
= 0
;
+static size_t global_cpu_num;
static bool report_by_cpu = true;
static bool report_by_state = true;
static bool report_by_cpu = true;
static bool report_by_state = true;
@@
-209,17
+209,17
@@
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
static int cpu_config(char const *key, char const *value) /* {{{ */
{
if (strcasecmp(key, "ReportByCpu") == 0)
static int cpu_config(char const *key, char const *value) /* {{{ */
{
if (strcasecmp(key, "ReportByCpu") == 0)
- report_by_cpu = IS_TRUE(value)
? 1 : 0
;
+ report_by_cpu = IS_TRUE(value);
else if (strcasecmp(key, "ValuesPercentage") == 0)
else if (strcasecmp(key, "ValuesPercentage") == 0)
- report_percent = IS_TRUE(value)
? 1 : 0
;
+ report_percent = IS_TRUE(value);
else if (strcasecmp(key, "ReportByState") == 0)
else if (strcasecmp(key, "ReportByState") == 0)
- report_by_state = IS_TRUE(value)
? 1 : 0
;
+ report_by_state = IS_TRUE(value);
else if (strcasecmp(key, "ReportNumCpu") == 0)
else if (strcasecmp(key, "ReportNumCpu") == 0)
- report_num_cpu = IS_TRUE(value)
? 1 : 0
;
+ report_num_cpu = IS_TRUE(value);
else if (strcasecmp(key, "ReportGuestState") == 0)
else if (strcasecmp(key, "ReportGuestState") == 0)
- report_guest = IS_TRUE(value)
? 1 : 0
;
+ report_guest = IS_TRUE(value);
else if (strcasecmp(key, "SubtractGuestState") == 0)
else if (strcasecmp(key, "SubtractGuestState") == 0)
- subtract_guest = IS_TRUE(value)
? 1 : 0
;
+ subtract_guest = IS_TRUE(value);
else
return -1;
else
return -1;
@@
-431,7
+431,7
@@
static void aggregate(gauge_t *sum_by_state) /* {{{ */
}
if (!isnan(this_cpu_states[COLLECTD_CPU_STATE_ACTIVE].rate))
}
if (!isnan(this_cpu_states[COLLECTD_CPU_STATE_ACTIVE].rate))
- this_cpu_states[COLLECTD_CPU_STATE_ACTIVE].has_value =
1
;
+ this_cpu_states[COLLECTD_CPU_STATE_ACTIVE].has_value =
true
;
RATE_ADD(sum_by_state[COLLECTD_CPU_STATE_ACTIVE],
this_cpu_states[COLLECTD_CPU_STATE_ACTIVE].rate);
RATE_ADD(sum_by_state[COLLECTD_CPU_STATE_ACTIVE],
this_cpu_states[COLLECTD_CPU_STATE_ACTIVE].rate);
@@
-505,7
+505,7
@@
static void cpu_commit_num_cpu(gauge_t value) /* {{{ */
static void cpu_reset(void) /* {{{ */
{
for (size_t i = 0; i < cpu_states_num; i++)
static void cpu_reset(void) /* {{{ */
{
for (size_t i = 0; i < cpu_states_num; i++)
- cpu_states[i].has_value =
0
;
+ cpu_states[i].has_value =
false
;
global_cpu_num = 0;
} /* }}} void cpu_reset */
global_cpu_num = 0;
} /* }}} void cpu_reset */
@@
-588,7
+588,7
@@
static int cpu_stage(size_t cpu_num, size_t state, derive_t d,
return status;
s->rate = rate;
return status;
s->rate = rate;
- s->has_value =
1
;
+ s->has_value =
true
;
return 0;
} /* }}} int cpu_stage */
return 0;
} /* }}} int cpu_stage */