]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
intel_pmu 2.0 - change parameter name to AggregateUncorePMUs
authorKamil Wiatrowski <kamilx.wiatrowski@intel.com>
Mon, 12 Oct 2020 13:58:31 +0000 (14:58 +0100)
committerKamil Wiatrowski <kamilx.wiatrowski@intel.com>
Tue, 5 Oct 2021 11:11:47 +0000 (11:11 +0000)
Change plugin parameter name from DispatchMultiPmu to AggregateUncorePMUs

Change-Id: I0303da83bef6cbae69f0cf327dc990dc5db22c52
Signed-off-by: Kamil Wiatrowski <kamilx.wiatrowski@intel.com>
src/collectd.conf.in
src/collectd.conf.pod
src/intel_pmu.c

index 19dab27087b046d85f3d02a6bafb23136f224a25..a30346dd53778276946509b7e998ef3ae932a33b 100644 (file)
 #    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
 #</Plugin>
 
 #<Plugin "intel_rdt">
index a7461becce8a6eaf35bb901aac5d8acc72f9843b..a479c6a2eed109a3f1534417e9f95a122757edfe 100644 (file)
@@ -3891,7 +3891,7 @@ B<Synopsis:>
     Cores "0-3" "4,6" "[12-15]"
     HardwareEvents "L2_RQSTS.PF_MISS"
     Cores "[1,2]"
-    DispatchMultiPmu true
+    AggregateUncorePMUs true
   </Plugin>
 
 B<Options:>
@@ -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<HardwareEvents> set.
 
-=item B<DispatchMultiPmu> B<false>|B<true>
+=item B<AggregateUncorePMUs> B<false>|B<true>
 
 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<AggregateUncorePMUs> 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<plugin_instance>.
+summing all counters across all the units (e.g. CHAs). If B<AggregateUncorePMUs>
+is set to 'false' all cloned PMUs are dispatched separately with PMU name added
+to Collectd's I<plugin_instance>.
 
 =back
 
index a592f255a1a1f531dafa0ce5b2958e1966b0a328..9f04f52a7970edfb2841376c3e8d436abc7f03f4 100644 (file)
@@ -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++;
     }