]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
intel_pmu 2.0 - remove type from type instance
authorKamil Wiatrowski <kamilx.wiatrowski@intel.com>
Fri, 4 Sep 2020 13:45:46 +0000 (14:45 +0100)
committerKamil Wiatrowski <kamilx.wiatrowski@intel.com>
Tue, 5 Oct 2021 11:11:47 +0000 (11:11 +0000)
Remove type from type_instance for uncore events.

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

index c2e1c42f467e12a2129dd87ee7c587676326efab..a7461becce8a6eaf35bb901aac5d8acc72f9843b 100644 (file)
@@ -3937,8 +3937,8 @@ either dispatch as aggregated value in a single metric or dispatch as
 individual values. If DispatchMultiPmu is set to 'false' 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 'type' value of
-PMU added to Collectd's I<type_instance>.
+set to 'true' all cloned PMUs are dispatched separately with PMU name added to
+Collectd's I<plugin_instance>.
 
 =back
 
index 00358d9afd35c4b2d9e2d8a967e2f0e3d67fcbe7..a592f255a1a1f531dafa0ce5b2958e1966b0a328 100644 (file)
@@ -225,7 +225,7 @@ static int pmu_config(oconfig_item_t *ci) {
       ret = cf_util_get_string_buffer(child, g_ctx.event_list_fn,
                                       sizeof(g_ctx.event_list_fn));
     } else if (strcasecmp("HardwareEvents", child->key) == 0) {
-      intel_pmu_entity_t *ent = calloc(1, sizeof(*g_ctx.entl));
+      intel_pmu_entity_t *ent = calloc(1, sizeof(*ent));
       if (ent == NULL) {
         ERROR(PMU_PLUGIN ": Failed to allocate pmu ent.");
         ret = -ENOMEM;
@@ -267,8 +267,7 @@ static int pmu_config(oconfig_item_t *ci) {
 }
 
 static void pmu_submit_counters(const char *cgroup, const char *event,
-                                const char *pmu_name,
-                                const uint32_t *event_type, bool multi_pmu,
+                                const char *pmu_name, bool multi_pmu,
                                 counter_t scaled, counter_t raw,
                                 counter_t enabled, counter_t running) {
   value_list_t vl = VALUE_LIST_INIT;
@@ -286,14 +285,9 @@ static void pmu_submit_counters(const char *cgroup, const char *event,
               pmu_name);
   else
     sstrncpy(vl.plugin_instance, cgroup, sizeof(vl.plugin_instance));
+
   sstrncpy(vl.type, "pmu_counter", sizeof(vl.type));
-  if (event_type)
-    ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%s:type=%d", event,
-              *event_type);
-  else if (multi_pmu)
-    ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%s:total", event);
-  else
-    sstrncpy(vl.type_instance, event, sizeof(vl.type_instance));
+  sstrncpy(vl.type_instance, event, sizeof(vl.type_instance));
 
   DEBUG(PMU_PLUGIN ": %s/%s = %llu (%llu * %llu / %llu)", vl.type_instance,
         vl.plugin_instance, scaled, raw, enabled, running);
@@ -417,7 +411,7 @@ static void pmu_dispatch_data(intel_pmu_entity_t *ent) {
 
       if (event_enabled_cgroup > 0)
         /* dispatch per core group values */
-        pmu_submit_counters(cgroup->desc, e->event, pmu_name, event_type,
+        pmu_submit_counters(cgroup->desc, e->event, pmu_name,
                             e->extra.multi_pmu, cgroup_value, cgroup_value_raw,
                             cgroup_time_enabled, cgroup_time_running);
     }
@@ -652,7 +646,7 @@ static int pmu_split_cores(intel_pmu_entity_t *ent) {
   intel_pmu_entity_t *prev = ent;
   for (size_t i = CGROUPS_PER_ENT; i < ent->cores.num_cgroups;
        i += CGROUPS_PER_ENT) {
-    intel_pmu_entity_t *entc = calloc(1, sizeof(*g_ctx.entl));
+    intel_pmu_entity_t *entc = calloc(1, sizeof(*entc));
     if (entc == NULL) {
       ERROR(PMU_PLUGIN ": pmu_split_cores: Failed to allocate pmu ent.");
       return -ENOMEM;
@@ -887,7 +881,7 @@ static int pmu_shutdown(void) {
 }
 
 void module_register(void) {
-  plugin_register_init(PMU_PLUGIN, pmu_init);
   plugin_register_complex_config(PMU_PLUGIN, pmu_config);
+  plugin_register_init(PMU_PLUGIN, pmu_init);
   plugin_register_shutdown(PMU_PLUGIN, pmu_shutdown);
 }
index e5d696e0baa1b72a583b50b6849fc5806c9d1efd..c1a953b8a6bced3ed1abf3c071268c1c2db59e63 100644 (file)
@@ -29,7 +29,6 @@
 #include "testing.h"
 
 // Helper functions
-// static int ctx_entl_size = 0;
 
 intel_pmu_ctx_t *stub_pmu_init() {
   intel_pmu_ctx_t *pmu_ctx = calloc(1, sizeof(*pmu_ctx));