[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131112113427.GA4053@ghostprotocols.net>
Date: Tue, 12 Nov 2013 08:34:27 -0300
From: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
To: Ingo Molnar <mingo@...nel.org>
Cc: David Ahern <dsahern@...il.com>, linux-kernel@...r.kernel.org,
Adrian Hunter <adrian.hunter@...el.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Jiri Olsa <jolsa@...hat.com>, Mike Galbraith <efault@....de>,
Paul Mackerras <paulus@...ba.org>,
Peter Zijlstra <peterz@...radead.org>,
Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 04/10] perf machine: Introduce synthesize_threads method
out of open coded equivalent
Em Mon, Nov 11, 2013 at 09:50:45PM +0100, Ingo Molnar escreveu:
> * David Ahern <dsahern@...il.com> wrote:
> > On 11/11/13, 1:22 PM, Arnaldo Carvalho de Melo wrote:
> > >+ if (perf_target__has_task(target))
> > >+ return perf_event__synthesize_thread_map(tool, threads, process, machine, data_mmap);
> > >+ else if (perf_target__has_cpu(target))
> > >+ return perf_event__synthesize_threads(tool, process, machine, data_mmap);
> > Getting kind of long on the line lengths...
> Maybe we could start losing most of the perf_ prefixes - it's all about
> perf here, so it does not really add much information, does it?
In some cases that is ok, that is why I didn't call it 'perf_machine',
just 'machine', in others, like 'perf_event', I thought 'event' would be
too general when somebody tries to use this code together with other
libraries.
In some cases, like 'perf_target', probably its ok to move to
'target', perhaps this is ok for this problem domain, i.e.
monitoring/profiling/etc.
> that would turn it into:
>
> if (target__has_task(target))
> return event__synthesize_thread_map(tool, threads, process, machine, data_mmap);
> else if (target__has_cpu(target))
> return event__synthesize_threads(tool, process, machine, data_mmap);
>
> Another trick would be to combine (tool, machine) into a single helper
> struct (struct context *ctx?), if that is mostly a constant combination
> describing tool environment, which gets passed deep inside the guts of
> functions.
Reducing the function signature is something that may help as well, and
was done in this series with machine__synthesize_threads, that avoids
passing the tool and process arguments, since they were constanty
anyway.
What you propose is used in some cases, like with symbol_conf, will try
to work in that direction as time goes by, i.e. doing some refactoring
work of this kind every once in a while, not to disrupt too much the
patch flow.
- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists