1. 17 Dec, 2015 33 commits
  2. 16 Dec, 2015 4 commits
  3. 15 Dec, 2015 1 commit
    • Namhyung Kim's avatar
      perf record: Add record.build-id config option · 7a29c087
      Namhyung Kim authored
      Post processing at 'perf record' takes a long time on big machines.
      
      What it does is to find the build-id of binaries found in the event
      stream, so that it can make sure, at 'report' time, that the symtabs (be
      it ELF, kallsyms, etc) being used to resolve symbols are the ones
      matching the binaries found at 'record' time.
      
      Sometimes we just want to skip this processing of events at the end of
      the session to get quicker results, making sure the binaries haven't
      changed from 'record' to 'report' time.
      
      Add a new config option to control this behavior.
      
      The record.build-id config variable can have one of the following
      values:
      
       - cache: post-process data and save/update the binaries into the
                build-id cache (in ~/.debug).  This is the default.
       - no-cache: post-process the data but not update the build-id cache.
                   Same effect as using the -N option.
       - skip: skip post-processing and do not update the cache.
               Same effect as using the -B option.
      Reported-and-Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Link: http://lkml.kernel.org/r/1450144196-22957-1-git-send-email-namhyung@kernel.org
      [ Added some more text to the documentation ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7a29c087
  4. 14 Dec, 2015 2 commits
    • He Kuang's avatar
      perf record: Support custom vmlinux path · 7efe0e03
      He Kuang authored
      Make perf-record command support --vmlinux option if BPF_PROLOGUE is on.
      
      'perf record' needs vmlinux as the source of DWARF info to generate
      prologue for BPF programs, so path of vmlinux should be specified.
      
      Short name 'k' has been taken by 'clockid'. This patch skips the short
      option name and uses '--vmlinux' for vmlinux path.
      
      Documentation is also updated.
      
      Test result:
      
      In a production (or broken) environment:
       (by:
        # rm -rf ~/.debug/
        # mv /lib/modules/`uname -r`/build/vmlinux /tmp/
       )
      
       # ./perf record -e ./test_bpf_base.c ls
       Failed to find the path for kernel: No such file or directory
       event syntax error: './test_bpf_base.c'
                            \___ You need to check probing points in BPF file
       ...
      
       # ./perf record --vmlinux /tmp/vmlinux -e ./test_bpf_base.c ls
       ...
       [ perf record: Woken up 1 times to write data ]
       [ perf record: Captured and wrote 0.011 MB perf.data ]
      
      Help messages when build with NO_LIBBPF:
      
       # ./perf record -h
              --transaction     sample transaction flags (special events only)
              --vmlinux <file>  vmlinux pathname
                                (not built-in because NO_LIBBPF=1)
       # ./perf record --vmlinux /tmp/vmlinux ls /
        Warning: option `vmlinux' is being ignored because NO_LIBBPF=1
       ...
       [ perf record: Woken up 1 times to write data ]
       [ perf record: Captured and wrote 0.011 MB perf.data (11 samples) ]
      
      Help messages when build with NO_DWARF:
      
       # ./perf record -h
              --transaction     sample transaction flags (special events only)
              --vmlinux <file>  vmlinux pathname
                                (not built-in because NO_DWARF=1)
      Signed-off-by: default avatarHe Kuang <hekuang@huawei.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1450089563-122430-15-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7efe0e03
    • Wang Nan's avatar
      perf tools: Make options always available, even if required libs not linked · 48e1cab1
      Wang Nan authored
      This patch keeps options of perf builtins same in all conditions. If
      one option is disabled because of compiling options, users should be
      notified.
      
      Masami suggested another implementation in [1] that, by adding a
      OPTION_NEXT_DEPENDS option before those options in the 'struct option'
      array, options parser knows an option is disabled. However, in some
      cases this array is reordered (options__order()). In addition, in
      parse-option.c that array is const, so we can't simply merge
      information in decorator option into the affacted option.
      
      This patch chooses a simpler implementation that, introducing a
      set_option_nobuild() function and two option parsing flags. Builtins
      with such options should call set_option_nobuild() before option
      parsing. The complexity of this patch is because we want some of options
      can be skipped safely. In this case their arguments should also be
      consumed.
      
      Options in 'perf record' and 'perf probe' are fixed in this patch.
      
      [1] http://lkml.kernel.org/g/50399556C9727B4D88A595C8584AAB3752627CD4@GSjpTKYDCembx32.service.hitachi.net
      
      Test result:
      
      Normal case:
      
        # ./perf probe --vmlinux /tmp/vmlinux sys_write
        Added new event:
          probe:sys_write      (on sys_write)
      
        You can now use it in all perf tools, such as:
      
      	perf record -e probe:sys_write -aR sleep 1
      
      Build with NO_DWARF=1:
      
        # ./perf probe -L sys_write
          Error: switch `L' is not available because NO_DWARF=1
      
         Usage: perf probe [<options>] 'PROBEDEF' ['PROBEDEF' ...]
            or: perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]
            or: perf probe [<options>] --del '[GROUP:]EVENT' ...
            or: perf probe --list [GROUP:]EVENT ...
            or: perf probe [<options>] --funcs
      
          -L, --line <FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]>
                                Show source code lines.
                                (not built-in because NO_DWARF=1)
      
        # ./perf probe -k /tmp/vmlinux sys_write
          Warning: switch `k' is being ignored because NO_DWARF=1
        Added new event:
          probe:sys_write      (on sys_write)
      
        You can now use it in all perf tools, such as:
      
      	perf record -e probe:sys_write -aR sleep 1
      
        # ./perf probe --vmlinux /tmp/vmlinux sys_write
          Warning: option `vmlinux' is being ignored because NO_DWARF=1
        Added new event:
        [SNIP]
      
        # ./perf probe -l
         Usage: perf probe [<options>] 'PROBEDEF' ['PROBEDEF' ...]
            or: perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]
      ...
          -k, --vmlinux <file>  vmlinux pathname
                                (not built-in because NO_DWARF=1)
          -L, --line <FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]>
                                Show source code lines.
                                (not built-in because NO_DWARF=1)
      ...
          -V, --vars <FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT>
                                Show accessible variables on PROBEDEF
                                (not built-in because NO_DWARF=1)
              --externs         Show external variables too (with --vars only)
                                (not built-in because NO_DWARF=1)
              --no-inlines      Don't search inlined functions
                                (not built-in because NO_DWARF=1)
              --range           Show variables location range in scope (with --vars only)
                                (not built-in because NO_DWARF=1)
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1450089563-122430-14-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      48e1cab1