Re: [PATCH v2 2/6] perf test: Handle metric reuse in pmu-events parsing test

2021-04-06 Thread John Garry
On 06/04/2021 14:34, Jiri Olsa wrote: } So once we evaluate a pmu_event in pctx->ids in @pe, @all is set false, and we would loop again in the do-while loop, regardless of what expr__find_other() does (apart from erroring), and so call hashmap__for_each_entry_safe(&pctx->ids, ) again. ah ok, s

Re: [PATCH v2 2/6] perf test: Handle metric reuse in pmu-events parsing test

2021-04-06 Thread Jiri Olsa
On Tue, Apr 06, 2021 at 02:21:11PM +0100, John Garry wrote: > On 06/04/2021 13:55, Jiri Olsa wrote: > > > > > So expr__find_other() may add a new item to pctx->ids, and we always > > > > > iterate > > > > > again, and try to lookup any pmu_events, *, above. If none exist, > > > > > then we > > >

Re: [PATCH v2 2/6] perf test: Handle metric reuse in pmu-events parsing test

2021-04-06 Thread John Garry
On 06/04/2021 13:55, Jiri Olsa wrote: So expr__find_other() may add a new item to pctx->ids, and we always iterate again, and try to lookup any pmu_events, *, above. If none exist, then we hm, I don't see that.. so, what you do is: hashmap__for_each_entry_safe((&pctx->ids) ) {

Re: [PATCH v2 2/6] perf test: Handle metric reuse in pmu-events parsing test

2021-04-06 Thread Jiri Olsa
On Tue, Apr 06, 2021 at 01:43:09PM +0100, John Garry wrote: > On 06/04/2021 13:17, Jiri Olsa wrote: > > > > > + ref = &metric->metric_ref; > > > > > + ref->metric_name = pe->metric_name; > > > > > + ref->metric_expr = pe->metric_expr; > >

Re: [PATCH v2 2/6] perf test: Handle metric reuse in pmu-events parsing test

2021-04-06 Thread John Garry
On 06/04/2021 13:17, Jiri Olsa wrote: + ref = &metric->metric_ref; + ref->metric_name = pe->metric_name; + ref->metric_expr = pe->metric_expr; + list_add_tail(&metric->list, compound_list); + +

Re: [PATCH v2 2/6] perf test: Handle metric reuse in pmu-events parsing test

2021-04-06 Thread Jiri Olsa
On Tue, Apr 06, 2021 at 12:00:27PM +0100, John Garry wrote: > On 01/04/2021 14:49, Jiri Olsa wrote: > > On Thu, Mar 25, 2021 at 06:33:14PM +0800, John Garry wrote: > > > > SNIP > > > > > +struct metric { > > > + struct list_head list; > > > + struct metric_ref metric_ref; > > > +}; > > > + > > >

Re: [PATCH v2 2/6] perf test: Handle metric reuse in pmu-events parsing test

2021-04-06 Thread John Garry
On 01/04/2021 14:49, Jiri Olsa wrote: On Thu, Mar 25, 2021 at 06:33:14PM +0800, John Garry wrote: SNIP +struct metric { + struct list_head list; + struct metric_ref metric_ref; +}; + +static int resolve_metric_simple(struct expr_parse_ctx *pctx, +str

Re: [PATCH v2 2/6] perf test: Handle metric reuse in pmu-events parsing test

2021-04-01 Thread Jiri Olsa
On Thu, Mar 25, 2021 at 06:33:14PM +0800, John Garry wrote: SNIP > +struct metric { > + struct list_head list; > + struct metric_ref metric_ref; > +}; > + > +static int resolve_metric_simple(struct expr_parse_ctx *pctx, > + struct list_head *compound_list, > +

[PATCH v2 2/6] perf test: Handle metric reuse in pmu-events parsing test

2021-03-25 Thread John Garry
The pmu-events parsing test does not handle metric reuse at all. Introduce some simple handling to resolve metrics who reference other metrics. Signed-off-by: John Garry --- tools/perf/tests/pmu-events.c | 80 +++ 1 file changed, 80 insertions(+) diff --git a/to