Subject: Re: perf: POWER-event translation questions

From: Robert Richter <[email-masked]>
Date: Tue, 20 Nov 2012 17:50:19 +0100

On 09.11.12 11:26:26, Stephane Eranian wrote:
> On Thu, Nov 8, 2012 at 2:10 AM, Sukadev Bhattiprolu
> <[email-masked]> wrote:

> > 2. Can we allow hyphens in the {name} token  (please see my change to
> >    util/parse-events.l below). With this change, I can run:
> >
> The current code does not support this but Andi fixed that in his HSW patch
> and I use it for the PEBS-LL patch series as well.
>
> >           perf stat -e cpu/cmplu-stall-bru /tmp/nop
> >
> >    without any changes to the user level tool (parse-events.l) I have
> >    tested some common cases, not sure if it will break something :-)

But ...

> > diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
> > index c87efc1..1967bb2 100644
> > --- a/tools/perf/util/parse-events.l
> > +++ b/tools/perf/util/parse-events.l
> > @@ -80,7 +80,7 @@ event         [^,{}/]+
> >  num_dec                [0-9]+
> >  num_hex                0x[a-fA-F0-9]+
> >  num_raw_hex    [a-fA-F0-9]+
> > -name           [a-zA-Z_*?][a-zA-Z0-9_*?]*
> > +name           [-a-zA-Z_*?][-a-zA-Z0-9_*?]*
                     ^

... I wouldn't allow hyphens at the beginning of a name.

And, I am wondering if parsing reserved names like 'cpu-cycles' works
too, e.g. cpu/cpu-cycles-foobar/. There are many reserved words in the
lexer with hyphens in it. This might cause unexpected problems.

-Robert