Re: [PATCH 4/9] perf tools: Fix pmu events parsing rule

From: Jiri Olsa
Date: Mon Apr 23 2018 - 10:25:35 EST


On Mon, Apr 23, 2018 at 11:20:57AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Apr 23, 2018 at 11:08:18AM +0200, Jiri Olsa escreveu:
> > Currently all the event parsing fails end up
> > in the event_pmu rule, and display misleading
> > help like:
> >
> > $ perf stat -e inst kill
> > event syntax error: 'inst'
> > \___ Cannot find PMU `inst'. Missing kernel support?
> > ...
> >
> > The reason is that the event_pmu is too strong
> > and match also single string. Changing it to
> > force the '/' separators to be part of the rule,
> > and getting the proper error now:
> >
> > $ perf stat -e inst kill
> > event syntax error: 'inst'
> > \___ parser error
> > Run 'perf list' for a list of valid events
>
> I added a Reported-by: Ingo after checking that that was the case in tha
> private conversation we had, but I think this has to be further
> improved: do we have enough context at this point to change that into:
>
> $ perf stat -e inst kill
> event syntax error: 'inst'
> \___ unknown event
> Run 'perf list' for a list of valid events
>
> Instead of the generic "parser error"? That "list of valid events" helps
> tho, but if we're going to say something at that \___ MSG part...

yep, the plan is to display whatever match the user input
out of the all known event names.. in this case 'inst'
would match 'instructions' and some other arch related events

but it's some more work and this fix stands by itself ;-)

jirka