1. 28 Oct, 2015 3 commits
    • Wang Nan's avatar
      perf tools: Enable pre-event inherit setting by config terms · 374ce938
      Wang Nan authored
      This patch allows perf record setting event's attr.inherit bit by
      config terms like:
      
        # perf record -e cycles/no-inherit/ ...
        # perf record -e cycles/inherit/ ...
      
      So user can control inherit bit for each event separately.
      
      In following example, a.out fork()s in main then do some complex
      CPU intensive computations in both of its children.
      
      Basic result with and without inherit:
      
        # perf record -e cycles -e instructions ./a.out
        [ perf record: Woken up 9 times to write data ]
        [ perf record: Captured and wrote 2.205 MB perf.data (47920 samples) ]
        # perf report --stdio
        # ...
        # Samples: 23K of event 'cycles'
        # Event count (approx.): 23641752891
        ...
        # Samples: 24K of event 'instructions'
        # Event count (approx.): 30428312415
      
        # perf record -i -e cycles -e instructions ./a.out
        [ perf record: Woken up 5 times to write data ]
        [ perf record: Captured and wrote 1.111 MB perf.data (24019 samples) ]
        ...
        # Samples: 12K of event 'cycles'
        # Event count (approx.): 11699501775
        ...
        # Samples: 12K of event 'instructions'
        # Event count (approx.): 15058023559
      
      Cancel inherit for one event when globally enable:
      
        # perf record -e cycles/no-inherit/ -e instructions ./a.out
        [ perf record: Woken up 7 times to write data ]
        [ perf record: Captured and wrote 1.660 MB perf.data (36004 samples) ]
        ...
        # Samples: 12K of event 'cycles/no-inherit/'
        # Event count (approx.): 11895759282
       ...
        # Samples: 24K of event 'instructions'
        # Event count (approx.): 30668000441
      
      Enable inherit for one event when globally disable:
      
        # perf record -i -e cycles/inherit/ -e instructions ./a.out
        [ perf record: Woken up 7 times to write data ]
        [ perf record: Captured and wrote 1.654 MB perf.data (35868 samples) ]
        ...
        # Samples: 23K of event 'cycles/inherit/'
        # Event count (approx.): 23285400229
        ...
        # Samples: 11K of event 'instructions'
        # Event count (approx.): 14969050259
      
      Committer note:
      
      One can check if the bit was set, in addition to seeing the result in
      the perf.data file size as above by doing one of:
      
        # perf record -e cycles -e instructions -a usleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.911 MB perf.data (63 samples) ]
        # perf evlist -v
        cycles: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|ID|CPU|PERIOD, read_format: ID, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1
        instructions: size: 112, config: 0x1, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|ID|CPU|PERIOD, read_format: ID, disabled: 1, inherit: 1, freq: 1, sample_id_all: 1, exclude_guest: 1
        #
      
      So, the inherit bit was set in both, now, if we disable it globally using
      --no-inherit:
      
        # perf record --no-inherit -e cycles -e instructions -a usleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.910 MB perf.data (56 samples) ]
        # perf evlist -v
        cycles: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|ID|CPU|PERIOD, read_format: ID, disabled: 1, mmap: 1, comm: 1, freq: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1
        instructions: size: 112, config: 0x1, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|ID|CPU|PERIOD, read_format: ID, disabled: 1, freq: 1, sample_id_all: 1, exclude_guest: 1
      
      No inherit bit set, then disabling it and setting just on the cycles event:
      
        # perf record --no-inherit -e cycles/inherit/ -e instructions -a usleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.909 MB perf.data (48 samples) ]
        # perf evlist -v
        cycles/inherit/: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|ID|CPU|PERIOD, read_format: ID, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1
        instructions: size: 112, config: 0x1, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|ID|CPU|PERIOD, read_format: ID, disabled: 1, freq: 1, sample_id_all: 1, exclude_guest: 1
        #
      
      We can see it as well in by using a more verbose level of debug messages in
      the tool that sets up the perf_event_attr, 'perf record' in this case:
      
        [root@zoo ~]# perf record -vv --no-inherit -e cycles/inherit/ -e instructions -a usleep 1
        ------------------------------------------------------------
        perf_event_attr:
          size                             112
          { sample_period, sample_freq }   4000
          sample_type                      IP|TID|TIME|ID|CPU|PERIOD
          read_format                      ID
          disabled                         1
          inherit                          1
          mmap                             1
          comm                             1
          freq                             1
          task                             1
          sample_id_all                    1
          exclude_guest                    1
          mmap2                            1
          comm_exec                        1
        ------------------------------------------------------------
        sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8
        sys_perf_event_open: pid -1  cpu 1  group_fd -1  flags 0x8
        sys_perf_event_open: pid -1  cpu 2  group_fd -1  flags 0x8
        sys_perf_event_open: pid -1  cpu 3  group_fd -1  flags 0x8
        ------------------------------------------------------------
        perf_event_attr:
          size                             112
          config                           0x1
          { sample_period, sample_freq }   4000
          sample_type                      IP|TID|TIME|ID|CPU|PERIOD
          read_format                      ID
          disabled                         1
          freq                             1
          sample_id_all                    1
          exclude_guest                    1
        ------------------------------------------------------------
        sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8
      
      <SNIP>
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1446029705-199659-2-git-send-email-wangnan0@huawei.com
      [ s/u64/bool/ for the perf_evsel_config_term inherit field - jolsa]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      374ce938
    • Dima Kogan's avatar
      perf symbols: we can now read separate debug-info files based on a build ID · 5baecbcd
      Dima Kogan authored
      Recent GDB (at least on a vanilla Debian box) looks for debug information in
      
        /usr/lib/debug/.build-id/nn/nnnnnnn
      
      where nn/nnnnnn is the build-id of the stripped ELF binary. This is
      documented here:
      
        https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html
      
      This was not working in perf because we didn't read the build id until
      AFTER we searched for the separate debug information file. This patch
      reads the build ID and THEN does the search.
      Signed-off-by: default avatarDima Kogan <dima@secretsauce.net>
      Link: http://lkml.kernel.org/r/87si6pfwz4.fsf@secretsauce.netSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5baecbcd
    • Dima Kogan's avatar
      perf symbols: Fix type error when reading a build-id · f2f30968
      Dima Kogan authored
      This was benign, but wrong. The build-id should live in a char[], not a char*[]
      Signed-off-by: default avatarDima Kogan <dima@secretsauce.net>
      Link: http://lkml.kernel.org/r/87si6pfwz4.fsf@secretsauce.netSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f2f30968
  2. 27 Oct, 2015 5 commits
  3. 26 Oct, 2015 3 commits
  4. 25 Oct, 2015 1 commit
  5. 24 Oct, 2015 2 commits
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Provide help for subset of options · 161d9041
      Arnaldo Carvalho de Melo authored
      Some tools have a lot of options, so, providing a way to show help just
      for some of them may come handy:
      
        $ perf report -h --tui
      
         Usage: perf report [<options>]
      
              --tui             Use the TUI interface
      
        $ perf report -h --tui --showcpuutilization -b -c
      
         Usage: perf report [<options>]
      
          -b, --branch-stack    use branch records for per branch histogram filling
          -c, --comms <comm[,comm...]>
                                only consider symbols in these comms
              --showcpuutilization
                                Show sample percentage for different cpu modes
              --tui             Use the TUI interface
      
        $
      
      Using it with perf bash completion is also handy, just make sure you
      source the needed file:
      
        $ . ~/git/linux/tools/perf/perf-completion.sh
      
      Then press tab/tab after -- to see a list of options, put them after -h
      and only the options chosen will have its help presented:
      
        $ perf report -h --
        --asm-raw              --demangle-kernel      --group
        --kallsyms             --pretty               --stdio
        --branch-history       --disassembler-style   --gtk
        --max-stack            --showcpuutilization   --symbol-filter
        --branch-stack         --dsos                 --header
        --mem-mode             --show-info            --symbols
        --call-graph           --dump-raw-trace       --header-only
        --modules              --show-nr-samples      --symfs
        --children             --exclude-other        --hide-unresolved
        --objdump              --show-ref-call-graph  --threads
        --column-widths        --fields               --ignore-callees
        --parent               --show-total-period    --tid
        --comms                --field-separator      --input
        --percentage           --socket-filter        --tui
        --cpu                  --force                --inverted
        --percent-limit        --sort                 --verbose
        --demangle             --full-source-path     --itrace
        --pid                  --source               --vmlinux
        $ perf report -h --socket-filter
      
         Usage: perf report [<options>]
      
            --socket-filter <n>
                        only show processor socket that match with this filter
      Suggested-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Chandler Carruth <chandlerc@gmail.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-83mcdd3wj0379jcgea8w0fxa@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      161d9041
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Show tool command line options ordered · 869c55b0
      Arnaldo Carvalho de Melo authored
      When asking for a listing of the options, be it using -h or when an
      unknown option is passed, order it by one-letter options, then the ones
      having just long names.
      Suggested-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Chandler Carruth <chandlerc@gmail.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-41qh68t35n4ehrpsuazp1dx8@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      869c55b0
  6. 23 Oct, 2015 1 commit
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo' of... · 80fcd45e
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
      User visible changes:
      
        - The default for callchains is back to 'callee' when --children is not used.
          (Namhyung Kim)
      
        - Move the 'use_offset' option to the right place where the annotate code
          expects it to be to be able to properly handle it. (Namhyung Kim)
      
        - Don't die when an unknown 'annotate' option is found in the perf config
          file (usually ~/.perfconfig), just warn the user. (Arnaldo Carvalho de Melo)
      
      Infrastructure changes:
      
        - Support %ps/%pS in libtraceevent. (Scott Wood)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      80fcd45e
  7. 22 Oct, 2015 9 commits
  8. 21 Oct, 2015 2 commits
  9. 20 Oct, 2015 9 commits
  10. 19 Oct, 2015 5 commits