FreeBSD/lib/libpmc/libpmc.c
/*
 * Parse an event specifier for Intel fixed function counters.
 */
Parse an event specifier for Intel fixed function counters.
Parse an event specifier for Intel fixed function counters .
static int
iaf_allocate_pmc(enum pmc_event pe, char *ctrspec,
    struct pmc_op_pmcallocate *pmc_config)
{
	char *p;
	(void) pe;
	pmc_config->pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE);
	pmc_config->pm_md.pm_iaf.pm_iaf_flags = 0;
	while ((p = strsep(&ctrspec, ",")) != NULL) {
		if (KWMATCH(p, IAF_KW_OS))
			pmc_config->pm_caps |= PMC_CAP_SYSTEM;
		else if (KWMATCH(p, IAF_KW_USR))
			pmc_config->pm_caps |= PMC_CAP_USER;
		else if (KWMATCH(p, IAF_KW_ANYTHREAD))
			pmc_config->pm_md.pm_iaf.pm_iaf_flags |= IAF_ANY;
		else
			return (-1);
	}
	return (0);
}
static int iaf_allocate_pmc ( enum pmc_event pe , char * ctrspec , struct pmc_op_pmcallocate * pmc_config ) { char * p ; ( void ) pe ; pmc_config -> pm_caps |= ( PMC_CAP_READ | PMC_CAP_WRITE ) ; pmc_config -> pm_md . pm_iaf . pm_iaf_flags = 0 ; while ( ( p = strsep ( & ctrspec , " " ) ) != NULL ) { if ( KWMATCH ( p , IAF_KW_OS ) ) pmc_config -> pm_caps |= PMC_CAP_SYSTEM ; else if ( KWMATCH ( p , IAF_KW_USR ) ) pmc_config -> pm_caps |= PMC_CAP_USER ; else if ( KWMATCH ( p , IAF_KW_ANYTHREAD ) ) pmc_config -> pm_md . pm_iaf . pm_iaf_flags |= IAF_ANY ; else return ( -1 ) ; } return ( 0 ) ; }
Parse an event specifier for Intel fixed function counters.
Parse an event specifier for Intel fixed function counters .