Re: [PATCH] perf timechart: dynamically determine event data offset

From: Arnaldo Carvalho de Melo
Date: Wed Nov 27 2013 - 09:55:58 EST


Em Wed, Nov 27, 2013 at 11:51:25PM +0900, Namhyung Kim escreveu:
> 2013-11-27 (ì), 11:41 -0300, Arnaldo Carvalho de Melo:
> > Em Wed, Nov 27, 2013 at 11:17:43PM +0900, Namhyung Kim escreveu:
> > > 2013-11-27 (ì), 10:44 -0300, Arnaldo Carvalho de Melo:
> > > > Same signature, 32-bit, 64-bit userland, so whoever wrote timechart, Arjan, I
> > > > think, made no mistakes at using the kernel exported interface, choosing the
> > > > most efficient way to extract the data, casting to a struct.

> > > > Yeah, using the interface that searches for a field name to get the offset and
> > > > then add it to a pointer to then cast to the type will allow maximum flexibility,
> > > > but is not really efficient.

> > > > Doing that for something that is not performance critical (probably) as
> > > > timechart probably is not a problem, but so is not a problem using the patch
> > > > that does the cast after finding the offset of the first non-common field.

> > > I'm not sure how it affects the performance really.

> > Hey, everytime we need to get the value of a field when processing each
> > tracepoint sample we need to do it via:

> > struct format_field *pevent_find_field(struct event_format *event, const char *name)
> > {
> > struct format_field *format;
> >
> > for (format = event->format.fields; format; format = format->next) {
> > if (strcmp(format->name, name) == 0)
> > break;
> > }
> >
> > return format;
> > }
> >
> > I don't think this is optimal, no.
> >
> > But yeah, for things that don't have performance needs, don't process that many
> > samples and hey, machines are fast and cheap these days ;-)
>
> Right. What I wanted to say actually was like s/how/how much/. :)

We would have to use perf for that 8-)

Its just that doing a string search on a doubly linked list for each
field on each sample doesn't _look_ optimal to me, so I didn't bother
using a profiler for that :-)

Anyway, lets move on, will apply the patch after lunch and send Ingo's
way.

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