#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>
}
}
- ssnprintf(pathname, sizeof(pathname), "/dev/cpu/%d/msr", cpu);
+ snprintf(pathname, sizeof(pathname), "/dev/cpu/%d/msr", cpu);
fd = open(pathname, O_RDONLY);
if (fd < 0) {
ERROR("turbostat plugin: failed to open %s", pathname);
DEBUG("turbostat plugin: submit stats for cpu: %d, core: %d, pkg: %d",
t->cpu_id, c->core_id, p->package_id);
- ssnprintf(name, sizeof(name), "cpu%02d", t->cpu_id);
+ snprintf(name, sizeof(name), "cpu%02d", t->cpu_id);
if (!aperf_mperf_unstable)
turbostat_submit(name, "percent", "c0", 100.0 * t->mperf / t->tsc);
1.0 / 1000000 * t->aperf / interval_float);
if ((!aperf_mperf_unstable) || (!(t->aperf > t->tsc || t->mperf > t->tsc)))
- turbostat_submit(name, "frequency", "busy", 1.0 * t->tsc / 1000000 *
- t->aperf / t->mperf /
- interval_float);
+ turbostat_submit(name, "frequency", "busy",
+ 1.0 * t->tsc / 1000000 * t->aperf / t->mperf /
+ interval_float);
/* Sanity check (should stay stable) */
turbostat_submit(name, "gauge", "TSC",
/* If not using logical core numbering, set core id */
if (!config_lcn) {
- ssnprintf(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 (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
goto done;
- ssnprintf(name, sizeof(name), "pkg%02d", p->package_id);
+ snprintf(name, sizeof(name), "pkg%02d", p->package_id);
if (do_ptm)
turbostat_submit(name, "temperature", NULL, p->pkg_temp_c);
case 0x45: /* HSW */
case 0x46: /* HSW */
case 0x3D: /* BDW */
+ case 0x5E: /* SKL */
do_rapl = RAPL_PKG | RAPL_CORES | RAPL_GFX;
break;
case 0x3F: /* HSX */
int matches;
char character;
- ssnprintf(path, sizeof(path),
- "/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", cpu);
+ snprintf(path, sizeof(path),
+ "/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", cpu);
filep = fopen(path, "r");
if (!filep) {
ERROR("turbostat plugin: Failed to open '%s'", path);
retval = func(cpu_num);
if (retval) {
fclose(fp);
- return (retval);
+ return retval;
}
}
fclose(fp);