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

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


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 ;-)

> But in most cases, using the libtraceevent would be a better solution IMHO.

It is the one that gives the most flexibily to change the kernel exported
tracepoint interface at will, yes.

> > Having said that, I'll take the latest patch, using perf_evsel__intval et all,
> > if Namhyung sees no further problems with it.

> Okay, after a quick glance I don't see anymore issue. You can add my
> Ack there.

Ok, thanks for checking!

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