Re: [PATCH RFC v3 02/12] perf jevents: Add support for system events tables

From: Jiri Olsa
Date: Tue May 12 2020 - 06:30:14 EST


On Mon, May 11, 2020 at 09:21:00AM -0700, Ian Rogers wrote:

SNIP

> > >> + fprintf(outfp, "\n\t{\n\t\t.table = %s,\n\t},",
> > >> + sys_event_table->name);
> > >> + }
> > >> + fprintf(outfp, "\n\t{\n\t\t.table = 0\n\t},");
> > >
> > > this will add extra tabs:
> > >
> > > {
> > > .table = 0
> > > },
> > >
> > > while the rest of the file starts items without any indent
> > >
> >
> > I'll ensure the indent is the same.
> >
> > BTW, is there anything to be said for removing the empty map feature
> > (and always breaking the perf build instead)? I guess that it was just
> > an early feature for dealing with unstable JSONs.
>
> +1
> I'd very much like it if JSON parse errors and the like didn't result
> in an empty map but failed the build. I think ideally we could also

yep, that seems like good approach to me

> validate metric expressions using expr.y. If we include expr.y into
> jevents then is there any need to parse the metric expression at
> runtime? Could we just generate C code from jevents with a list of
> events (aka ids) for programming and a dedicated print function for
> each metric. The events would still be symbolic and checked at
> runtime, but the expressions being C code could yield compile time
> errors.

nice idea.. not sure we are able to do that with just expr.y code,
like to generate specific C code for metric, but I'd like to see
patches for that ;-)

but we would still need expr.y int perf code for custom user metrics,
so it still needs to stay anyway

jirka