From a9c2e7742c7a4e335c99f0d17a4797aa37678d28 Mon Sep 17 00:00:00 2001
From: Leonard Koenig <leonard.koenig@fu-berlin.de>
Date: Mon, 1 Apr 2019 19:12:19 +0200
Subject: [PATCH] Add workaround for workaround not finding default PMU

---
 src/components/perf_event/pe_libpfm4_events.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/components/perf_event/pe_libpfm4_events.c b/src/components/perf_event/pe_libpfm4_events.c
index 9bb1fa68e..7cc4c6c34 100644
--- a/src/components/perf_event/pe_libpfm4_events.c
+++ b/src/components/perf_event/pe_libpfm4_events.c
@@ -1198,13 +1198,26 @@ _pe_libpfm4_init(papi_vector_t *component, int cidx,
 				}
 			}
 
+			/* Workaround since above mentioned hack doesn't work really */
+			if (!found_default && pmu_type & PFM_PMU_TYPE_OS_GENERIC) {
+				if ((pinfo.type==PFM_PMU_TYPE_OS_GENERIC)) {
+					SUBDBG("\t  %s is default\n", pinfo.name);
+					memcpy(&(event_table->default_pmu),
+						&pinfo,sizeof(pfm_pmu_info_t));
+					found_default++;
+				}
+			}
+
 			if (pmu_type==PMU_TYPE_UNCORE) {
 				/* To avoid confusion, no "default" CPU for uncore */
 				found_default=1;
 			}
+
 		}
 		i++;
 	}
+
+
 	SUBDBG("%d native events detected on %d pmus\n",ncnt,detected_pmus);
 
 	if (detected_pmus==0) {
-- 
GitLab