projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Replace zu with PRIu64 and llu with new macro, PRIsz, which will make it easier to...
[collectd.git]
/
src
/
intel_pmu.c
diff --git
a/src/intel_pmu.c
b/src/intel_pmu.c
index
a964a5f
..
957004d
100644
(file)
--- a/
src/intel_pmu.c
+++ b/
src/intel_pmu.c
@@
-192,7
+192,8
@@
static void pmu_dump_config(void) {
DEBUG(PMU_PLUGIN ": software_events : %d", g_ctx.sw_events);
for (size_t i = 0; i < g_ctx.hw_events_count; i++) {
DEBUG(PMU_PLUGIN ": software_events : %d", g_ctx.sw_events);
for (size_t i = 0; i < g_ctx.hw_events_count; i++) {
- DEBUG(PMU_PLUGIN ": hardware_events[%zu]: %s", i, g_ctx.hw_events[i]);
+ DEBUG(PMU_PLUGIN ": hardware_events[%" PRIsz "]: %s", i,
+ g_ctx.hw_events[i]);
}
}
}
}
@@
-285,24
+286,24
@@
static void pmu_submit_counter(int cpu, char *event, counter_t value,
plugin_dispatch_values(&vl);
}
plugin_dispatch_values(&vl);
}
-meta_data_t *pmu_
event_get_meta(struct event *e, int cpu
) {
+meta_data_t *pmu_
meta_data_create(const struct efd *efd
) {
meta_data_t *meta = NULL;
/* create meta data only if value was scaled */
meta_data_t *meta = NULL;
/* create meta data only if value was scaled */
- if (e->efd[cpu].val[1] != e->efd[cpu].val[2] && e->efd[cpu].val[2]) {
- meta = meta_data_create();
- if (meta == NULL) {
- ERROR(PMU_PLUGIN ": meta_data_create failed.");
- return NULL;
- }
+ if (efd->val[1] == efd->val[2] || !efd->val[2]) {
+ return NULL;
+ }
- meta_data_add_unsigned_int(meta, "intel_pmu:raw_count", e->efd[cpu].val[0]);
- meta_data_add_unsigned_int(meta, "intel_pmu:time_enabled",
- e->efd[cpu].val[1]);
- meta_data_add_unsigned_int(meta, "intel_pmu:time_running",
- e->efd[cpu].val[2]);
+ meta = meta_data_create();
+ if (meta == NULL) {
+ ERROR(PMU_PLUGIN ": meta_data_create failed.");
+ return NULL;
}
}
+ meta_data_add_unsigned_int(meta, "intel_pmu:raw_count", efd->val[0]);
+ meta_data_add_unsigned_int(meta, "intel_pmu:time_enabled", efd->val[1]);
+ meta_data_add_unsigned_int(meta, "intel_pmu:time_running", efd->val[2]);
+
return meta;
}
return meta;
}
@@
-329,15
+330,12
@@
static void pmu_dispatch_data(void) {
all_value += value;
/* get meta data with information about scaling */
all_value += value;
/* get meta data with information about scaling */
- meta_data_t *meta = pmu_
event_get_meta(e, i
);
+ meta_data_t *meta = pmu_
meta_data_create(&e->efd[i]
);
/* dispatch per CPU value */
pmu_submit_counter(i, e->event, value, meta);
/* dispatch per CPU value */
pmu_submit_counter(i, e->event, value, meta);
- if (meta) {
- meta_data_destroy(meta);
- meta = NULL;
- }
+ meta_data_destroy(meta);
}
if (event_enabled > 0) {
}
if (event_enabled > 0) {