projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
turbostat plugin: free the right variable
[collectd.git]
/
src
/
turbostat.c
diff --git
a/src/turbostat.c
b/src/turbostat.c
index
1049fb2
..
f388515
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>
@@
-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))
@@
-1284,15
+1288,15
@@
static int allocate_counters(struct thread_data **threads,
*cores = calloc(total_cores, sizeof(struct core_data));
if (*cores == NULL) {
ERROR("turbostat plugin: calloc failed");
*cores = calloc(total_cores, sizeof(struct core_data));
if (*cores == NULL) {
ERROR("turbostat plugin: calloc failed");
- sfree(threads);
+ sfree(
*
threads);
return -1;
}
*packages = calloc(topology.num_packages, sizeof(struct pkg_data));
if (*packages == NULL) {
ERROR("turbostat plugin: calloc failed");
return -1;
}
*packages = calloc(topology.num_packages, sizeof(struct pkg_data));
if (*packages == NULL) {
ERROR("turbostat plugin: calloc failed");
- sfree(cores);
- sfree(threads);
+ sfree(
*
cores);
+ sfree(
*
threads);
return -1;
}
return -1;
}