lkml.org 
[lkml]   [2013]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [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@gmail.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


    \
     
     \ /
      Last update: 2013-11-12 13:01    [W:2.283 / U:0.404 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site