+ return;
+}
+
+#ifdef LIBPQOS2
+static void rdt_dump_ngroups(void) {
+
+ char names[DATA_MAX_NAME_LEN];
+
+ if (g_rdt == NULL)
+ return;
+
+ DEBUG(RDT_PLUGIN ": Process Names Groups Dump");
+ DEBUG(RDT_PLUGIN ": groups count: %" PRIsz, g_rdt->num_ngroups);
+
+ for (size_t i = 0; i < g_rdt->num_ngroups; i++) {
+ memset(names, 0, sizeof(names));
+ for (size_t j = 0; j < g_rdt->ngroups[i].num_names; j++)
+ snprintf(names + strlen(names), sizeof(names) - strlen(names) - 1, " %s",
+ g_rdt->ngroups[i].names[j]);
+
+ DEBUG(RDT_PLUGIN ": group[%d]:", (int)i);
+ DEBUG(RDT_PLUGIN ": description: %s", g_rdt->ngroups[i].desc);
+ DEBUG(RDT_PLUGIN ": process names:%s", names);
+ DEBUG(RDT_PLUGIN ": events: 0x%X", g_rdt->ngroups[i].events);
+ }
+
+ return;
+}
+#endif /* LIBPQOS2 */
+
+static inline double bytes_to_kb(const double bytes) { return bytes / 1024.0; }
+
+static inline double bytes_to_mb(const double bytes) {
+ return bytes / (1024.0 * 1024.0);
+}
+
+static void rdt_dump_cores_data(void) {
+/*
+ * CORE - monitored group of cores
+ * RMID - Resource Monitoring ID associated with the monitored group
+ * This is not available for monitoring with resource control
+ * LLC - last level cache occupancy
+ * MBL - local memory bandwidth
+ * MBR - remote memory bandwidth
+ */
+#ifdef LIBPQOS2
+ if (g_interface == PQOS_INTER_OS_RESCTRL_MON) {
+ DEBUG(RDT_PLUGIN ": CORE LLC[KB] MBL[MB] MBR[MB]");
+ } else {
+ DEBUG(RDT_PLUGIN ": CORE RMID LLC[KB] MBL[MB] MBR[MB]");
+ }
+#else
+ DEBUG(RDT_PLUGIN ": CORE RMID LLC[KB] MBL[MB] MBR[MB]");
+#endif /* LIBPQOS2 */
+
+ for (int i = 0; i < g_rdt->cores.num_cgroups; i++) {
+ const struct pqos_event_values *pv = &g_rdt->pcgroups[i]->values;
+
+ double llc = bytes_to_kb(pv->llc);
+ double mbr = bytes_to_mb(pv->mbm_remote_delta);
+ double mbl = bytes_to_mb(pv->mbm_local_delta);
+#ifdef LIBPQOS2
+ if (g_interface == PQOS_INTER_OS_RESCTRL_MON) {
+ DEBUG(RDT_PLUGIN ": [%s] %10.1f %10.1f %10.1f",
+ g_rdt->cores.cgroups[i].desc, llc, mbl, mbr);
+ } else {
+ DEBUG(RDT_PLUGIN ": [%s] %8u %10.1f %10.1f %10.1f",
+ g_rdt->cores.cgroups[i].desc, g_rdt->pcgroups[i]->poll_ctx[0].rmid,
+ llc, mbl, mbr);
+ }
+#else
+ DEBUG(RDT_PLUGIN ": [%s] %8u %10.1f %10.1f %10.1f",
+ g_rdt->cores.cgroups[i].desc, g_rdt->pcgroups[i]->poll_ctx[0].rmid,
+ llc, mbl, mbr);
+#endif /* LIBPQOS2 */
+ }
+}
+
+#ifdef LIBPQOS2
+static void rdt_dump_pids_data(void) {
+ /*
+ * NAME - monitored group of processes
+ * PIDs - list of PID numbers in the NAME group
+ * LLC - last level cache occupancy
+ * MBL - local memory bandwidth
+ * MBR - remote memory bandwidth
+ */
+
+ DEBUG(RDT_PLUGIN ": NAME PIDs");
+ char pids[DATA_MAX_NAME_LEN];
+ for (size_t i = 0; i < g_rdt->num_ngroups; ++i) {
+ memset(pids, 0, sizeof(pids));
+ for (size_t j = 0; j < g_rdt->ngroups[i].num_names; ++j) {
+ pids_list_t *list = g_rdt->ngroups[i].proc_pids[j]->curr;
+ for (size_t k = 0; k < list->size; k++)
+ snprintf(pids + strlen(pids), sizeof(pids) - strlen(pids) - 1, " %u",
+ list->pids[k]);
+ }
+ DEBUG(RDT_PLUGIN ": [%s] %s", g_rdt->ngroups[i].desc, pids);
+ }
+
+ DEBUG(RDT_PLUGIN ": NAME LLC[KB] MBL[MB] MBR[MB]");
+ for (size_t i = 0; i < g_rdt->num_ngroups; i++) {
+
+ const struct pqos_event_values *pv = &g_rdt->pngroups[i]->values;
+
+ double llc = bytes_to_kb(pv->llc);
+ double mbr = bytes_to_mb(pv->mbm_remote_delta);
+ double mbl = bytes_to_mb(pv->mbm_local_delta);
+
+ DEBUG(RDT_PLUGIN ": [%s] %10.1f %10.1f %10.1f", g_rdt->ngroups[i].desc,
+ llc, mbl, mbr);
+ }
+}
+#endif /* LIBPQOS2 */
+#endif /* COLLECT_DEBUG */
+
+#ifdef LIBPQOS2
+static int isdupstr(const char *names[], const size_t size, const char *name) {
+ for (size_t i = 0; i < size; i++)
+ if (strncmp(names[i], name, (size_t)MAX_PROC_NAME_LEN) == 0)
+ return 1;
+