Re: [PATCH V5 2/3] perf tools: parse the pmu event prefix and surfix

From: Jiri Olsa
Date: Thu Sep 11 2014 - 10:53:33 EST


On Thu, Sep 11, 2014 at 01:50:50PM +0000, Liang, Kan wrote:
>
>
> > On Wed, Sep 10, 2014 at 01:55:31PM -0400, kan.liang@xxxxxxxxx wrote:
> >
> > SNIP
> >
> > > + struct perf_pmu_event_symbol *pmu2 =
> > > + (struct perf_pmu_event_symbol *) p2;
> > > +
> > > + return strcmp(pmu1->symbol, pmu2->symbol); }
> > > +
> > > +/*
> > > + * Read the pmu events list from sysfs
> > > + * Save it into perf_pmu_events_list
> > > + */
> > > +static void perf_pmu__parse_init(void) {
> > > +
> > > + struct perf_pmu *pmu = NULL;
> > > + struct perf_pmu_alias *alias;
> > > + int len = 0;
> > > +
> > > + while ((pmu = perf_pmu__scan(pmu)) != NULL)
> > > + list_for_each_entry(alias, &pmu->aliases, list) {
> > > + if (!strcmp(pmu->name, "cpu")) {
> > > + if (strchr(alias->name, '-'))
> > > + len++;
> > > + len++;
> > > + }
> > > + }
> > > + if (len == 0)
> > > + return;
> >
> > s oif 'len' is 0 we will scan all the time? maybe we want some separate 'init'
> > variable..
> >
>
> Maybe we can reuse the "perf_pmu_events_list_num".
> static int perf_pmu_events_list_num;
>
> If len is 0, we just set perf_pmu_events_list_num to -1.
> Is it OK?

seems ok

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/