projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'collectd-5.7' into collectd-5.8
[collectd.git]
/
src
/
turbostat.c
diff --git
a/src/turbostat.c
b/src/turbostat.c
index
45c8bd7
..
e4419b8
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>
@@
-266,7
+266,7
@@
open_msr(unsigned int cpu, _Bool multiple_read) {
}
}
}
}
- s
s
nprintf(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);
fd = open(pathname, O_RDONLY);
if (fd < 0) {
ERROR("turbostat plugin: failed to open %s", pathname);
@@
-556,7
+556,7
@@
static int submit_counters(struct thread_data *t, struct core_data *c,
DEBUG("turbostat plugin: submit stats for cpu: %d, core: %d, pkg: %d",
t->cpu_id, c->core_id, p->package_id);
DEBUG("turbostat plugin: submit stats for cpu: %d, core: %d, pkg: %d",
t->cpu_id, c->core_id, p->package_id);
- s
s
nprintf(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);
if (!aperf_mperf_unstable)
turbostat_submit(name, "percent", "c0", 100.0 * t->mperf / t->tsc);
@@
-567,9
+567,9
@@
static int submit_counters(struct thread_data *t, struct core_data *c,
1.0 / 1000000 * t->aperf / interval_float);
if ((!aperf_mperf_unstable) || (!(t->aperf > t->tsc || 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",
/* Sanity check (should stay stable) */
turbostat_submit(name, "gauge", "TSC",
@@
-585,7
+585,10
@@
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) {
- 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 (do_core_cstate & (1 << 3))
@@
-602,7
+605,7
@@
static int submit_counters(struct thread_data *t, struct core_data *c,
if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
goto done;
if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
goto done;
- s
s
nprintf(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);
if (do_ptm)
turbostat_submit(name, "temperature", NULL, p->pkg_temp_c);
@@
-1064,8
+1067,8
@@
static int get_threads_on_core(unsigned int cpu) {
int matches;
char character;
int matches;
char character;
- s
s
nprintf(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);
filep = fopen(path, "r");
if (!filep) {
ERROR("turbostat plugin: Failed to open '%s'", path);