1. 02 10月, 2009 1 次提交
    • A
      perf tools: Rewrite and improve support for kernel modules · 439d473b
      Arnaldo Carvalho de Melo 提交于
      Representing modules as struct map entries, backed by a DSO, etc,
      using /proc/modules to find where the module is loaded.
      
      DSOs now can have a short and long name, so that in verbose mode we
      can show exactly which .ko or vmlinux image was used.
      
      As kernel modules now are a DSO separate from the kernel, we can
      ask for just the hits for a particular set of kernel modules, just
      like we can do with shared libraries:
      
      [root@doppio linux-2.6-tip]# perf report -n --vmlinux
      /home/acme/git/build/tip-recvmmsg/vmlinux --modules --dsos \[drm\] | head -15
          84.58%      13266             Xorg  [k] drm_clflush_pages
           4.02%        630             Xorg  [k] trace_kmalloc.clone.0
           3.95%        619             Xorg  [k] drm_ioctl
           2.07%        324             Xorg  [k] drm_addbufs
           1.68%        263             Xorg  [k] drm_gem_close_ioctl
           0.77%        120             Xorg  [k] drm_setmaster_ioctl
           0.70%        110             Xorg  [k] drm_lastclose
           0.68%        106             Xorg  [k] drm_open
           0.54%         85             Xorg  [k] drm_mm_search_free
      [root@doppio linux-2.6-tip]#
      
      Specifying --dsos /lib/modules/2.6.31-tip/kernel/drivers/gpu/drm/drm.ko
      would have the same effect. Allowing specifying just 'drm.ko' is left
      for another patch.
      
      Processing kallsyms so that per kernel module struct map are
      instantiated was also left for another patch. That will allow
      removing the module name from each of its symbols.
      
      struct symbol was reduced by removing the ->module backpointer and
      moving it (well now the map) to struct symbol_entry in perf top,
      that is its only user right now.
      
      The total linecount went down by ~500 lines.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Avi Kivity <avi@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      439d473b
  2. 23 9月, 2009 1 次提交
    • M
      perf tools: Fix module symbol loading bug · 508c4d08
      Mike Galbraith 提交于
      Avi Kivity reported 'perf annotate' failures with modules, the
      requested function was not annotated.
      
      If there are no modules currently loaded, or the last module
      scanned is not loaded, dso__load_modules() steps on the value from
      dso__load_vmlinux(), so we happily load the kallsyms symbols on top
      of what we've already loaded.
      
      Fix that such that the total count of symbols loaded is returned.
      Should module symbol load fail after parsing of vmlinux, is's a
      hard failure, so do not silently fall-back to kallsyms.
      Reported-by: NAvi Kivity <avi@redhat.com>
      Signed-off-by: NMike Galbraith <efault@gmx.de>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: rostedt@goodmis.org
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      LKML-Reference: <1253697658.11461.36.camel@marge.simson.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      508c4d08
  3. 17 8月, 2009 1 次提交
    • F
      perf tools: Librarize trace_event() helper · 8f28827a
      Frederic Weisbecker 提交于
      Librarize trace_event() helper so that perf trace can use it
      too. Also clean up the debug.h includes a bit.
      
      It's not good to have it included in perf.h because it doesn't
      make it flexible against other headers it may need (headers
      that can also depend on perf.h and then create a recursive
      header dependency).
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <1250453149-664-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      8f28827a
  4. 16 8月, 2009 1 次提交
    • I
      perf: Enable more compiler warnings · 83a0944f
      Ingo Molnar 提交于
      Related to a shadowed variable bug fix Valdis Kletnieks noticed
      that perf does not get built with -Wshadow, which could have
      helped us avoid the bug.
      
      So enable -Wshadow and also enable the following warnings on
      perf builds, in addition to the already enabled -Wall -Wextra
      -std=gnu99 warnings:
      
       -Wcast-align
       -Wformat=2
       -Wshadow
       -Winit-self
       -Wpacked
       -Wredundant-decls
       -Wstack-protector
       -Wstrict-aliasing=3
       -Wswitch-default
       -Wswitch-enum
       -Wno-system-headers
       -Wundef
       -Wvolatile-register-var
       -Wwrite-strings
       -Wbad-function-cast
       -Wmissing-declarations
       -Wmissing-prototypes
       -Wnested-externs
       -Wold-style-definition
       -Wstrict-prototypes
       -Wdeclaration-after-statement
      
      And change/fix the perf code to build cleanly under GCC 4.3.2.
      
      The list of warnings enablement is rather arbitrary: it's based
      on my (quick) reading of the GCC manpages and trying them on
      perf.
      
      I categorized the warnings based on individually enabling them
      and looking whether they trigger something in the perf build.
      If i liked those warnings (i.e. if they trigger for something
      that arguably could be improved) i enabled the warning.
      
      If the warnings seemed to come from language laywers spamming
      the build with tons of nuisance warnings i generally kept them
      off. Most of the sign conversion related warnings were in
      this category. (A second patch enabling some of the sign
      warnings might be welcome - sign bugs can be nasty.)
      
      I also kept warnings that seem to make sense from their manpage
      description and which produced no actual warnings on our code
      base. These warnings might still be turned off if they end up
      being a nuisance.
      
      I also left out a few warnings that are not supported in older
      compilers.
      
      [ Note that these changes might break the build on older
        compilers i did not test, or on non-x86 architectures that
        produce different warnings, so more testing would be welcome. ]
      
      Reported-by: Valdis.Kletnieks@vt.edu
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      83a0944f
  5. 12 8月, 2009 3 次提交
    • A
      perf tools: Fix dso__new handle() to handle deleted DSOs · 1340e6bb
      Arnaldo Carvalho de Melo 提交于
      It is better than showing the map addr, this way at least we
      know that we can't get the symtabs because the DSO was deleted
      (system update) while an app still used such DSO.
      
      Yeah, don't do that, but if you do, you'll figure it out
      quicker this way.
      
      [acme@doppio linux-2.6-tip]$ perf report | head -15
       # Samples: 3796
       #
       # Overhead  Command                                                        Shared Object  Symbol
       # ........  .......  ...................................................................  ......
       #
          23.55%   pidgin  /lib64/libglib-2.0.so.0.2000.4.#prelink#.Pd98lu (deleted)            [.] 0x00000000038844
          21.55%   pidgin  /lib64/libpthread-2.10.1.so.#prelink#.AFwK8Q (deleted)               [.] 0x0000000000a42d
          10.85%   pidgin  [kernel]                                                             [.] vread_hpet
           7.85%   pidgin  /lib64/libgobject-2.0.so.0.2000.4.#prelink#.o1vpU7 (deleted)         [.] 0x00000000014de8
           3.35%   pidgin  /lib64/libc-2.10.1.so (deleted)                                      [.] 0x0000000007a875
           3.19%   pidgin  /lib64/libdbus-1.so.3.4.0.#prelink#.6mwgZP (deleted)                 [.] 0x0000000001d254
           3.06%   pidgin  /usr/lib64/libgtk-x11-2.0.so.0.1600.5.#prelink#.511hAl (deleted)     [.] 0x000000002334e7
           2.90%   pidgin  /usr/lib64/libgdk-x11-2.0.so.0.1600.5.#prelink#.5qlMo1 (deleted)     [.] 0x00000000037b2d
           1.84%   pidgin  [kernel]                                                             [k] do_sys_poll
           1.45%   pidgin  /usr/lib64/libX11.so.6.2.0.#prelink#.iR59Rx (deleted)                [.] 0x0000000004c751
      [acme@doppio linux-2.6-tip]$
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Luis Claudio R. Gonçalves <lclaudio@redhat.com>
      Cc: Clark Williams <williams@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20090811200436.GA3478@ghostprotocols.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1340e6bb
    • A
      perf tools: Fix fallback to cplus_demangle() when bfd_demangle() is not available · 247648e3
      Arnaldo Carvalho de Melo 提交于
      In old binutils we can't access bfd_demangle(), use
      cplus_demangle() just like oprofile.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Luis Claudio R. Gonçalves <lclaudio@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20090811192211.GG18061@ghostprotocols.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      247648e3
    • F
      perf tools: Factorize high level dso helpers · cd84c2ac
      Frederic Weisbecker 提交于
      Factorize multiple definitions of high level dso helpers into the
      symbol source file.
      
      The side effect is a general export of the verbose and eprintf
      debugging helpers into a new file dedicated to debugging purposes.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Brice Goglin <Brice.Goglin@inria.fr>
      cd84c2ac
  6. 09 8月, 2009 1 次提交
    • A
      perf report: Add debug help for the finding of symbol bugs - show the symtab... · 94cb9e38
      Arnaldo Carvalho de Melo 提交于
      perf report: Add debug help for the finding of symbol bugs - show the symtab origin (DSO, build-id, kernel, etc)
      
      Used with perf report --verbose:
      
      [acme@doppio linux-2.6-tip]$ perf report -v | head -16
           5.17%  firefox  /usr/lib64/xulrunner-1.9.1/libxul.so   0x00000000005d8eee f [.] imgContainer::DrawFrameTo(gfxIImageFrame*, gfxIImageFrame*, nsRect&)
           2.56%  firefox  /lib64/libpthread-2.10.1.so            0x0000000000008e02 d [.] __pthread_mutex_lock_internal
           1.94%  firefox  /usr/lib64/xulrunner-1.9.1/libxul.so   0x0000000000d0af8f f [.] SearchTable
           1.75%  firefox  [kernel]                               0xffffffffff60013b k [.] vread_hpet
           1.63%  firefox  /lib64/libpthread-2.10.1.so            0x000000000000a404 d [.] __pthread_mutex_unlock
           1.47%  firefox  /usr/lib64/xulrunner-1.9.1/libmozjs.so 0x00000000000482ea f [.] js_Interpret
           1.42%  firefox  /usr/lib64/xulrunner-1.9.1/libmozjs.so 0x000000000003eda3 f [.] JS_CallTracer
           1.24%  firefox  [kernel]                               0xffffffff8102ca4a k [k] read_hpet
           1.16%  firefox  [kernel]                               0xffffffff810f3dd4 k [k] fget_light
           1.11%  firefox  /usr/lib64/xulrunner-1.9.1/libmozjs.so 0x00000000000567ff f [.] js_TraceObject
           0.98%  firefox  /usr/lib64/firefox-3.5.2/firefox       0x000000000000dd23 b [.] arena_ralloc
      [acme@doppio linux-2.6-tip]$
      
      The new field is just after the symbol address. To help in
      figuring out symbol resolution bugs.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      94cb9e38
  7. 07 8月, 2009 1 次提交
    • A
      perf symbol: Fix symbol parsing in certain cases: use the build-id as a symlink · 4d1e00a8
      Arnaldo Carvalho de Melo 提交于
      In some cases distros have binaries and debuginfo in weird places:
      
      [root@doppio tuna]# ls -la /usr/lib64/{xulrunner-1.9.1/xulrunner-stub,firefox-3.5.2/firefox}
      -rwxr-xr-x 1 root root 90024 2009-08-03 19:45 /usr/lib64/firefox-3.5.2/firefox
      -rwxr-xr-x 1 root root 90024 2009-08-03 18:23 /usr/lib64/xulrunner-1.9.1/xulrunner-stub
      [root@doppio tuna]# sha1sum /usr/lib64/{xulrunner-1.9.1/xulrunner-stub,firefox-3.5.2/firefox}
      19a858077d263d5de22c9c5da250d3e4396ae739  /usr/lib64/xulrunner-1.9.1/xulrunner-stub
      19a858077d263d5de22c9c5da250d3e4396ae739  /usr/lib64/firefox-3.5.2/firefox
      [root@doppio tuna]# rpm -qf /usr/lib64/{xulrunner-1.9.1/xulrunner-stub,firefox-3.5.2/firefox}
      xulrunner-1.9.1.2-1.fc11.x86_64
      firefox-3.5.2-2.fc11.x86_64
      [root@doppio tuna]# ls -la /usr/lib/debug/{usr/lib64/xulrunner-1.9.1/xulrunner-stub,usr/lib64/firefox-3.5.2/firefox}.debug
      ls: cannot access /usr/lib/debug/usr/lib64/firefox-3.5.2/firefox.debug: No such file or directory
      -rwxr-xr-x 1 root root 403608 2009-08-03 18:22 /usr/lib/debug/usr/lib64/xulrunner-1.9.1/xulrunner-stub.debug
      
      Seemingly we don't have a .symtab when we actually can find it
      if we use the .note.gnu.build-id ELF section put in place by
      some distros. Use it and find the symbols we need.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      4d1e00a8
  8. 05 8月, 2009 1 次提交
    • P
      perf: Auto-detect libbfd · 2cdbc46d
      Peter Zijlstra 提交于
      Since the C++ demangling isn't needed for everybody and
      bfd/iberty aren't widely/easily available on all machines, make
      it optional.
      
      It also allows you to forcefully disable demangling by using
      NO_DEMANGLE=1 and otherwise tries to detect libbfd/libiberty
      combinations that result in a compiling demangler.
      Reported-by: NJens Axboe <jens.axboe@oracle.com>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Kyle McMartin <kyle@mcmartin.ca>
      LKML-Reference: <20090801082048.GX12579@kernel.dk>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      2cdbc46d
  9. 02 8月, 2009 1 次提交
    • S
      perf tools: Fix faulty check · 9b30a26b
      Stoyan Gaydarov 提交于
      This patch fixes a spelling error that has resulted from copy
      and pasting. The location of the error was found using a
      semantic patch but the semantic patch was not trying to find
      these errors. After looking things over it seemed logical that
      this change was needed. Please review it and then include the
      patch if it is in fact the correct change.
      Signed-off-by: NStoyan Gaydarov <sgayda2@uiuc.edu>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1248949529-20891-1-git-send-email-sgayda2@uiuc.edu>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      9b30a26b
  10. 23 7月, 2009 2 次提交
    • M
      perf_counter tools: Fix vmlinux symbol generation breakage · d20ff6bd
      Mike Galbraith 提交于
      vmlinux meets the criteria for symbol adjustment, which breaks vmlinux generated symbols.
      Fix this by exempting vmlinux.  This is a bit fragile in that someone could change the
      kernel dso's name, but currently that name is also hardwired.
      Signed-off-by: NMike Galbraith <efault@gmx.de>
      Cc: Ingo Molnar <mingo@elte.hu>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <1248091298.18702.18.camel@marge.simson.net>
      d20ff6bd
    • A
      perf symbol: C++ demangling · 28ac909b
      Arnaldo Carvalho de Melo 提交于
      [acme@doppio ~]$ perf report -s comm,dso,symbol -C firefox -d /usr/lib64/xulrunner-1.9.1/libxul.so | grep :: | head
           2.21%  [.] nsDeque::Push(void*)
           1.78%  [.] GraphWalker::DoWalk(nsDeque&)
           1.30%  [.] GCGraphBuilder::AddNode(void*, nsCycleCollectionParticipant*)
           1.27%  [.] XPCWrappedNative::CallMethod(XPCCallContext&, XPCWrappedNative::CallMode)
           1.18%  [.] imgContainer::DrawFrameTo(gfxIImageFrame*, gfxIImageFrame*, nsRect&)
           1.13%  [.] nsDeque::PopFront()
           1.11%  [.] nsGlobalWindow::RunTimeout(nsTimeout*)
           0.97%  [.] nsXPConnect::Traverse(void*, nsCycleCollectionTraversalCallback&)
           0.95%  [.] nsJSEventListener::cycleCollection::Traverse(void*, nsCycleCollectionTraversalCallback&)
           0.95%  [.] nsCOMPtr_base::~nsCOMPtr_base()
      [acme@doppio ~]$
      
      Cc: Pekka Enberg <penberg@cs.helsinki.fi>
      Cc: Vegard Nossum <vegard.nossum@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Suggested-by: NClark Williams <williams@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <20090720171412.GB10410@ghostprotocols.net>
      28ac909b
  11. 12 7月, 2009 1 次提交
    • A
      perf_counter tools: PLT info is stripped in -debuginfo packages · a25e46c4
      Arnaldo Carvalho de Melo 提交于
      So we need to get the richer .symtab from the debuginfo
      packages but the PLT info from the original DSO where we have
      just the leaner .dynsym symtab.
      
      Example:
      
      | [acme@doppio pahole]$ perf report --sort comm,dso,symbol > before
      | [acme@doppio pahole]$ perf report --sort comm,dso,symbol > after
      | [acme@doppio pahole]$ diff -U1 before after
      | --- before	2009-07-11 11:04:22.688595741 -0300
      | +++ after	2009-07-11 11:04:33.380595676 -0300
      | @@ -80,3 +80,2 @@
      |       0.07%  pahole ./build/pahole              [.] pahole_stealer
      | -     0.06%  pahole /usr/lib64/libdw-0.141.so   [.] 0x00000000007140
      |       0.06%  pahole /usr/lib64/libdw-0.141.so   [.] __libdw_getabbrev
      | @@ -91,2 +90,3 @@
      |       0.06%  pahole [kernel]                    [k] free_hot_cold_page
      | +     0.06%  pahole /usr/lib64/libdw-0.141.so   [.] tfind@plt
      |       0.05%  pahole ./build/libdwarves.so.1.0.0 [.] ftype__add_parameter
      | @@ -242,2 +242,3 @@
      |       0.01%  pahole [kernel]                    [k] account_group_user_time
      | +     0.01%  pahole /usr/lib64/libdw-0.141.so   [.] strlen@plt
      |       0.01%  pahole ./build/pahole              [.] strcmp@plt
      | [acme@doppio pahole]$
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <1247325517-12272-4-git-send-email-acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a25e46c4
  12. 11 7月, 2009 1 次提交
    • A
      perf report: Adjust column width to the values sampled · 52d422de
      Arnaldo Carvalho de Melo 提交于
      Auto-adjust column width of perf report output to the
      longest occuring string length.
      
      Example:
      
      [acme@doppio pahole]$  perf report --sort comm,dso,symbol | head -13
      
          12.79%   pahole  /usr/lib64/libdw-0.141.so    [.] __libdw_find_attr
           8.90%   pahole  /lib64/libc-2.10.1.so        [.] _int_malloc
           8.68%   pahole  /usr/lib64/libdw-0.141.so    [.] __libdw_form_val_len
           8.15%   pahole  /lib64/libc-2.10.1.so        [.] __GI_strcmp
           6.80%   pahole  /lib64/libc-2.10.1.so        [.] __tsearch
           5.54%   pahole  ./build/libdwarves.so.1.0.0  [.] tag__recode_dwarf_type
      [acme@doppio pahole]$
      
      [acme@doppio pahole]$  perf report --sort comm,dso,symbol -d /lib64/libc-2.10.1.so | head -10
      
          21.92%   pahole  /lib64/libc-2.10.1.so  [.] _int_malloc
          20.08%   pahole  /lib64/libc-2.10.1.so  [.] __GI_strcmp
          16.75%   pahole  /lib64/libc-2.10.1.so  [.] __tsearch
      [acme@doppio pahole]$
      
      Also add these extra options to control the new behaviour:
      
        -w, --field-width
      
      Force each column width to the provided list, for large terminal
      readability.
      
        -t, --field-separator:
      
      Use a special separator character and don't pad with spaces, replacing
      all occurances of this separator in symbol names (and other output) with
      a '.' character, that thus it's the only non valid separator.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <20090711014728.GH3452@ghostprotocols.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      52d422de
  13. 03 7月, 2009 1 次提交
    • A
      perf_counter tools: Adjust symbols in ET_EXEC files too · 30d7a77d
      Arnaldo Carvalho de Melo 提交于
      Ingo Molnar wrote:
      
      > i just bisected a 'perf report' bug that would cause us to not
      > resolve all user-space symbols in a 'git gc' run to:
      >
      > f5812a7a is first bad commit
      > commit f5812a7a
      > Author: Arnaldo Carvalho de Melo <acme@redhat.com>
      > Date:   Tue Jun 30 11:43:17 2009 -0300
      >
      >     perf_counter tools: Adjust only prelinked symbol's addresses
      
      Rename ->prelinked to ->adjust_symbols and making what was done
      only for prelinked libraries also to ET_EXEC binaries, such as
      /usr/bin/git:
      
      [acme@doppio pahole]$ readelf -h /usr/bin/git | grep Type
        Type:                              EXEC (Executable file)
      [acme@doppio pahole]$
      
      And after installing the 'git-debuginfo' package, I get correct results:
      
      [acme@doppio linux-2.6-tip]$ perf report --sort comm,dso,symbol -d /usr/bin/git | head -20
      
       #
       # (1139614 samples)
       #
       # Overhead           Command  Shared Object              Symbol
       # ........  ................  .........................  ......
       #
          34.98%               git  /usr/bin/git               [.] send_sideband
          33.39%               git  /usr/bin/git               [.] enter_repo
           6.81%               git  /usr/bin/git               [.] diff_opt_parse
           4.95%               git  /usr/bin/git               [.] is_repository_shallow
           3.24%               git  /usr/bin/git               [.] odb_mkstemp
           1.39%               git  /usr/bin/git               [.] output
           1.34%               git  /usr/bin/git               [.] xmmap
           1.25%               git  /usr/bin/git               [.] receive_pack_config
           1.16%               git  /usr/bin/git               [.] git_pathdup
           0.90%               git  /usr/bin/git               [.] read_object_with_reference
           0.86%               git  /usr/bin/git               [.] show_patch_diff
           0.85%               git  /usr/bin/git               0x00000000095e2e
           0.69%               git  /usr/bin/git               [.] display
      [acme@doppio linux-2.6-tip]$
      
      I'll check what are the last cases where we can't resolve symbols, like
      this 0x00000000095e2e later.
      
      And I guess this will fix the problems Mike were seeing too:
      
       [acme@doppio linux-2.6-tip]$ readelf -h ../build/perf/vmlinux | grep Type
         Type:                              EXEC (Executable file)
       [acme@doppio linux-2.6-tip]$
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      30d7a77d
  14. 02 7月, 2009 2 次提交
  15. 30 6月, 2009 1 次提交
    • A
      perf_counter tools: Adjust only prelinked symbol's addresses · f5812a7a
      Arnaldo Carvalho de Melo 提交于
      I.e. we can't handle these two kinds of files in the same way:
      
      1) prelinked system library:
      
      [acme@doppio pahole]$ readelf -s /usr/lib64/libdw-0.141.so | egrep 'FUNC.+GLOBAL.+dwfl_report_elf'
         278: 00000030450105a0   261 FUNC    GLOBAL DEFAULT   12 dwfl_report_elf@@ELFUTILS_0.122
      
      2) not prelinked library with debug information from a -debuginfo package:
      
      [acme@doppio pahole]$ readelf -s /usr/lib/debug/usr/lib64/libdw-0.141.so.debug | egrep 'FUNC.+GLOBAL.+dwfl_report_elf'
         629: 00000000000105a0   261 FUNC    GLOBAL DEFAULT   12 dwfl_report_elf
      [acme@doppio pahole]$
      
      Now the numbers I got for a pahole perf run are in line with
      the numbers I get from oprofile.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20090630144317.GB12663@ghostprotocols.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f5812a7a
  16. 22 6月, 2009 1 次提交
  17. 21 6月, 2009 1 次提交
    • I
      perf_counter tools: Fix vmlinux fallback when running on a different kernel · c1f47b45
      Ingo Molnar 提交于
      Lucas De Marchi reported that perf report and perf annotate
      displays mismatching profile if a perf.data is analyzed on
      an older kernel - even if the correct vmlinux is specified
      via the -k option.
      
      The reason is the fallback path in util/symbol.c:dso__load_kernel():
      
      int dso__load_kernel(struct dso *self, const char *vmlinux,
                           symbol_filter_t filter, int verbose)
      {
              int err = -1;
      
              if (vmlinux)
                      err = dso__load_vmlinux(self, vmlinux, filter, verbose);
      
              if (err)
                      err = dso__load_kallsyms(self, filter, verbose);
      
              return err;
      }
      
      dso__load_vmlinux() returns negative on error, but on success it
      returns the number of symbols loaded - which confuses the function
      to load the kallsyms.
      
      This is normally harmless, as reporting is usually performed on the
      same kernel that is analyzed - but if there's a mismatch then we
      load the wrong kallsyms and create a non-sensical symbol tree.
      
      The fix is to only fall back to kallsyms on errors.
      Reported-by: NLucas De Marchi <lucas.de.marchi@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c1f47b45
  18. 20 6月, 2009 1 次提交
    • P
      perf_counter tools: Define and use our own u64, s64 etc. definitions · 9cffa8d5
      Paul Mackerras 提交于
      On 64-bit powerpc, __u64 is defined to be unsigned long rather than
      unsigned long long.  This causes compiler warnings every time we
      print a __u64 value with %Lx.
      
      Rather than changing __u64, we define our own u64 to be unsigned long
      long on all architectures, and similarly s64 as signed long long.
      For consistency we also define u32, s32, u16, s16, u8 and s8.  These
      definitions are put in a new header, types.h, because these definitions
      are needed in util/string.h and util/symbol.h.
      
      The main change here is the mechanical change of __[us]{64,32,16,8}
      to remove the "__".  The other changes are:
      
      * Create types.h
      * Include types.h in perf.h, util/string.h and util/symbol.h
      * Add types.h to the LIB_H definition in Makefile
      * Added (u64) casts in process_overflow_event() and print_sym_table()
        to kill two remaining warnings.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: benh@kernel.crashing.org
      LKML-Reference: <19003.33494.495844.956580@cargo.ozlabs.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      9cffa8d5
  19. 11 6月, 2009 1 次提交
    • I
      perf_counter tools: Clean up u64 usage · 729ff5e2
      Ingo Molnar 提交于
      A build error slipped in:
      
       builtin-report.c: In function ‘hist_entry__fprintf’:
       builtin-report.c:711: error: format ‘%12d’ expects type ‘int’, but argument 3 has type ‘uint64_t’
      
      Because we got a bit sloppy with those types. uint64_t really sucks,
      because there's no printf format for it. So standardize on __u64
      instead - for all types that go to or come from the ABI (which is __u64),
      or for values that need to be large enough even on 32-bit.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      729ff5e2
  20. 09 6月, 2009 1 次提交
    • P
      perf report: Add support for profiling JIT generated code · 80d496be
      Pekka Enberg 提交于
      This patch adds support for profiling JIT generated code to 'perf
      report'. A JIT compiler is required to generate a "/tmp/perf-$PID.map"
      symbols map that is parsed when looking and displaying symbols.
      
      Thanks to Peter Zijlstra for his help with this patch!
      
      Example "perf report" output with the Jato JIT:
      
       #
       # (40311 samples)
       #
       # Overhead           Command  Shared Object              Symbol
       # ........  ................  .........................  ......
       #
           97.80%              jato  /tmp/perf-11915.map        [.] Fibonacci.fib(I)I
            0.56%              jato  00000000b7fa023b           0x000000b7fa023b
            0.45%              jato  /tmp/perf-11915.map        [.] Fibonacci.main([Ljava/lang/String;)V
            0.38%              jato  [kernel]                   [k] get_page_from_freelist
            0.06%              jato  [kernel]                   [k] kunmap_atomic
            0.05%              jato  ./jato                     [.] utf8Hash
            0.04%              jato  ./jato                     [.] executeJava
            0.04%              jato  ./jato                     [.] defineClass
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NPekka Enberg <penberg@cs.helsinki.fi>
      Cc: a.p.zijlstra@chello.nl
      Cc: acme@redhat.com
      LKML-Reference: <Pine.LNX.4.64.0906082111590.12407@melkki.cs.Helsinki.FI>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      80d496be
  21. 07 6月, 2009 4 次提交
    • A
      perf_counter tools: Initialize a stack variable before use · e9fbc9dc
      Arjan van de Ven 提交于
      the "perf report" utility crashed in some circumstances
      because the "sym" stack variable was not initialized before used
      (as also proven by valgrind).
      
      With this fix both the crash goes away and valgrind no longer complains.
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      e9fbc9dc
    • A
      perf_counter tools: Warning fixes on 32-bit · 7d37a0cb
      Arjan van de Ven 提交于
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      7d37a0cb
    • I
      perf_counter tools: Move from Documentation/perf_counter/ to tools/perf/ · 86470930
      Ingo Molnar 提交于
      Several people have suggested that 'perf' has become a full-fledged
      tool that should be moved out of Documentation/. Move it to the
      (new) tools/ directory.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      86470930
    • I
      perf_counter tools: Add 'perf annotate' feature · 0b73da3f
      Ingo Molnar 提交于
      Add new perf sub-command to display annotated source code:
      
       $ perf annotate decode_tree_entry
      
      ------------------------------------------------
       Percent |	Source code & Disassembly of /home/mingo/git/git
      ------------------------------------------------
               :
               :	/home/mingo/git/git:     file format elf64-x86-64
               :
               :
               :	Disassembly of section .text:
               :
               :	00000000004a0da0 <decode_tree_entry>:
               :		*modep = mode;
               :		return str;
               :	}
               :
               :	static void decode_tree_entry(struct tree_desc *desc, const char *buf, unsigned long size)
               :	{
          3.82 :	  4a0da0:	41 54                	push   %r12
               :		const char *path;
               :		unsigned int mode, len;
               :
               :		if (size < 24 || buf[size - 21])
          0.17 :	  4a0da2:	48 83 fa 17          	cmp    $0x17,%rdx
               :		*modep = mode;
               :		return str;
               :	}
               :
               :	static void decode_tree_entry(struct tree_desc *desc, const char *buf, unsigned long size)
               :	{
          0.00 :	  4a0da6:	49 89 fc             	mov    %rdi,%r12
          0.00 :	  4a0da9:	55                   	push   %rbp
          3.37 :	  4a0daa:	53                   	push   %rbx
               :		const char *path;
               :		unsigned int mode, len;
               :
               :		if (size < 24 || buf[size - 21])
          0.08 :	  4a0dab:	76 73                	jbe    4a0e20 <decode_tree_entry+0x80>
          0.00 :	  4a0dad:	80 7c 16 eb 00       	cmpb   $0x0,-0x15(%rsi,%rdx,1)
          3.48 :	  4a0db2:	75 6c                	jne    4a0e20 <decode_tree_entry+0x80>
               :	static const char *get_mode(const char *str, unsigned int *modep)
               :	{
               :		unsigned char c;
               :		unsigned int mode = 0;
               :
               :		if (*str == ' ')
          1.94 :	  4a0db4:	0f b6 06             	movzbl (%rsi),%eax
          0.39 :	  4a0db7:	3c 20                	cmp    $0x20,%al
          0.00 :	  4a0db9:	74 65                	je     4a0e20 <decode_tree_entry+0x80>
               :			return NULL;
               :
               :		while ((c = *str++) != ' ') {
          0.06 :	  4a0dbb:	89 c2                	mov    %eax,%edx
               :			if (c < '0' || c > '7')
          1.99 :	  4a0dbd:	31 ed                	xor    %ebp,%ebp
               :		unsigned int mode = 0;
               :
               :		if (*str == ' ')
               :			return NULL;
               :
               :		while ((c = *str++) != ' ') {
          1.74 :	  4a0dbf:	48 8d 5e 01          	lea    0x1(%rsi),%rbx
               :			if (c < '0' || c > '7')
          0.00 :	  4a0dc3:	8d 42 d0             	lea    -0x30(%rdx),%eax
          0.17 :	  4a0dc6:	3c 07                	cmp    $0x7,%al
          0.00 :	  4a0dc8:	76 0d                	jbe    4a0dd7 <decode_tree_entry+0x37>
          0.00 :	  4a0dca:	eb 54                	jmp    4a0e20 <decode_tree_entry+0x80>
          0.00 :	  4a0dcc:	0f 1f 40 00          	nopl   0x0(%rax)
         16.57 :	  4a0dd0:	8d 42 d0             	lea    -0x30(%rdx),%eax
          0.14 :	  4a0dd3:	3c 07                	cmp    $0x7,%al
          0.00 :	  4a0dd5:	77 49                	ja     4a0e20 <decode_tree_entry+0x80>
               :				return NULL;
               :			mode = (mode << 3) + (c - '0');
          3.12 :	  4a0dd7:	0f b6 c2             	movzbl %dl,%eax
               :		unsigned int mode = 0;
               :
               :		if (*str == ' ')
               :			return NULL;
               :
               :		while ((c = *str++) != ' ') {
          0.00 :	  4a0dda:	0f b6 13             	movzbl (%rbx),%edx
         16.74 :	  4a0ddd:	48 83 c3 01          	add    $0x1,%rbx
               :			if (c < '0' || c > '7')
               :				return NULL;
               :			mode = (mode << 3) + (c - '0');
      
      The first column is the percentage of samples that arrived on that
      particular line - relative to the total cost of the function.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0b73da3f
  22. 05 6月, 2009 1 次提交
  23. 04 6月, 2009 2 次提交
    • I
      perf_counter tools: Print out symbol parsing errors only if --verbose · bd74137e
      Ingo Molnar 提交于
      Also, add a suggestion to 'perf report', if the default sort order is
      used.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      bd74137e
    • A
      perf_counter tools: Fix off-by-one bug in symbol__new · 18374ab7
      Arnaldo Carvalho de Melo 提交于
      The end is really (start + len - 1). Noticed when synthesizing
      the PLT symbols, that are small (16 bytes), and hot on the
      start RIP.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      LKML-Reference: <20090603174921.GG7805@ghostprotocols.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      18374ab7
  24. 03 6月, 2009 1 次提交
    • A
      perf_counter tools: Cover PLT symbols too · 8ce998d6
      Arnaldo Carvalho de Melo 提交于
      PLT, the Program Linking Table, is used with the dynamic linker to
      allow PIC code in executables and shared objects to figure out
      where functions are in other shared objects.
      
      It is one of the sources of unknown/unresolved symbols - this patch
      does what binutils figures out when you ask it to disassembly.
      (objdump -S)
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Stephane Eranian <eranian@googlemail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      8ce998d6
  25. 02 6月, 2009 2 次提交
    • A
      perf_counter tools: Add missing rb_erase in dso__delete_symbols · c8c96525
      Arnaldo Carvalho de Melo 提交于
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20090601205057.GB7805@ghostprotocols.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c8c96525
    • A
      perf_counter tools: Use hex2u64 in more places · a0055ae2
      Arnaldo Carvalho de Melo 提交于
      This has also a nice side effect, tools built on newer systems such as
      fedora 10 again work on systems with older versions of glibc:
      
      My workstation:
      
      [acme@doppio ~]$ rpm -q glibc.x86_64
      glibc-2.9-3.x86_64
      
      Test machine:
      
      [acme@emilia ~]$ rpm -q glibc.x86_64
      glibc-2.5-24
      
      Before:
      
      [acme@emilia ~]$ perf
      perf: /lib64/libc.so.6: version `GLIBC_2.7' not found (required by perf)
      [acme@emilia ~]$ nm `which perf` | grep GLIBC_2\.7
                       U __isoc99_sscanf@@GLIBC_2.7
      [acme@emilia ~]$
      
      After:
      [acme@emilia ~]$ perf
      usage: perf [--version] [--help] COMMAND [ARGS]
      
      The most commonly used perf commands are:
         record   Run a command and record its profile into perf.data
         report   Read perf.data (created by perf record) and display the
      profile
         stat     Run a command and gather performance counter statistics
         top      Run a command and profile it
      
      See 'perf help COMMAND' for more information on a specific command.
      [acme@emilia ~]$ nm `which perf` | grep GLIBC_2\.7
      [acme@emilia ~]$
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20090601205019.GA7805@ghostprotocols.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a0055ae2
  26. 29 5月, 2009 4 次提交