Example #1
0
int
pfm_find_event(const char *str)
{
	pfmlib_event_desc_t e;
	int ret;

	if (PFMLIB_INITIALIZED() == 0)
		return PFM_ERR_NOINIT;

	if (!str)
		return PFM_ERR_INVAL;

	memset(&e, 0, sizeof(e));

	ret = pfmlib_parse_event(str, &e);
	if (ret == PFM_SUCCESS) {
		/*
		 * save index so we can return it
		 * and free the pattrs data that was
		 * allocated in pfmlib_parse_event()
		 */
		ret = pfmlib_pidx2idx(e.pmu, e.event);

		pfmlib_release_event(&e);
	}

	return ret;
}
Example #2
0
int
pfm_find_event(const char *str)
{
	pfmlib_event_desc_t e;
	int ret;

	if (PFMLIB_INITIALIZED() == 0)
		return PFM_ERR_NOINIT;

	if (!str)
		return PFM_ERR_INVAL;

	memset(&e, 0, sizeof(e));

	ret = pfmlib_parse_event(str, &e);
	if (ret == PFM_SUCCESS)
		return pfmlib_pidx2idx(e.pmu, e.event);

	return ret;
}