Re: [PATCH 16/18] perf evsel: Introduce perf_evsel__{str,int}valmethods

From: Arnaldo Carvalho de Melo
Date: Wed Sep 12 2012 - 09:49:07 EST


Em Wed, Sep 12, 2012 at 10:40:00AM +0900, Namhyung Kim escreveu:
> On Tue, 11 Sep 2012 20:53:08 -0300, Arnaldo Carvalho de Melo wrote:
> > From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> >
> > Wrappers to the libtraceevent routines, so that we can further reduce
> > the surface contact perf builtins have with it.
> [snip]
> > +char *perf_evsel__strval(struct perf_evsel *evsel, struct perf_sample *sample,
> > + const char *name)
> > +{
> > + struct format_field *field = pevent_find_field(evsel->tp_format, name);
> > + int offset;
> > +
> > + if (!field)
> > + return NULL;
>
> Whitespace problem?

Argh, if it is so, I have somehow unwired my git hook scripts, will
check.

> Btw, as a generic wrapper shouldn't it handle common fields also? If
> you care about performance, how about switching the order of finding
> fields in question, i.e.:
>
> struct format_field *field = pevent_find_field(evsel->tp_format, name);
>
> if (!field) {
> field = pevent_find_common_field(evsel->tp_format, name);
> if (!field)
> return NULL;
> }

When I see the need for looking at those commom fields, and so far I saw
none since we have perf_sample already, I think I'll add a wrapper for
pevent_find_common_field. I.e. use the fact we know we want one of those
fields, the _any_ is just a distraction, I think.

- Arnaldo
--
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/