• David Ahern's avatar
    perf tool: Save cmdline from user in file header vs what is passed to record · 56e6f602
    David Ahern authored
    A number of builtin commands process some user args and then pass the rest to
    cmd_record. cmd_record then saves argc/argv that it receives into the header of
    the perf data file. But this loses the arguments handled by the first command
    -- ie., the real command line from the user. This patch saves the command line
    as typed by the user rather than what was passed to cmd_record.
    
    As an example consider the command:
    $ perf kvm --guest --host --guestmount=/tmp/guest-mount record
        -fo /tmp/perf.data -ag -- sleep 10
    
    Currently the command saved to the header is:
        cmdline : /tmp/p3.5/perf record -o perf.data.kvm -fo /tmp/perf.data -ag -- sleep 1
    
    (ignore the duplicated -o -- the first would be yet another bug with perf-kvm).
    
    With this patch the command line saved to the header is:
    cmdline : /tmp/p3.5/perf kvm --guest --host --guestmount=/tmp/guest-mount
        record -fo /tmp/perf.data -ag -- sleep 1
    
    v2: simplified to saving the command in parse_options per Stephane's suggestion
    Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Namhyung Kim <namhyung@gmail.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Link: http://lkml.kernel.org/r/1343616831-6408-1-git-send-email-dsahern@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    56e6f602
builtin-record.c 25.2 KB