Re: [PATCH v3 12/27] perf parse-events: Support no alias assigned event inside hybrid PMU
From: Jiri Olsa
Date: Tue Apr 13 2021 - 08:36:45 EST
On Mon, Apr 12, 2021 at 10:51:14AM +0800, Jin, Yao wrote:
SNIP
>
> Do you suggest we just use string comparison for doing the direct check?
>
> e.g.
>
> if (strstr(term->config, "L1-dcache"))
> ...
>
> Of course, we can define a string array first and use a loop for string comparison.
>
> > > + if (!parse_state->fake_pmu && head_config && !found &&
> > > + perf_pmu__is_hybrid(name)) {
> > > + struct parse_events_term *term;
> > > + int ret;
> > > +
> > > + list_for_each_entry(term, head_config, list) {
> > > + if (!term->config)
> > > + continue;
> > > +
> > > + ret = parse_events__with_hybrid_pmu(parse_state,
> > > + term->config,
> > > + name, &found,
> > > + list);
> >
> > do we need to call the parsing again? could we just call
> > parse_events__add_cache_hybrid?
> >
> > jirka
> >
> >
>
> If we do the direct check for cache events, I think we don't need the parsing again.
>
> As I mentioned above, we need to define a string array and compare with term->config one by one.
>
maybe another way is to find a way to run just the lexer (without
parser) and check that it returns PE_NAME_CACHE_OP_RESULT
jirka