projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
No need to initialize static bools to false
[collectd.git]
/
src
/
turbostat.c
diff --git
a/src/turbostat.c
b/src/turbostat.c
index
1049fb2
..
89bf3cb
100644
(file)
--- a/
src/turbostat.c
+++ b/
src/turbostat.c
@@
-41,7
+41,7
@@
#include "plugin.h"
#include "utils_time.h"
#include "plugin.h"
#include "utils_time.h"
-#include
<asm/msr-index.h>
+#include
"msr-index.h"
#include <cpuid.h>
#ifdef HAVE_SYS_CAPABILITY_H
#include <sys/capability.h>
#include <cpuid.h>
#ifdef HAVE_SYS_CAPABILITY_H
#include <sys/capability.h>
@@
-65,12
+65,12
@@
*
* This value is automatically set if mperf or aperf go backward
*/
*
* This value is automatically set if mperf or aperf go backward
*/
-static
_B
ool aperf_mperf_unstable;
+static
b
ool aperf_mperf_unstable;
/*
* If set, use kernel logical core numbering for all "per core" metrics.
*/
/*
* If set, use kernel logical core numbering for all "per core" metrics.
*/
-static
_B
ool config_lcn;
+static
b
ool config_lcn;
/*
* Bitmask of the list of core C states supported by the processor.
/*
* Bitmask of the list of core C states supported by the processor.
@@
-78,7
+78,7
@@
static _Bool config_lcn;
*/
static unsigned int do_core_cstate;
static unsigned int config_core_cstate;
*/
static unsigned int do_core_cstate;
static unsigned int config_core_cstate;
-static
_B
ool apply_config_core_cstate;
+static
b
ool apply_config_core_cstate;
/*
* Bitmask of the list of pacages C states supported by the processor.
/*
* Bitmask of the list of pacages C states supported by the processor.
@@
-86,15
+86,15
@@
static _Bool apply_config_core_cstate;
*/
static unsigned int do_pkg_cstate;
static unsigned int config_pkg_cstate;
*/
static unsigned int do_pkg_cstate;
static unsigned int config_pkg_cstate;
-static
_B
ool apply_config_pkg_cstate;
+static
b
ool apply_config_pkg_cstate;
/*
* Boolean indicating if the processor supports 'I/O System-Management Interrupt
* counter'
*/
/*
* Boolean indicating if the processor supports 'I/O System-Management Interrupt
* counter'
*/
-static
_B
ool do_smi;
-static
_B
ool config_smi;
-static
_B
ool apply_config_smi;
+static
b
ool do_smi;
+static
b
ool config_smi;
+static
b
ool apply_config_smi;
/*
* Boolean indicating if the processor supports 'Digital temperature sensor'
/*
* Boolean indicating if the processor supports 'Digital temperature sensor'
@@
-105,9
+105,9
@@
static _Bool apply_config_smi;
* might be wrong
* - Temperatures above the tcc_activation_temp are not recorded
*/
* might be wrong
* - Temperatures above the tcc_activation_temp are not recorded
*/
-static
_B
ool do_dts;
-static
_B
ool config_dts;
-static
_B
ool apply_config_dts;
+static
b
ool do_dts;
+static
b
ool config_dts;
+static
b
ool apply_config_dts;
/*
* Boolean indicating if the processor supports 'Package thermal management'
/*
* Boolean indicating if the processor supports 'Package thermal management'
@@
-118,9
+118,9
@@
static _Bool apply_config_dts;
* might be wrong
* - Temperatures above the tcc_activation_temp are not recorded
*/
* might be wrong
* - Temperatures above the tcc_activation_temp are not recorded
*/
-static
_B
ool do_ptm;
-static
_B
ool config_ptm;
-static
_B
ool apply_config_ptm;
+static
b
ool do_ptm;
+static
b
ool config_ptm;
+static
b
ool apply_config_ptm;
/*
* Thermal Control Circuit Activation Temperature as configured by the user.
/*
* Thermal Control Circuit Activation Temperature as configured by the user.
@@
-131,7
+131,7
@@
static unsigned int tcc_activation_temp;
static unsigned int do_rapl;
static unsigned int config_rapl;
static unsigned int do_rapl;
static unsigned int config_rapl;
-static
_B
ool apply_config_rapl;
+static
b
ool apply_config_rapl;
static double rapl_energy_units;
#define RAPL_PKG (1 << 0)
static double rapl_energy_units;
#define RAPL_PKG (1 << 0)
@@
-195,10
+195,10
@@
static struct pkg_data {
#define DELTA_COUNTERS thread_delta, core_delta, package_delta
#define ODD_COUNTERS thread_odd, core_odd, package_odd
#define EVEN_COUNTERS thread_even, core_even, package_even
#define DELTA_COUNTERS thread_delta, core_delta, package_delta
#define ODD_COUNTERS thread_odd, core_odd, package_odd
#define EVEN_COUNTERS thread_even, core_even, package_even
-static
_B
ool is_even = 1;
+static
b
ool is_even = 1;
-static
_Bool allocated = 0
;
-static
_Bool initialized = 0
;
+static
bool allocated
;
+static
bool initialized
;
#define GET_THREAD(thread_base, thread_no, core_no, pkg_no) \
(thread_base + (pkg_no)*topology.num_cores * topology.num_threads + \
#define GET_THREAD(thread_base, thread_no, core_no, pkg_no) \
(thread_base + (pkg_no)*topology.num_cores * topology.num_threads + \
@@
-210,8
+210,8
@@
static _Bool initialized = 0;
struct cpu_topology {
unsigned int package_id;
unsigned int core_id;
struct cpu_topology {
unsigned int package_id;
unsigned int core_id;
-
_B
ool first_core_in_package;
-
_B
ool first_thread_in_core;
+
b
ool first_core_in_package;
+
b
ool first_thread_in_core;
};
static struct topology {
};
static struct topology {
@@
-246,7
+246,7
@@
static const int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
* 1
*/
static int __attribute__((warn_unused_result))
* 1
*/
static int __attribute__((warn_unused_result))
-open_msr(unsigned int cpu,
_B
ool multiple_read) {
+open_msr(unsigned int cpu,
b
ool multiple_read) {
char pathname[32];
int fd;
char pathname[32];
int fd;
@@
-585,7
+585,11
@@
static int submit_counters(struct thread_data *t, struct core_data *c,
/* If not using logical core numbering, set core id */
if (!config_lcn) {
/* If not using logical core numbering, set core id */
if (!config_lcn) {
- snprintf(name, sizeof(name), "core%02d", c->core_id);
+ if (topology.num_packages > 1)
+ snprintf(name, sizeof(name), "pkg%02d-core%02d", p->package_id,
+ c->core_id);
+ else
+ snprintf(name, sizeof(name), "core%02d", c->core_id);
}
if (do_core_cstate & (1 << 3))
}
if (do_core_cstate & (1 << 3))
@@
-974,6
+978,7
@@
static int __attribute__((warn_unused_result)) probe_cpu(void) {
case 0x45: /* HSW */
case 0x46: /* HSW */
case 0x3D: /* BDW */
case 0x45: /* HSW */
case 0x46: /* HSW */
case 0x3D: /* BDW */
+ case 0x5E: /* SKL */
do_rapl = RAPL_PKG | RAPL_CORES | RAPL_GFX;
break;
case 0x3F: /* HSX */
do_rapl = RAPL_PKG | RAPL_CORES | RAPL_GFX;
break;
case 0x3F: /* HSX */