src/libpfm4/lib/pfmlib_intel_x86_perf_event.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
void
pfm_intel_x86_perf_validate_pattrs(void *this, pfmlib_event_desc_t *e)
{
	pfmlib_pmu_t *pmu = this;
	int i, compact;
	int has_pebs = intel_x86_event_has_pebs(this, e);
	int no_smpl = pmu->flags & PFMLIB_PMU_FL_NO_SMPL;
	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_PMU) {
			if (e->pattrs[i].idx == INTEL_X86_ATTR_U
			    || e->pattrs[i].idx == INTEL_X86_ATTR_K)
				compact = 1;
		}
		if (e->pattrs[i].ctrl == PFM_ATTR_CTRL_PERF_EVENT) {
			if (e->pattrs[i].idx == PERF_ATTR_PR && !has_pebs)
				compact = 1;
			if (e->pattrs[i].idx == PERF_ATTR_H)
				compact = 1;
			if (no_smpl
			    && (   e->pattrs[i].idx == PERF_ATTR_FR
			        || e->pattrs[i].idx == PERF_ATTR_PR
			        || e->pattrs[i].idx == PERF_ATTR_PE))
				compact = 1;
			if (pmu->supported_plm == 0
			    && (   e->pattrs[i].idx == PERF_ATTR_U
			        || e->pattrs[i].idx == PERF_ATTR_K
			        || e->pattrs[i].idx == PERF_ATTR_MG
			        || e->pattrs[i].idx == PERF_ATTR_MH))
				compact = 1;
		}
		if (compact) {
			pfmlib_compact_pattrs(e, i);
			i--;
		}
	}
}
void pfm_intel_x86_perf_validate_pattrs ( void * this , pfmlib_event_desc_t * e ) { pfmlib_pmu_t * pmu = this ; int i , compact ; int has_pebs = intel_x86_event_has_pebs ( this , e ) ; int no_smpl = pmu -> flags & PFMLIB_PMU_FL_NO_SMPL ; 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_PMU ) { if ( e -> pattrs [ i ] . idx == INTEL_X86_ATTR_U || e -> pattrs [ i ] . idx == INTEL_X86_ATTR_K ) compact = 1 ; } if ( e -> pattrs [ i ] . ctrl == PFM_ATTR_CTRL_PERF_EVENT ) { if ( e -> pattrs [ i ] . idx == PERF_ATTR_PR && ! has_pebs ) compact = 1 ; if ( e -> pattrs [ i ] . idx == PERF_ATTR_H ) compact = 1 ; if ( no_smpl && ( e -> pattrs [ i ] . idx == PERF_ATTR_FR || e -> pattrs [ i ] . idx == PERF_ATTR_PR || e -> pattrs [ i ] . idx == PERF_ATTR_PE ) ) compact = 1 ; if ( pmu -> supported_plm == 0 && ( e -> pattrs [ i ] . idx == PERF_ATTR_U || e -> pattrs [ i ] . idx == PERF_ATTR_K || e -> pattrs [ i ] . idx == PERF_ATTR_MG || e -> pattrs [ i ] . idx == PERF_ATTR_MH ) ) 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 */ /*
		 * with perf_events, u and k are handled at the OS level
		 * via exclude_user, exclude_kernel.
		 */ /* Precise mode, subject to PEBS */ /*
			 * No hypervisor on Intel
			 */ /*
			 * no priv level support
			 * We assume that if we do not support hardware plm,
			 * then the host, guest priv level filtering in not
			 * supported as well, even though on some arch it is
			 * achieved by the OS enabling/disabled on VMM entry
			 * and exit.
			 */ /* e->npattrs modified by call */ /* compensate for i++ */