• Jiri Olsa's avatar
    perf tools: Fix tracing info recording · 29208e57
    Jiri Olsa authored
    Fixing the way the tracing information is stored within record command.
    The current implementation is causing issues for pipe output.
    
    Following commands fail currently:
    	perf script syscall-counts ls
    	perf record -e syscalls:sys_exit_read ls | ./perf report -i -
    
    The tracing information is part of the perf data file. It contains
    several files from within the tracing debugfs and procs directories.
    
    Beside some static header files, for each tracing event the format
    file is added. The /proc/kallsyms file is also added.
    
    The tracing data are stored with preceeding size. This is causing some
    dificulties for pipe output, since there's no way to tell debugfs/proc
    file size before reading it. So, for pipe output, all the debugfs files
    were read twice. Once to get the overall size and once to store the
    content itself. This can cause problem in case any of these file
    changed, within the storage time.
    
    To fix this behaviour and ensure the integrity of the tracing data, we:
        - read debugfs/proc file into the temp file
        - get temp file size and dump it to the pipe
        - dump the temp file contents to the pipe
    
    Cc: Eric Dumazet <eric.dumazet@gmail.com>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Neil Horman <nhorman@tuxdriver.com>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Link: http://lkml.kernel.org/r/20111020135943.GD2092@jolsa.brq.redhat.comSigned-off-by: default avatarJiri Olsa <jolsa@redhat.com>
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    29208e57
trace-event.h 6.49 KB