1. 18 12月, 2015 2 次提交
  2. 17 12月, 2015 6 次提交
  3. 15 12月, 2015 2 次提交
    • N
      perf record: Add record.build-id config option · 7a29c087
      Namhyung Kim 提交于
      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: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NJiri 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      7a29c087
    • H
      perf record: Support custom vmlinux path · 7efe0e03
      He Kuang 提交于
      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: NHe 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: NWang Nan <wangnan0@huawei.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7efe0e03
  4. 14 12月, 2015 15 次提交
  5. 11 12月, 2015 15 次提交
    • W
      perf tools: Clear struct machine during machine__init() · 93b0ba3c
      Wang Nan 提交于
      There are so many test cases use stack allocated 'struct machine'.
      Including:
        test__hists_link
        test__hists_filter
        test__mmap_thread_lookup
        test__thread_mg_share
        test__hists_output
        test__hists_cumulate
      
      Also, in non-test code (for example, machine__new_host()) there are
      code use 'malloc()' to alloc struct machine.
      
      These are dangerous operations, cause some tests fail or hung in
      machines__exit(). For example, in
      
       machines__exit ->
         machine__destroy_kernel_maps ->
           map_groups__remove ->
             maps__remove ->
               pthread_rwlock_wrlock
      
      a incorrectly initialized lock causes unintended behavior.
      
      This patch memset(0) that structure in machine__init() to ensure all
      fields in 'struct machine' are initialized to zero.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1449541544-67621-17-git-send-email-wangnan0@huawei.com
      [ Use memset, see 'man bzero' ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      93b0ba3c
    • W
      perf script: Add support for PERF_TYPE_BREAKPOINT · 27cfef00
      Wang Nan 提交于
      Useful for getting stack traces for hardware breakpoint events.
      
      Test result:
      
      Before this patch:
       # ~/perf record -g -e mem:0x600980 ./sample
       [ perf record: Woken up 1 times to write data ]
       [ perf record: Captured and wrote 0.011 MB perf.data (12 samples) ]
      
       # ~/perf script
      
       # ~/perf script -F comm,tid,pid,time,event,ip,sym,dso
       sample 22520/22520 97457.836294: mem:0x600980:
                5a4ad8 __clear_user (/lib/modules/4.3.0-rc4+/build/vmlinux)
       ...
                3f41ba sys_execve (/lib/modules/4.3.0-rc4+/build/vmlinux)
                979395 return_from_execve (/lib/modules/4.3.0-rc4+/build/vmlinux)
          7f1b59719cf7 [unknown] ([unknown])
      
       sample 22520/22520 97457.836648: mem:0x600980:
                   532 main (/home/w00229757/DataBreakpoints/sample)
                 21bd5 __libc_start_main (/tmp/oxygen_root-root/lib64/libc-2.18.so)
       ...
      
      After this patch:
       # ~/perf script
       sample 22520 97457.836294: mem:0x600980:
                         5a4ad8 __clear_user (/lib/modules/4.3.0-rc4+/build/vmlinux)
       ...
                         3f41ba sys_execve (/lib/modules/4.3.0-rc4+/build/vmlinux)
                         979395 return_from_execve (/lib/modules/4.3.0-rc4+/build/vmlinux)
                   7f1b59719cf7 [unknown] ([unknown])
      
       sample 22520 97457.836648: mem:0x600980:
                            532 main (/home/w00229757/DataBreakpoints/sample)
                          21bd5 __libc_start_main (/tmp/oxygen_root-root/lib64/libc-2.18.so)
      
      Committer note:
      
      So, further testing, lets do it for a kernel global variable,
      tcp_hashinfo:
      
        # grep -w tcp_hashinfo /proc/kallsyms
        ffffffff8202fc00 B tcp_hashinfo
        #
      
      Note: allow specifying mem:tcp_hashinfo:
      
        # perf record -g -e mem:0xffffffff81c65ac0 -a
        ^C[ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.790 MB perf.data ]
        #
        # perf evlist
        mem:0xffffffff8202fc00
        # perf evlist -v
        mem:0xffffffff8202fc00: type: 5, size: 112, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CALLCHAIN|CPU, disabled: 1, inherit: 1, mmap: 1, comm: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1, bp_type: 3, { bp_addr, config1 }: 0xffffffff8202fc00, { bp_len, config2 }: 0x4
        #
      
      Then, after this patch:
      
        # perf script
        swapper 0 [000] 171036.986988: mem:0xffffffff8202fc00:
          8a0fb5 __inet_lookup_established (/lib/modules/4.3.0+/build/vmlinux)
          8bc09d tcp_v4_early_demux (/lib/modules/4.3.0+/build/vmlinux)
          896def ip_rcv_finish (/lib/modules/4.3.0+/build/vmlinux)
          8976c2 ip_rcv (/lib/modules/4.3.0+/build/vmlinux)
          855eba __netif_receive_skb_core (/lib/modules/4.3.0+/build/vmlinux)
          8565d8 __netif_receive_skb (/lib/modules/4.3.0+/build/vmlinux)
          8572a8 process_backlog (/lib/modules/4.3.0+/build/vmlinux)
          856b11 net_rx_action (/lib/modules/4.3.0+/build/vmlinux)
          2a284b __do_softirq (/lib/modules/4.3.0+/build/vmlinux)
          2a2ba3 irq_exit (/lib/modules/4.3.0+/build/vmlinux)
          96b7a4 do_IRQ (/lib/modules/4.3.0+/build/vmlinux)
          969807 ret_from_intr (/lib/modules/4.3.0+/build/vmlinux)
          804c27 cpuidle_enter (/lib/modules/4.3.0+/build/vmlinux)
          2ded22 call_cpuidle (/lib/modules/4.3.0+/build/vmlinux)
          2defb6 cpu_startup_entry (/lib/modules/4.3.0+/build/vmlinux)
          95d5bc rest_init (/lib/modules/4.3.0+/build/vmlinux)
         1163ffa start_kernel ([kernel.vmlinux].init.text)
         11634d7 x86_64_start_reservations ([kernel.vmlinux].init.text)
         1163623 x86_64_start_kernel ([kernel.vmlinux].init.text)
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1449541544-67621-16-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      27cfef00
    • W
      perf data: Add u32_hex data type · 26812d46
      Wang Nan 提交于
      Add hexadecimal u32 to base data type, which is useful for raw output
      because raw data is u32 aligned.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: David S. Miller <davem@davemloft.net>
      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/1449541544-67621-12-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      26812d46
    • W
      tools lib bpf: Fetch map names from correct strtab · 77ba9a5b
      Wang Nan 提交于
      Namhyung Kim pointed out a potential problem in original code that it
      fetches names of maps from section header string table, which is used
      to store section names.
      
      Original code doesn't cause error because of a LLVM behavior that, it
      combines shstrtab into strtab. For example:
      
       $ echo 'int func() {return 0;}' | x86_64-oe-linux-clang -x c -o temp.o -c -
       $ readelf -h ./temp.o
       ELF Header:
         Magic:   7f 45 4c 46 02 01 01 03 00 00 00 00 00 00 00 00
         ...
         Section header string table index: 1
       $ readelf -S ./temp.o
       There are 10 section headers, starting at offset 0x288:
      
       Section Headers:
         [Nr] Name              Type             Address           Offset
              Size              EntSize          Flags  Link  Info  Align
         [ 0]                   NULL             0000000000000000  00000000
              0000000000000000  0000000000000000           0     0     0
         [ 1] .strtab           STRTAB           0000000000000000  00000230
              0000000000000051  0000000000000000           0     0     1
              ...
       $ readelf -p .strtab ./temp.o
      
       String dump of section '.strtab':
         [     1]  .text
         [     7]  .comment
         [    10]  .bss
         [    15]  .note.GNU-stack
         [    25]  .rela.eh_frame
         [    34]  func
         [    39]  .strtab
         [    41]  .symtab
         [    49]  .data
         [    4f]  -
      
       $ readelf -p .shstrtab ./temp.o
       readelf: Warning: Section '.shstrtab' was not dumped because it does not exist!
      
      Where, 'section header string table index' points to '.strtab', and
      symbol names are also stored there.
      
      However, in case of gcc:
      
       $ echo 'int func() {return 0;}' | gcc -x c -o temp.o -c -
       $ readelf -p .shstrtab ./temp.o
      
       String dump of section '.shstrtab':
         [     1]  .symtab
         [     9]  .strtab
         [    11]  .shstrtab
         [    1b]  .text
         [    21]  .data
         [    27]  .bss
         [    2c]  .comment
         [    35]  .note.GNU-stack
         [    45]  .rela.eh_frame
       $ readelf -p .strtab ./temp.o
      
       String dump of section '.strtab':
         [     1]  func
      
      They are separated sections.
      
      Although original code doesn't cause error, we'd better use canonical
      method for fetching symbol names to avoid potential behavior changing.
      This patch learns from readelf's code, fetches string from sh_link
      of .symbol section.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Reported-and-Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1449541544-67621-3-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      77ba9a5b
    • W
      tools lib bpf: Check return value of strdup when reading map names · 973170e6
      Wang Nan 提交于
      Commit 561bbcca ("tools lib bpf:
      Extract and collect map names from BPF object file") forgets checking
      return value of strdup(). This patch fixes it. It also checks names
      pointer before strcmp() for safety.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Fixes: 561bbcca ("tools lib bpf: Extract and collect map names from BPF object file")
      Link: http://lkml.kernel.org/r/1449541544-67621-2-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      973170e6
    • N
      perf top: Cleanup condition in perf_top__record_precise_ip() · beefb8d0
      Namhyung Kim 提交于
      The 'he' cannot be NULL since it's caller hist_iter__top_callback() is
      called only if iter->he is not NULL (see hist_entry_iter__add).  So
      setting 'sym' before the condition to simplify the code.
      
      Also make it clearer that the top->symbol_filter_entry check is only
      meaningful on stdio mode (i.e. when use_browser is 0).
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1449802616-16170-4-git-send-email-namhyung@kernel.org
      [ Complete the simplification replacing one more he->ms.sym with sym ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      beefb8d0
    • N
      perf top: Fix annotation on --stdio · 448f13b2
      Namhyung Kim 提交于
      The ui__has_annotation() inside perf_top__record_precise_ip() should be
      removed since it returns true only for TUI (and when sort key has
      symbol).  However the 'perf top --stdio' also supports annotation for a
      symbol which was specified by 's' key action.
      
      Actually it already does the necessary checks before calling the
      function.  So it's ok to get rid of the check here.
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1449802616-16170-3-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      448f13b2
    • N
      perf top: Access hists->lock only if needed · 151ee834
      Namhyung Kim 提交于
      The perf_top__record_precise_ip() releases and regrabs the
      he->hists->lock because it can sleep if there's an error.  But it should
      be done conditionally as it slows down the fast path.
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1449802616-16170-2-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      151ee834
    • N
      perf top: Do not convert address for perf_top__record_precise_ip() · 64226bcf
      Namhyung Kim 提交于
      We call map->unmap_ip() before the function and call map->map_ip()
      inside the function.  This is meaningless and look strange since only
      one of the two checks 'map'.  Let's use al->addr directly.
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1449802616-16170-1-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      64226bcf
    • M
      perf symbols: Fix dso__load_sym to put dso · e7a7865c
      Masami Hiramatsu 提交于
      Fix dso__load_sym to put dso because dsos__add already got it.
      
      Refcnt debugger explain the problem:
        ----
        ==== [0] ====
        Unreclaimed dso: 0x19dd200
        Refcount +1 => 1 at
          ./perf(dso__new+0x1ff) [0x4a62df]
          ./perf(dso__load_sym+0xe89) [0x503509]
          ./perf(dso__load_vmlinux+0xbf) [0x4aa77f]
          ./perf(dso__load_vmlinux_path+0x8c) [0x4aa8dc]
          ./perf() [0x50539a]
          ./perf(convert_perf_probe_events+0xd79) [0x50ad39]
          ./perf() [0x45600f]
          ./perf(cmd_probe+0x6c) [0x4566bc]
          ./perf() [0x47abc5]
          ./perf(main+0x610) [0x421f90]
          /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f74dd0efaf5]
          ./perf() [0x4220a9]
        Refcount +1 => 2 at
          ./perf(dso__get+0x34) [0x4a65f4]
          ./perf(map__new2+0x76) [0x4be216]
          ./perf(dso__load_sym+0xee1) [0x503561]
          ./perf(dso__load_vmlinux+0xbf) [0x4aa77f]
          ./perf(dso__load_vmlinux_path+0x8c) [0x4aa8dc]
          ./perf() [0x50539a]
          ./perf(convert_perf_probe_events+0xd79) [0x50ad39]
          ./perf() [0x45600f]
          ./perf(cmd_probe+0x6c) [0x4566bc]
          ./perf() [0x47abc5]
          ./perf(main+0x610) [0x421f90]
          /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f74dd0efaf5]
          ./perf() [0x4220a9]
        Refcount +1 => 3 at
          ./perf(dsos__add+0xf3) [0x4a6bc3]
          ./perf(dso__load_sym+0xfc1) [0x503641]
          ./perf(dso__load_vmlinux+0xbf) [0x4aa77f]
          ./perf(dso__load_vmlinux_path+0x8c) [0x4aa8dc]
          ./perf() [0x50539a]
          ./perf(convert_perf_probe_events+0xd79) [0x50ad39]
          ./perf() [0x45600f]
          ./perf(cmd_probe+0x6c) [0x4566bc]
          ./perf() [0x47abc5]
          ./perf(main+0x610) [0x421f90]
          /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f74dd0efaf5]
          ./perf() [0x4220a9]
        Refcount -1 => 2 at
          ./perf(dso__put+0x2f) [0x4a664f]
          ./perf(map_groups__exit+0xb9) [0x4bee29]
          ./perf(machine__delete+0xb0) [0x4b93d0]
          ./perf(exit_probe_symbol_maps+0x28) [0x506718]
          ./perf() [0x45628a]
          ./perf(cmd_probe+0x6c) [0x4566bc]
          ./perf() [0x47abc5]
          ./perf(main+0x610) [0x421f90]
          /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f74dd0efaf5]
          ./perf() [0x4220a9]
        Refcount -1 => 1 at
          ./perf(dso__put+0x2f) [0x4a664f]
          ./perf(machine__delete+0xfe) [0x4b941e]
          ./perf(exit_probe_symbol_maps+0x28) [0x506718]
          ./perf() [0x45628a]
          ./perf(cmd_probe+0x6c) [0x4566bc]
          ./perf() [0x47abc5]
          ./perf(main+0x610) [0x421f90]
          /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f74dd0efaf5]
          ./perf() [0x4220a9]
        ----
      So, in the dso__load_sym, dso is gotten 3 times, by dso__new,
      map__new2, and dsos__add. The last 2 is actually released by
      map_groups and machine__delete correspondingly. However, the
      first reference by dso__new, is never released.
      
      Committer note:
      
      Changed the place where the reference count is dropped to:
      
      Fix it by dropping it right after creating curr_map, since we know that
      either that operation failed and we need to drop the dso refcount or
      that it succeed and we have it referenced via curr_map->dso.
      
      Then only drop the curr_map refcount after we call dsos__add() to make
      sure we hold a reference to it via curr_map->dso.
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20151209021118.10245.49869.stgit@localhost.localdomainSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e7a7865c
    • M
      perf tools: Make perf_session__register_idle_thread drop the refcount · 9d8b172f
      Masami Hiramatsu 提交于
      Note that since the thread was already inserted to the session
      list, it will be released when the session is released.
      Also, in perf_session__register_idle_thread() failure path,
      the thread should be put before returning.
      
      Refcnt debugger shows that the perf_session__register_idle_thread
      gets the returned thread, but the caller (__cmd_top) does not
      put the returned idle thread.
      
        ----
        ==== [0] ====
        Unreclaimed thread@0x24e6240
        Refcount +1 => 0 at
          ./perf(thread__new+0xe5) [0x4c8a75]
          ./perf(machine__findnew_thread+0x9a) [0x4bbdba]
          ./perf(perf_session__register_idle_thread+0x28) [0x4c63c8]
          ./perf(cmd_top+0xd7d) [0x43cf6d]
          ./perf() [0x47ba35]
          ./perf(main+0x617) [0x4225b7]
          /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f06027c5af5]
          ./perf() [0x42272d]
        Refcount +1 => 1 at
          ./perf(thread__get+0x2c) [0x4c8bcc]
          ./perf(machine__findnew_thread+0xee) [0x4bbe0e]
          ./perf(perf_session__register_idle_thread+0x28) [0x4c63c8]
          ./perf(cmd_top+0xd7d) [0x43cf6d]
          ./perf() [0x47ba35]
          ./perf(main+0x617) [0x4225b7]
          /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f06027c5af5]
          ./perf() [0x42272d]
        Refcount +1 => 2 at
          ./perf(thread__get+0x2c) [0x4c8bcc]
          ./perf(machine__findnew_thread+0x112) [0x4bbe32]
          ./perf(perf_session__register_idle_thread+0x28) [0x4c63c8]
          ./perf(cmd_top+0xd7d) [0x43cf6d]
          ./perf() [0x47ba35]
          ./perf(main+0x617) [0x4225b7]
          /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f06027c5af5]
          ./perf() [0x42272d]
        ----
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20151209021122.10245.69707.stgit@localhost.localdomain
      [ Drop the refcount in perf_session__register_idle_thread() ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9d8b172f
    • A
      Revert "perf tools: Improve setting of gcc debug option" · 8488335c
      Arnaldo Carvalho de Melo 提交于
      This reverts commit e8b7ea43.
      
      Martin created a gcc PR:
      
      https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68836Reported-by: NJiri Olsa <jolsa@redhat.com>
      Acked-by: NIngo Molnar <mingo@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Martin Liska <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>,
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20151202164827.GA21124@krava.brq.redhat.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8488335c
    • N
      perf top: Delete half-processed hist entries when exit · 61fa0e94
      Namhyung Kim 提交于
      After sample processing is done, hist entries are in both of
      hists->entries and hists->entries_in (or hists->entries_collapsed).  So
      I guess perf report does not have leaks on hists.
      
      But for perf top, it's possible to have half-processed entries which are
      only in hists->entries_in.  Eventually they will go to the
      hists->entries and get freed but they cannot be deleted by current
      hists__delete_entries().  This patch adds hists__delete_all_entries
      function to delete those entries.
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Tested-and-Acked-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1449734015-9148-2-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      61fa0e94
    • N
      perf tools: Get rid of exit_browser() from usage_with_options() · 3f86eb6b
      Namhyung Kim 提交于
      Since all of its users call before setup_browser(), there's no need to
      call exit_browser() inside of the function.
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Reviewed-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1449716459-23004-8-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3f86eb6b
    • N
      perf thread_map: Free strlist on constructor error path · 7ecb48fd
      Namhyung Kim 提交于
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Reviewed-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1449716459-23004-7-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7ecb48fd