src/libpfm4/lib/pfmlib_perf_event_pmu.c
/*
 * remove attrs which are in conflicts (or duplicated) with os layer
 */
remove attrs which are in conflicts (or duplicated) with os layer
remove attrs which are in conflicts ( or duplicated ) with os layer
static void
pfm_perf_perf_validate_pattrs(void *this, pfmlib_event_desc_t *e)
{
	pfmlib_pmu_t *pmu = this;
	int i, compact, type;
	int plm = pmu->supported_plm;
	for (i = 0; i < e->npattrs; i++) {
		compact = 0;
		if (e->pattrs[i].type == PFM_ATTR_UMASK)
			continue;
		if (e->pattrs[i].ctrl != PFM_ATTR_CTRL_PERF_EVENT)
			continue;
		type = perf_pe[e->event].type;
		if (type == PERF_TYPE_HARDWARE || type == PERF_TYPE_HW_CACHE) {
			if (e->pattrs[i].idx == PERF_ATTR_H && !(plm & PFM_PLMH))
				compact = 1;
			if (e->pattrs[i].idx == PERF_ATTR_U && !(plm & PFM_PLM3))
				compact = 1;
			if (e->pattrs[i].idx == PERF_ATTR_K && !(plm & PFM_PLM0))
				compact = 1;
		} else {
			if (e->pattrs[i].idx == PERF_ATTR_PR)
				compact = 1;
			if (e->pattrs[i].idx == PERF_ATTR_H)
				compact = 1;
		}
		if (compact) {
			pfmlib_compact_pattrs(e, i);
			i--;
		}
	}
}
static void pfm_perf_perf_validate_pattrs ( void * this , pfmlib_event_desc_t * e ) { pfmlib_pmu_t * pmu = this ; int i , compact , type ; int plm = pmu -> supported_plm ; for ( i = 0 ; i < e -> npattrs ; i ++ ) { compact = 0 ; if ( e -> pattrs [ i ] . type == PFM_ATTR_UMASK ) continue ; if ( e -> pattrs [ i ] . ctrl != PFM_ATTR_CTRL_PERF_EVENT ) continue ; type = perf_pe [ e -> event ] . type ; if ( type == PERF_TYPE_HARDWARE || type == PERF_TYPE_HW_CACHE ) { if ( e -> pattrs [ i ] . idx == PERF_ATTR_H && ! ( plm & PFM_PLMH ) ) compact = 1 ; if ( e -> pattrs [ i ] . idx == PERF_ATTR_U && ! ( plm & PFM_PLM3 ) ) compact = 1 ; if ( e -> pattrs [ i ] . idx == PERF_ATTR_K && ! ( plm & PFM_PLM0 ) ) compact = 1 ; } else { if ( e -> pattrs [ i ] . idx == PERF_ATTR_PR ) compact = 1 ; if ( e -> pattrs [ i ] . idx == PERF_ATTR_H ) compact = 1 ; } if ( compact ) { pfmlib_compact_pattrs ( e , i ) ; i -- ; } } }
remove attrs which are in conflicts (or duplicated) with os layer
remove attrs which are in conflicts ( or duplicated ) with os layer
/* umasks never conflict */ /*
		 * only PERF_TYPE_HARDWARE/HW_CACHE may have
		 * precise mode or hypervisor mode
		 *
		 * there is no way to know for sure for those events
		 * so we allow the modifiers and leave it to the kernel
		 * to decide
		 */ /* no hypervisor mode */ /* no user mode */ /* no kernel mode */ /* no hypervisor mode */