Re: [PATCH v4 5/5] perf metric: Don't compute unused events.

2020-12-01 Thread Andi Kleen
> Can't this be all in a macro? It's still a lot of duplication. > > I'm still not a fan, but I think with a macro it wouldn't be too bad. > >Ugh, not a fan of macros. They expand to a single line of code and make >debugging hard. I'll do a v5 with a macro :-/ I suppose you

Re: [PATCH v4 5/5] perf metric: Don't compute unused events.

2020-12-01 Thread Andi Kleen
> +| expr '-' expr > +{ > + if (!compute_ids || (is_const($1.val) && is_const($3.val))) { > + assert($1.ids == NULL); > + assert($3.ids == NULL); > + $$.val = $1.val - $3.val; > + $$.ids = NULL; > + } else { > + /* LHS and/or RHS

[PATCH v4 5/5] perf metric: Don't compute unused events.

2020-12-01 Thread Ian Rogers
For a metric like: EVENT1 if #smt_on else EVENT2 currently EVENT1 and EVENT2 will be measured and then when the metric is reported EVENT1 or EVENT2 will be printed depending on the value from smt_on() during the expr parsing. Computing both events is unnecessary and can lead to multiplexing as