/* 0x642 MSR_PP1_POLICY */
#define TJMAX_DEFAULT 100
-cpu_set_t *cpu_present_set, *cpu_affinity_set, *cpu_saved_affinity_set;
-size_t cpu_present_setsize, cpu_affinity_setsize, cpu_saved_affinity_setsize;
+static cpu_set_t *cpu_present_set, *cpu_affinity_set, *cpu_saved_affinity_set;
+static size_t cpu_present_setsize, cpu_affinity_setsize, cpu_saved_affinity_setsize;
-struct thread_data {
+static struct thread_data {
unsigned long long tsc;
unsigned long long aperf;
unsigned long long mperf;
#define CPU_IS_FIRST_CORE_IN_PACKAGE 0x4
} *thread_delta, *thread_even, *thread_odd;
-struct core_data {
+static struct core_data {
unsigned long long c3;
unsigned long long c6;
unsigned long long c7;
unsigned int core_id;
} *core_delta, *core_even, *core_odd;
-struct pkg_data {
+static struct pkg_data {
unsigned long long pc2;
unsigned long long pc3;
unsigned long long pc6;
_Bool first_thread_in_core;
};
-struct topology {
+static struct topology {
int max_cpu_id;
int num_packages;
int num_cores;
struct cpu_topology *cpus;
} topology;
-cdtime_t time_even, time_odd, time_delta;
+static cdtime_t time_even, time_odd, time_delta;
static const char *config_keys[] =
{
struct stat sb;
int ret;
+ if (stat("/dev/cpu/0/msr", &sb)) {
+ ERROR("Turbostat plugin: Initialization failed: /dev/cpu/0/msr"
+ " does not exist while the CPU supports MSR. You may be "
+ "missing the corresponding kernel module, please try '# "
+ "modprobe msr'");
+ return -1;
+ }
+
if (getuid() != 0) {
ERROR("Turbostat plugin: Initialization failed: this plugin "
"requires collectd to run as root in order to read "
DO_OR_GOTO_ERR(probe_cpu());
- if (stat("/dev/cpu/0/msr", &sb)) {
- ERROR("Turbostat plugin: Initialization failed: /dev/cpu/0/msr"
- " does not exist while the CPU supports MSR. You may be "
- "missing the corresponding kernel module, please try '# "
- "modprobe msr'");
- return -1;
- }
-
DO_OR_GOTO_ERR(setup_all_buffers());
plugin_register_read(PLUGIN_NAME, turbostat_read);