• A
    perf trace: Don't relookup fields by name in each sample · 77170988
    Arnaldo Carvalho de Melo 提交于
    Instead do the lookups just when creating the tracepoints, initially for
    the most common, raw_syscalls:sys_{enter,exit}.
    
    It works by having evsel->priv have a per tracepoint structure with
    entries for the fields, for direct access, with the offset and a
    function to get the value from the sample, doing the swap if needed.
    
    Using a simple workload that does M millions write syscalls, we go from:
    
     # perf stat -i -e cycles /tmp/oldperf trace ./sc_hello 100 > /dev/null
    
     Performance counter stats for '/tmp/oldperf trace ./sc_hello 100':
    
         8,366,771,459 cycles
    
           2.668025928 seconds time elapsed
    
     # perf stat -i -e cycles perf trace ./sc_hello 100 > /dev/null
    
     Performance counter stats for 'perf trace ./sc_hello 100':
    
         8,345,187,650 cycles
    
           2.631748425 seconds time elapsed
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Mike Galbraith <efault@gmx.de>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Link: http://lkml.kernel.org/n/tip-eyfhvoo510a5i10b27dnvm88@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
    77170988
builtin-trace.c 62.1 KB