Re: [PATCH 05/16] perf tools: Add facility to export data in database-friendly way

From: Arnaldo Carvalho de Melo
Date: Fri Oct 24 2014 - 10:40:16 EST


Em Fri, Oct 24, 2014 at 04:13:00PM +0300, Adrian Hunter escreveu:
> On 24/10/14 15:26, Namhyung Kim wrote:
> > Hi Adrian,
> >
> > On Fri, Oct 24, 2014 at 7:47 PM, Adrian Hunter <adrian.hunter@xxxxxxxxx> wrote:
> >> On 24/10/14 11:11, Adrian Hunter wrote:
> >>> On 24/10/14 09:02, Namhyung Kim wrote:
> >>>> Can we do it somewhere in a script not in the core code? I don't feel
> >>>> comfortable to add those bits into the core code. What if we export
> >>>
> >>> Please explain what you mean by "comfortable".
> >>
> >> Or rather: What about it is wrong for core code?
> >
> > Well, there's nothing "wrong" about it. :)
> >
> > But I think if some code is used only by a specific bits, it'd be
> > better hiding it from the rest as much as possible.
>
> It is pretty self-contained in db-export.[ch] and the scripting
> engines.

So, what I meant was the patch below, on top of yours.

In some data structures where there were no provision for tool specific
storage, I added an unnamed union with db_id and a void *priv pointer,
where there were, be it a priv pointer, like in perf_evsel, I moved
db_id to it, no extra costs for the other tools.

And in struct symbol, I made it use symbol__priv(), that will access the
area reserved by setting symbol.priv_size at tool start time, like done
for the annotation case in top, report, annotate. I.e. on the tool that
will use symbol->db_id you will need to add this just before calling
symbol__init():

symbol_conf.priv_size = sizeof(u64);

Since this is all specific to your tool, there should be no problems and
I'm now applying this change merged with your original patch + note
about that and then moving on to the other patches that make use of it.

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