Re: [PATCH 07/10] perf, tools: Expand PMU events by prefix match
From: Jiri Olsa
Date: Wed Feb 08 2017 - 06:31:04 EST
On Fri, Jan 27, 2017 at 06:03:42PM -0800, Andi Kleen wrote:
SNIP
> enum perf_pmu_event_symbol_type
> perf_pmu__parse_check(const char *name);
> void parse_events__set_leader(char *name, struct list_head *list);
> diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
> index 3a5196380609..1c2788f69bf1 100644
> --- a/tools/perf/util/parse-events.y
> +++ b/tools/perf/util/parse-events.y
> @@ -224,68 +224,55 @@ event_pmu:
> PE_NAME opt_event_config
> {
> struct parse_events_evlist *data = _data;
> - struct list_head *list;
> + struct list_head *list, *orig_terms, *terms;
> +
> + if (parse_events_copy_term_list($2, &orig_terms))
> + YYABORT;
>
> ALLOC_LIST(list);
> - ABORT_ON(parse_events_add_pmu(data, list, $1, $2));
> + if (parse_events_add_pmu(data, list, $1, $2)) {
> + struct perf_pmu *pmu = NULL;
> + int ok = 0;
> +
> + while ((pmu = perf_pmu__scan(pmu)) != NULL) {
> + char *name = pmu->name;
> +
> + if (!strncmp(name, "uncore_", 7) &&
> + strncmp($1, "uncore_", 7))
> + name += 7;
> + if (!strncmp($1, name, strlen($1))) {
> + if (parse_events_copy_term_list(orig_terms, &terms))
> + YYABORT;
> + if (!parse_events_add_pmu(data, list, pmu->name, terms))
> + ok++;
> + parse_events_terms__delete(terms);
could you please split this into 2 changes:
- adding parse_events_multi_pmu_add with no functional changes
- uncore box related matching
thanks,
jirka