From 549a22a8009ba82cf57aa70d1f3889a35a820042 Mon Sep 17 00:00:00 2001 From: Kamil Wiatrowski Date: Mon, 12 Oct 2020 14:58:31 +0100 Subject: [PATCH] intel_pmu 2.0 - change parameter name to AggregateUncorePMUs Change plugin parameter name from DispatchMultiPmu to AggregateUncorePMUs Change-Id: I0303da83bef6cbae69f0cf327dc990dc5db22c52 Signed-off-by: Kamil Wiatrowski --- src/collectd.conf.in | 2 +- src/collectd.conf.pod | 12 ++++++------ src/intel_pmu.c | 21 +++++++++++++-------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/collectd.conf.in b/src/collectd.conf.in index 19dab2708..a30346dd5 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -831,7 +831,7 @@ # EventList "/var/cache/pmu/GenuineIntel-6-2D-core.json" # HardwareEvents "L2_RQSTS.CODE_RD_HIT,L2_RQSTS.CODE_RD_MISS" "L2_RQSTS.ALL_CODE_RD" # Cores "[0-3]" -# DispatchMultiPmu true +# AggregateUncorePMUs true # # diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index a7461becc..a479c6a2e 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -3891,7 +3891,7 @@ B Cores "0-3" "4,6" "[12-15]" HardwareEvents "L2_RQSTS.PF_MISS" Cores "[1,2]" - DispatchMultiPmu true + AggregateUncorePMUs true B @@ -3930,15 +3930,15 @@ If an empty string is provided as value for this field default cores configuration is applied - that is separate group is created for each core. This option can be used once for every B set. -=item B B|B +=item B B|B This option toggles the event value reporting from all the uncore PMUs to either dispatch as aggregated value in a single metric or dispatch as -individual values. If DispatchMultiPmu is set to 'false' uncore events are +individual values. If B is set to 'true' uncore events are reported as single metric, even for multi PMU. The total value is obtained by -summing all counters across all the units (e.g. CHAs). If DispatchMultiPmu is -set to 'true' all cloned PMUs are dispatched separately with PMU name added to -Collectd's I. +summing all counters across all the units (e.g. CHAs). If B +is set to 'false' all cloned PMUs are dispatched separately with PMU name added +to Collectd's I. =back diff --git a/src/intel_pmu.c b/src/intel_pmu.c index a592f255a..9f04f52a7 100644 --- a/src/intel_pmu.c +++ b/src/intel_pmu.c @@ -89,7 +89,7 @@ static void pmu_dump_events(intel_pmu_entity_t *ent) { static void pmu_dump_config(void) { DEBUG(PMU_PLUGIN ": Config:"); - DEBUG(PMU_PLUGIN ": dispatch_cloned_pmus: %d", g_ctx.dispatch_cloned_pmus); + DEBUG(PMU_PLUGIN ": AggregateUncorePMUs : %d", !g_ctx.dispatch_cloned_pmus); DEBUG(PMU_PLUGIN ": event list file : %s", g_ctx.event_list_fn); unsigned int i = 0; @@ -246,8 +246,11 @@ static int pmu_config(oconfig_item_t *ci) { } else { ret = config_cores_parse(child, &g_ctx.entl->cores); } - } else if (strcasecmp("DispatchMultiPmu", child->key) == 0) { - ret = cf_util_get_boolean(child, &g_ctx.dispatch_cloned_pmus); + } else if (strcasecmp("AggregateUncorePMUs", child->key) == 0) { + bool aggregate = true; + ret = cf_util_get_boolean(child, &aggregate); + if (ret == 0) + g_ctx.dispatch_cloned_pmus = !aggregate; } else { ERROR(PMU_PLUGIN ": Unknown configuration parameter \"%s\".", child->key); ret = -1; @@ -305,7 +308,7 @@ static char *pmu_get_name(const struct event *e, const uint32_t *type) { char type_path[PATH_MAX]; char buf[16]; ssize_t len; - uint32_t val = 0; + unsigned int val = 0; ssnprintf(type_path, sizeof(type_path), "%s/type", ce->extra.pmus.gl_pathv[i]); int fd = open(type_path, O_RDONLY); @@ -322,7 +325,7 @@ static char *pmu_get_name(const struct event *e, const uint32_t *type) { } buf[len] = '\0'; - if (sscanf(buf, "%d", &val) != 1) { + if (sscanf(buf, "%u", &val) != 1) { WARNING(PMU_PLUGIN ": failed to read number from `%s`.", buf); close(fd); continue; @@ -507,7 +510,7 @@ static int pmu_add_hw_events(struct eventlist *el, char **e, size_t count) { size_t group_events_count = 0; char *events = strdup(e[i]); - if (!events) + if (events == NULL) return -1; bool group = strrchr(events, ',') != NULL ? true : false; @@ -527,7 +530,7 @@ static int pmu_add_hw_events(struct eventlist *el, char **e, size_t count) { e->efd[j].fd = -1; if (resolve_event_extra(s, &e->attr, &e->extra) != 0) { - WARNING(PMU_PLUGIN ": Cannot resolve %s", s); + INFO(PMU_PLUGIN ": Cannot resolve %s", s); sfree(e); continue; } @@ -559,8 +562,10 @@ static int pmu_add_hw_events(struct eventlist *el, char **e, size_t count) { el->eventlist_last = e; e->event = strdup(s); - if (e->extra.multi_pmu && pmu_add_cloned_pmus(el, e) != 0) + if (e->extra.multi_pmu && pmu_add_cloned_pmus(el, e) != 0) { + sfree(events); return -1; + } group_events_count++; } -- 2.47.2