#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>
*
* This value is automatically set if mperf or aperf go backward
*/
-static _Bool aperf_mperf_unstable;
+static bool aperf_mperf_unstable;
/*
* If set, use kernel logical core numbering for all "per core" metrics.
*/
-static _Bool config_lcn;
+static bool config_lcn;
/*
* Bitmask of the list of core C states supported by the processor.
*/
static unsigned int do_core_cstate;
static unsigned int config_core_cstate;
-static _Bool apply_config_core_cstate;
+static bool apply_config_core_cstate;
/*
* Bitmask of the list of pacages C states supported by the processor.
*/
static unsigned int do_pkg_cstate;
static unsigned int config_pkg_cstate;
-static _Bool apply_config_pkg_cstate;
+static bool apply_config_pkg_cstate;
/*
* Boolean indicating if the processor supports 'I/O System-Management Interrupt
* counter'
*/
-static _Bool do_smi;
-static _Bool config_smi;
-static _Bool apply_config_smi;
+static bool do_smi;
+static bool config_smi;
+static bool apply_config_smi;
/*
* Boolean indicating if the processor supports 'Digital temperature sensor'
* might be wrong
* - Temperatures above the tcc_activation_temp are not recorded
*/
-static _Bool do_dts;
-static _Bool config_dts;
-static _Bool apply_config_dts;
+static bool do_dts;
+static bool config_dts;
+static bool apply_config_dts;
/*
* Boolean indicating if the processor supports 'Package thermal management'
* might be wrong
* - Temperatures above the tcc_activation_temp are not recorded
*/
-static _Bool do_ptm;
-static _Bool config_ptm;
-static _Bool apply_config_ptm;
+static bool do_ptm;
+static bool config_ptm;
+static bool apply_config_ptm;
/*
* Thermal Control Circuit Activation Temperature as configured by the user.
static unsigned int do_rapl;
static unsigned int config_rapl;
-static _Bool apply_config_rapl;
+static bool apply_config_rapl;
static double rapl_energy_units;
#define RAPL_PKG (1 << 0)
#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 _Bool is_even = 1;
+static bool is_even = 1;
-static _Bool allocated = 0;
-static _Bool initialized = 0;
+static bool allocated = 0;
+static bool initialized = 0;
#define GET_THREAD(thread_base, thread_no, core_no, pkg_no) \
(thread_base + (pkg_no)*topology.num_cores * topology.num_threads + \
struct cpu_topology {
unsigned int package_id;
unsigned int core_id;
- _Bool first_core_in_package;
- _Bool first_thread_in_core;
+ bool first_core_in_package;
+ bool first_thread_in_core;
};
static struct topology {
* 1
*/
static int __attribute__((warn_unused_result))
-open_msr(unsigned int cpu, _Bool multiple_read) {
+open_msr(unsigned int cpu, bool multiple_read) {
char pathname[32];
int fd;
/* 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))
case 0x45: /* HSW */
case 0x46: /* HSW */
case 0x3D: /* BDW */
+ case 0x5E: /* SKL */
do_rapl = RAPL_PKG | RAPL_CORES | RAPL_GFX;
break;
case 0x3F: /* HSX */