1. 31 1月, 2010 4 次提交
    • H
      perf lock: Introduce new tool "perf lock", for analyzing lock statistics · 9b5e350c
      Hitoshi Mitake 提交于
      Adding new subcommand "perf lock" to perf.
      
      I have a lot of remaining ToDos, but for now perf lock can
      already provide minimal functionality for analyzing lock
      statistics.
      Signed-off-by: NHitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1264851813-8413-12-git-send-email-mitake@dcl.info.waseda.ac.jp>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      9b5e350c
    • H
      perf: Add util/include/linuxhash.h to include hash.h of kernel · 18e97e06
      Hitoshi Mitake 提交于
      linux/hash.h, hash header of kernel, is also useful for perf.
      
      util/include/linuxhash.h includes linux/hash.h, so we can use
      hash facilities (e.g. hash_long()) in perf now.
      Signed-off-by: NHitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1264851813-8413-3-git-send-email-mitake@dcl.info.waseda.ac.jp>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      18e97e06
    • H
      perf tools: Add __data_loc support · 86d8d296
      Hitoshi Mitake 提交于
      This patch is required to test the next patch for perf lock.
      
      At 064739bc ,
      support for the modifier "__data_loc" of format is added.
      
      But, when I wanted to parse format of lock_acquired (or some
      event else), raw_field_ptr() did not returned correct pointer.
      
      So I modified raw_field_ptr() like this patch. Then
      raw_field_ptr() works well.
      Signed-off-by: NHitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Steven Rostedt <srostedt@redhat.com>
      LKML-Reference: <1264851813-8413-2-git-send-email-mitake@dcl.info.waseda.ac.jp>
      [ v3: fixed minor stylistic detail ]
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      86d8d296
    • H
      Revert "perf record: Intercept all events" · a8e6f734
      Hitoshi Mitake 提交于
      This reverts commit f5a2c3dc.
      
      This patch is required for making "perf lock rec" work.
      The commit f5a2c3dc changes write_event() of builtin-record.c
      . And changed write_event() sometimes doesn't stop with perf
      lock rec.
      
      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>
      [ that commit also causes perf record to not be Ctrl-C-able,
        and it's concetually wrong to parse the data at record time
        (unconditionally - even when not needed), as we eventually
        want to be able to do zero-copy recording, at least for
        non-archive recordings.  ]
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a8e6f734
  2. 29 1月, 2010 6 次提交
  3. 27 1月, 2010 7 次提交
  4. 21 1月, 2010 1 次提交
    • A
      perf buildid-cache: Add new command to manage build-id cache · ef12a141
      Arnaldo Carvalho de Melo 提交于
      For now it just has operations to examine a given file, find its
      build-id and add or remove it to/from the cache.
      
      Useful, for instance, when adding binaries sent together with a
      perf.data file, so that we can add them to the cache and have
      the tools find it when resolving symbols.
      
      It'll also manage the size of the cache like 'ccache' does.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric 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: <1264008525-29025-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ef12a141
  5. 20 1月, 2010 6 次提交
  6. 17 1月, 2010 3 次提交
    • H
      perf probe: Fix build error of builtin-probe.c · 0eda7385
      Hitoshi Mitake 提交于
      I got this build error when building tip tree:
      
      | cc1: warnings being treated as errors
      | builtin-probe.c:123: error: 'opt_show_lines' defined but not used
      
      This error is caused by:
      
      | #ifndef NO_LIBDWARF
      |	OPT_CALLBACK('L', "line", NULL,
      |		     "FUNC[:RLN[+NUM|:RLN2]]|SRC:ALN[+NUM|:ALN2]",
      |		     "Show source code lines.", opt_show_lines),
      | #endif
      
      My environment defines NO_LIBDWARF, so gcc treated
      opt_show_lines() as garbage. So I moved opt_show_lines() into
      #ifndef NO_LIBDWARF ... #endif block.
      Signed-off-by: NHitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <1263645076-9993-1-git-send-email-mitake@dcl.info.waseda.ac.jp>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0eda7385
    • F
      perf: Fix implicit declaration of getline in util.c · 69e3f52d
      Frederic Weisbecker 提交于
      getline() is considered as undeclared in util/util.c because
      it includes string.h, that in turn includes stdio.h, without
      having defined _GNU_SOURCE.
      
      But util.c also includes util.h that handles the _GNU_SOURCE and
      all the needed inclusions already. Let's include only util.h
      and sys/mman.h which is the only one header not handled by
      util.h
      
      This fixes the following build error:
      
       util/util.c: In function 'slow_copyfile':
       util/util.c:49: erreur: implicit declaration of function
       'getline' util/util.c:49: erreur: nested extern declaration of 'getline'
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1263648075-3858-1-git-send-regression-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      69e3f52d
    • A
      perf timechart: Use tid not pid for COMM change · 8f06d7e6
      Arjan van de Ven 提交于
      A process that changes its comm field, does this on a per kernel
      task struct basis. The timechart tool used, incorrectly, the pid
      to track this, and should have used the tid instead...
      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>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      CC: <stable@kernel.org>
      LKML-Reference: <20100116125319.34ac3edd@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      8f06d7e6
  7. 16 1月, 2010 13 次提交
    • A
      perf symbols: Accept an alias when looking for "_text" · 881516eb
      Arnaldo Carvalho de Melo 提交于
      As it is in PARISC64:
      
      parisc:~# uname -a
      Linux parisc 2.6.33-rc4-tip+ #1 SMP Thu Jan 14 13:33:34 BRST
      2010 parisc64 GNU/Linux parisc:~# grep -w _text /proc/kallsyms
      0000000040100000 A _text
      parisc:~# grep 0000000040100000 /proc/kallsyms
      0000000040100000 T stext
      0000000040100000 T _stext
      0000000040100000 A _text
      parisc:~#
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric 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: <1263586107-1756-2-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      881516eb
    • A
      perf record: Intercept all events · f5a2c3dc
      Arnaldo Carvalho de Melo 提交于
      The event interception we need to do in 'perf record' to create
      a list of all DSOs in PERF_RECORD_MMAP events wasn't seeing all
      events, make sure that happens by checking size agains
      event_t->header.size.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric 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: <1263586107-1756-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f5a2c3dc
    • A
      perf archive: Add helper script to package files needed to do analysis · 2c585174
      Arnaldo Carvalho de Melo 提交于
      It uses 'perf buildid-list --with-hits' to create a tarball with
      what is needed to have in the destination machine ~/.debug
      hierarchy to properly decode the perf.data file specified.
      
      Here is an example where a perf.data file collected on a x86-64
      machine running Fedora 12 is used and then the data is packaged,
      transferred and decoded on a PARISC64 machine running Debian
      Testing, 32-bit userspace:
      
      [root@doppio linux-2.6-tip]# uname -a
      Linux doppio.ghostprotocols.net 2.6.33-rc4-tip+ #3 SMP Wed Jan 13 11:58:15 BRST 2010 x86_64 x86_64 x86_64 GNU/Linux
      [root@doppio linux-2.6-tip]# perf archive
      [root@doppio linux-2.6-tip]# ls -la perf.data*
      -rw------- 1 root root  737696 2010-01-14 23:36 perf.data
      -rw-r--r-- 1 root root 8840025 2010-01-15 12:27 perf.data.tar.bz2
      [root@doppio linux-2.6-tip]# scp perf.data.* parisc64:.
      Password:
      perf.data.tar.bz2                                      100% 8633KB   1.4MB/s   00:06
      [root@doppio linux-2.6-tip]# ssh parisc64
      Password:
      Linux parisc 2.6.19-g2bbf29ac-dirty #1 Sun Dec 3 17:24:04 BRST 2006 parisc64
      
      The programs included with the Debian GNU/Linux system are free software;
      the exact distribution terms for each program are described in the
      individual files in /usr/share/doc/*/copyright.
      
      Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
      permitted by applicable law.
      Last login: Thu Jan 14 11:23:24 2010 from d
      parisc:~# uname -a
      Linux parisc 2.6.19-g2bbf29ac-dirty #1 Sun Dec 3 17:24:04 BRST 2006 parisc64 GNU/Linux
      parisc:~# mkdir .debug
      parisc:~# tar xvf perf.data.tar.bz2 -C ~/.debug
      tar: Record size = 8 blocks
      .build-id/74/f9930ee94475b6b3238caf3725a50d59cb994b
      [kernel.kallsyms]/74f9930ee94475b6b3238caf3725a50d59cb994b
      .build-id/9f/fdcac0a7935922d1f04b6cc9029dfef0f066ef
      lib/modules/2.6.33-rc4-tip+/kernel/arch/x86/crypto/aes-x86_64.ko/9ffdcac0a7935922d1f04b6cc9029dfef0f066ef
      .build-id/3a/af89c32ebfc438ff546c93597d41788e3e65f3
      lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwl3945.ko/3aaf89c32ebfc438ff546c93597d41788e3e65f3
      .build-id/19/f46033f73e1ec612937189bb118c5daba5a0c8
      lib/modules/2.6.33-rc4-tip+/kernel/net/mac80211/mac80211.ko/19f46033f73e1ec612937189bb118c5daba5a0c8
      .build-id/17/72f014a7a7272859655acb0c64a20ab20b75ee
      lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko/1772f014a7a7272859655acb0c64a20ab20b75ee
      .build-id/eb/4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
      lib64/libc-2.10.2.so/eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
      .build-id/5c/68f7afeb33309c78037e374b0deee84dd441f6
      lib64/libpthread-2.10.2.so/5c68f7afeb33309c78037e374b0deee84dd441f6
      .build-id/e9/c9ad5c138ef882e4507d2605645b597da43873
      bin/dbus-daemon/e9c9ad5c138ef882e4507d2605645b597da43873
      .build-id/bc/da7d09eb6c9ee380dae0ed3d591d4311decc31
      lib64/libdbus-1.so.3.4.0/bcda7d09eb6c9ee380dae0ed3d591d4311decc31
      .build-id/7c/c449a77f48b85d6088114000e970ced613bed8
      usr/lib64/libcrypto.so.0.9.8k/7cc449a77f48b85d6088114000e970ced613bed8
      .build-id/fd/d1ccd1ff7917ab020653147ab3bacf0a85b5b9
      lib64/libglib-2.0.so.0.2000.5/fdd1ccd1ff7917ab020653147ab3bacf0a85b5b9
      .build-id/e4/417ebb8762e5f2eee93c8011a71115ff5edad8
      lib64/libgobject-2.0.so.0.2000.5/e4417ebb8762e5f2eee93c8011a71115ff5edad8
      .build-id/93/1e49461f6df99104f0febcc52f6fed5e2efce6
      usr/sbin/sshd/931e49461f6df99104f0febcc52f6fed5e2efce6
      .build-id/da/b5f724c088f89fbd8304da553ed6cb30bbec96
      usr/lib64/libgdk-x11-2.0.so.0.1600.6/dab5f724c088f89fbd8304da553ed6cb30bbec96
      .build-id/f2/037a091ef36b591187a858d75e203690ea9409
      usr/sbin/openvpn/f2037a091ef36b591187a858d75e203690ea9409
      .build-id/a8/e4f743b40fb1fd8b85e2f9b88d93b661472b8f
      bin/find/a8e4f743b40fb1fd8b85e2f9b88d93b661472b8f
      .build-id/81/120aada06e68b1e85882925a0fc6d7345ef59a
      home/acme/bin/perf/81120aada06e68b1e85882925a0fc6d7345ef59a
      parisc:~# perf report 2> /dev/null | head -25
           9.07%             find  find                               [.] 0x0000000000fb0e
           3.29%             perf  libc-2.10.2.so                     [.] __GI_strcmp
           3.19%             find  [kernel.kallsyms]                  [k] _raw_spin_unlock_irqrestore
           2.70%             find  libc-2.10.2.so                     [.] __GI_memmove
           2.62%             perf  [kernel.kallsyms]                  [k] vsnprintf
           2.03%             find  libc-2.10.2.so                     [.] _int_malloc
           2.02%             perf  [kernel.kallsyms]                  [k] format_decode
           1.70%             find  [kernel.kallsyms]                  [k] n_tty_write
           1.70%             find  [kernel.kallsyms]                  [k] half_md4_transform
           1.67%             find  libc-2.10.2.so                     [.] _IO_vfprintf_internal
           1.66%             perf  [kernel.kallsyms]                  [k] audit_free_aux
           1.62%          swapper  [kernel.kallsyms]                  [k] mwait_idle_with_hints
           1.58%             find  [kernel.kallsyms]                  [k] __kmalloc
           1.35%             find  [kernel.kallsyms]                  [k] sched_clock_local
           1.35%             find  [kernel.kallsyms]                  [k] ext4_check_dir_entry
           1.35%             find  [kernel.kallsyms]                  [k] ext4_htree_store_dirent
           1.35%             find  [kernel.kallsyms]                  [k] sys_write
           1.35%             find  [e1000e]                           [k] e1000_clean
           1.35%             find  [kernel.kallsyms]                  [k] _atomic_dec_and_lock
           1.34%             find  [kernel.kallsyms]                  [k] __d_lookup
      parisc:~#
      
      Probably the next step is to have 'perf report' notice that there is a
      perf.data.tar.bz2 file in the same directory and look if it was already
      added to ~/.debug/.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric 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: <1263568672-30323-2-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      2c585174
    • A
      perf symbols: The synthesized kernel modules MMAP must use the pathnames · 460848fc
      Arnaldo Carvalho de Melo 提交于
      Since we use ->long_name in dsos__find now.
      
      Now 'perf buildid_list' is not duplicating those and managing to
      show the proper build-ids for the DSOs with hits:
      
      [root@doppio linux-2.6-tip]# perf buildid-list -H
      74f9930ee94475b6b3238caf3725a50d59cb994b [kernel.kallsyms]
      9ffdcac0a7935922d1f04b6cc9029dfef0f066ef /lib/modules/2.6.33-rc4-tip+/kernel/arch/x86/crypto/aes-x86_64.ko
      3aaf89c32ebfc438ff546c93597d41788e3e65f3 /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwl3945.ko
      19f46033f73e1ec612937189bb118c5daba5a0c8 /lib/modules/2.6.33-rc4-tip+/kernel/net/mac80211/mac80211.ko
      1772f014a7a7272859655acb0c64a20ab20b75ee /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko
      eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 /lib64/libc-2.10.2.so
      5c68f7afeb33309c78037e374b0deee84dd441f6 /lib64/libpthread-2.10.2.so
      e9c9ad5c138ef882e4507d2605645b597da43873 /bin/dbus-daemon
      bcda7d09eb6c9ee380dae0ed3d591d4311decc31 /lib64/libdbus-1.so.3.4.0
      7cc449a77f48b85d6088114000e970ced613bed8 /usr/lib64/libcrypto.so.0.9.8k
      fdd1ccd1ff7917ab020653147ab3bacf0a85b5b9 /lib64/libglib-2.0.so.0.2000.5
      e4417ebb8762e5f2eee93c8011a71115ff5edad8 /lib64/libgobject-2.0.so.0.2000.5
      931e49461f6df99104f0febcc52f6fed5e2efce6 /usr/sbin/sshd
      dab5f724c088f89fbd8304da553ed6cb30bbec96 /usr/lib64/libgdk-x11-2.0.so.0.1600.6
      f2037a091ef36b591187a858d75e203690ea9409 /usr/sbin/openvpn
      a8e4f743b40fb1fd8b85e2f9b88d93b661472b8f /bin/find
      81120aada06e68b1e85882925a0fc6d7345ef59a /home/acme/bin/perf
      [root@doppio linux-2.6-tip]#
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric 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: <1263568672-30323-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      460848fc
    • A
      perf buildid-list: Introduce --with-hits option · 88d3d9b7
      Arnaldo Carvalho de Melo 提交于
      Using this option 'perf buildid-list' will process all samples,
      marking the DSOs that had some hits to list just them.
      
      This in turn will be used by a new porcelain, 'perf archive',
      that will be just a shell script to create a tarball from the
      'perf buildid-list --with-hits' output and the files cached by
      'perf record' in ~/.debug.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric 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: <1263519930-22803-4-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      88d3d9b7
    • A
      perf symbols: Create thread__find_addr_map from thread__find_addr_location · 59ee68ec
      Arnaldo Carvalho de Melo 提交于
      Because some tools will only want to know with maps had hits,
      not needing the full symbol resolution done by
      thread__find_addr_location.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric 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: <1263519930-22803-3-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      59ee68ec
    • A
      perf record: Encode the domain while synthesizing MMAP events · 18c3daa4
      Arnaldo Carvalho de Melo 提交于
      In the past 'perf record' had to process only userspace MMAP
      events, the ones generated in the kernel, but after we reused
      the MMAP events to encode the module mapings we ended up adding
      them first to the list of userspace DSOs (dsos__user) and to the
      kernel one (dsos__kernel).
      
      Fix this by encoding the header.misc field and then using it,
      like other parts to decide the right DSOs list to insert/find.
      
      The gotcha here is that since the kernel puts zero in .misc,
      which isn't PERF_RECORD_MISC_KERNEL (1 << 1), to differentiate,
      we put 1 in .misc.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric 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: <1263519930-22803-2-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      18c3daa4
    • A
      perf symbols: Use dso->long_name in dsos__find() · cf4e5b08
      Arnaldo Carvalho de Melo 提交于
      If not we end up duplicating the module DSOs because first we
      insert them using the short name found in /proc/modules, then,
      when processing synthesized MMAP events we add them again.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric 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: <1263519930-22803-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      cf4e5b08
    • A
      perf symbols: Cache /proc/kallsyms files by build-id · 9e201442
      Arnaldo Carvalho de Melo 提交于
      So that when we don't have a vmlinux handy we can store the
      kallsyms for later use by 'perf report'.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric 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: <1263501006-14185-3-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      9e201442
    • A
      perf symbols: Don't try to load kallsyms if doesn't match the record build-id · 8d0591f6
      Arnaldo Carvalho de Melo 提交于
      Now a perf.data file collected on a x86_64 fedora 12 machine
      gets properly parsed on a Debian testing PARISC64 machine with
      32-bit userland:
      
        acme@parisc:~/git/linux-2.6-tip$ perf report 2> /dev/null | head -15
        # Samples: 293085637
        #
        # Overhead          Command                      Shared Object  Symbol
        # ........  ...............  .................................  ......
        #
            35.11%             find  [kernel.kallsyms]                  [k] 0xffffffff81002b5a
            18.25%             perf  [kernel.kallsyms]                  [k] 0xffffffff8102235f
             9.07%             find  find                               [.] 0x0000000000fb0e
             5.80%          swapper  [kernel.kallsyms]                  [k] 0xffffffff8102235f
             3.29%             perf  libc-2.10.2.so                     [.] __GI_strcmp
             2.70%             find  libc-2.10.2.so                     [.] __GI_memmove
             2.33%             init  [kernel.kallsyms]                  [k] 0xffffffff810091b9
             2.03%             find  libc-2.10.2.so                     [.] _int_malloc
             1.67%             find  libc-2.10.2.so                     [.] _IO_vfprintf_internal
             1.65%             sshd  libcrypto.so.0.9.8k                [.] 0x00000000105440
        acme@parisc:~/git/linux-2.6-tip$
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric 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: <1263501006-14185-2-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      8d0591f6
    • A
      perf tools: Convert getpagesize() uses to sysconf(_SC_GETPAGESIZE) · 1b75962e
      Arnaldo Carvalho de Melo 提交于
      Using the more portable and equivalent sysconf call.
      Reported-by: NAristeu Rozanski <aris@redhat.com>
      Reported-by: NUlrich Drepper <drepper@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Aristeu Rozanski <aris@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Ulrich Drepper <drepper@redhat.com>
      LKML-Reference: <1263501006-14185-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1b75962e
    • A
      perf tools: Cross platform perf.data analysis support · ba21594c
      Arnaldo Carvalho de Melo 提交于
      There are still some problems related to loading vmlinux files,
      but those are unrelated to the feature implemented in this
      patch, so will get fixed in the next patches, but here are some
      results:
      
      1. collect perf.data file on a Fedora 12 machine, x86_64, 64-bit
      userland
      
      2. transfer it to a Debian Testing machine, PARISC64, 32-bit
      userland
      
        acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | head -5
        74f9930ee94475b6b3238caf3725a50d59cb994b [kernel.kallsyms]
        55fdd56670453ea66c011158c4b9d30179c1d049 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/ipt_MASQUERADE.ko
        41adff63c730890480980d5d8ba513f1c216a858 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/iptable_nat.ko
        90a33def1077bb8e97b8a78546dc96c2de62df46 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/nf_nat.ko
        984c7bea90ce1376d5c8e7ef43a781801286e62d /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/tun.ko
      
        acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | tail -5
        22492f3753c6a67de5c7ccbd6b863390c92c0723 /usr/lib64/libXt.so.6.0.0
        353802bb7e1b895ba43507cc678f951e778e4c6f /usr/lib64/libMagickCore.so.2.0.0
        d10c2897558595efe7be8b0584cf7e6398bc776c /usr/lib64/libfprint.so.0.0.0
        a83ecfb519a788774a84d5ddde633c9ba56c03ab /home/acme/bin/perf
        d3ca765a8ecf257d263801d7ad8c49c189082317 /usr/lib64/libdwarf.so.0.0
        acme@parisc:~/git/linux-2.6-tip$
      
        acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm
        The file [kernel.kallsyms] cannot be used, trying to use /proc/kallsyms...
      
        ^^^^ The problem related to vmlinux handling, it shouldn't be trying this
        ^^^^ rather alien /proc/kallsyms at all...
      
        /lib64/libpthread-2.10.2.so with build id 5c68f7afeb33309c78037e374b0deee84dd441f6 not found, continuing without symbols
        /lib64/libc-2.10.2.so with build id eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 not found, continuing without symbols
        /home/acme/bin/perf with build id a83ecfb519a788774a84d5ddde633c9ba56c03ab not found, continuing without symbols
        /usr/sbin/openvpn with build id f2037a091ef36b591187a858d75e203690ea9409 not found, continuing without symbols
        Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko, continuing without symbols
        Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko, continuing without symbols
      
        <SNIP more complaints about not finding the right build-ids,
              those will have to wait for 'perf archive' or plain
              copying what was collected by 'perf record' on the x86_64,
              source machine, see further below for an example of this >
      
        # Samples: 293085637
        #
        # Overhead          Command
        # ........  ...............
        #
            61.70%             find
            23.50%             perf
             5.86%          swapper
             3.12%             sshd
             2.39%             init
             0.87%             bash
             0.86%            sleep
             0.59%      dbus-daemon
             0.25%             hald
             0.24%   NetworkManager
             0.19%  hald-addon-rfki
             0.15%          openvpn
             0.07%             phy0
             0.07%         events/0
             0.05%          iwl3945
             0.05%         events/1
             0.03%      kondemand/0
        acme@parisc:~/git/linux-2.6-tip$
      
      Which matches what we get when running the same command for the
      same perf.data file on the F12, x86_64, source machine:
      
        [root@doppio linux-2.6-tip]# perf report --sort comm
        # Samples: 293085637
        #
        # Overhead          Command
        # ........  ...............
        #
            61.70%             find
            23.50%             perf
             5.86%          swapper
             3.12%             sshd
             2.39%             init
             0.87%             bash
             0.86%            sleep
             0.59%      dbus-daemon
             0.25%             hald
             0.24%   NetworkManager
             0.19%  hald-addon-rfki
             0.15%          openvpn
             0.07%             phy0
             0.07%         events/0
             0.05%          iwl3945
             0.05%         events/1
             0.03%      kondemand/0
        [root@doppio linux-2.6-tip]#
      
      The other modes work as well, modulo the problem with vmlinux:
      
        acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso 2> /dev/null | head -15
        # Samples: 293085637
        #
        # Overhead          Command                      Shared Object
        # ........  ...............  .................................
        #
            35.11%             find                   ffffffff81002b5a
            18.25%             perf                   ffffffff8102235f
            16.17%             find  libc-2.10.2.so
             9.07%             find  find
             5.80%          swapper                   ffffffff8102235f
             3.95%             perf  libc-2.10.2.so
             2.33%             init                   ffffffff810091b9
             1.65%             sshd  libcrypto.so.0.9.8k
             1.35%             find  [e1000e]
             0.68%            sleep  libc-2.10.2.so
        acme@parisc:~/git/linux-2.6-tip$
      
      And the lack of the right buildids:
      
        acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso,symbol 2> /dev/null | head -15
        # Samples: 293085637
        #
        # Overhead          Command                      Shared Object  Symbol
        # ........  ...............  .................................  ......
        #
            35.11%             find                   ffffffff81002b5a  [k] 0xffffffff81002b5a
            18.25%             perf                   ffffffff8102235f  [k] 0xffffffff8102235f
            16.17%             find  libc-2.10.2.so                     [.] 0x00000000045782
             9.07%             find  find                               [.] 0x0000000000fb0e
             5.80%          swapper                   ffffffff8102235f  [k] 0xffffffff8102235f
             3.95%             perf  libc-2.10.2.so                     [.] 0x0000000007f398
             2.33%             init                   ffffffff810091b9  [k] 0xffffffff810091b9
             1.65%             sshd  libcrypto.so.0.9.8k                [.] 0x00000000105440
             1.35%             find  [e1000e]                           [k] 0x00000000010948
             0.68%            sleep  libc-2.10.2.so                     [.] 0x0000000011ad5b
        acme@parisc:~/git/linux-2.6-tip$
      
      But if we:
      
        acme@parisc:~/git/linux-2.6-tip$ ls ~/.debug
        ls: cannot access /home/acme/.debug: No such file or directory
        acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/lib64/libc-2.10.2.so/
        acme@parisc:~/git/linux-2.6-tip$ scp doppio:.debug/lib64/libc-2.10.2.so/* ~/.debug/lib64/libc-2.10.2.so/
        acme@doppio's password:
        eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1	             100% 1783KB 714.7KB/s   00:02
        acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/.build-id/eb
        acme@parisc:~/git/linux-2.6-tip$ ln -s ../../lib64/libc-2.10.2.so/eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 ~/.debug/.build-id/eb/4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
        acme@parisc:~/git/linux-2.6-tip$ perf report --dsos libc-2.10.2.so 2> /dev/null
        # dso: libc-2.10.2.so
        # Samples: 64281170
        #
        # Overhead          Command  Symbol
        # ........  ...............  ......
        #
            14.98%             perf  [.] __GI_strcmp
            12.30%             find  [.] __GI_memmove
             9.25%             find  [.] _int_malloc
             7.60%             find  [.] _IO_vfprintf_internal
             6.10%             find  [.] _IO_new_file_xsputn
             6.02%             find  [.] __GI_close
             3.08%             find  [.] _IO_file_overflow_internal
             3.08%             find  [.] malloc_consolidate
             3.08%             find  [.] _int_free
             3.08%             find  [.] __strchrnul
             3.08%             find  [.] __getdents64
             3.08%             find  [.] __write_nocancel
             3.08%            sleep  [.] __GI__dl_addr
             3.08%             sshd  [.] __libc_select
             3.08%             find  [.] _IO_new_file_write
             3.07%             find  [.] _IO_new_do_write
             3.06%             find  [.] __GI___errno_location
             3.05%             find  [.] __GI___libc_malloc
             3.04%             perf  [.] __GI_memcpy
             1.71%             find  [.] __fprintf_chk
             1.29%             bash  [.] __gconv_transform_utf8_internal
             0.79%      dbus-daemon  [.] __GI_strlen
        #
        # (For a higher level overview, try: perf report --sort comm,dso)
        #
        acme@parisc:~/git/linux-2.6-tip$
      
      Which matches what we get on the source, F12, x86_64 machine:
      
        [root@doppio linux-2.6-tip]# perf report --dsos libc-2.10.2.so
        # dso: libc-2.10.2.so
        # Samples: 64281170
        #
        # Overhead          Command  Symbol
        # ........  ...............  ......
        #
            14.98%             perf  [.] __GI_strcmp
            12.30%             find  [.] __GI_memmove
             9.25%             find  [.] _int_malloc
             7.60%             find  [.] _IO_vfprintf_internal
             6.10%             find  [.] _IO_new_file_xsputn
             6.02%             find  [.] __GI_close
             3.08%             find  [.] _IO_file_overflow_internal
             3.08%             find  [.] malloc_consolidate
             3.08%             find  [.] _int_free
             3.08%             find  [.] __strchrnul
             3.08%             find  [.] __getdents64
             3.08%             find  [.] __write_nocancel
             3.08%            sleep  [.] __GI__dl_addr
             3.08%             sshd  [.] __libc_select
             3.08%             find  [.] _IO_new_file_write
             3.07%             find  [.] _IO_new_do_write
             3.06%             find  [.] __GI___errno_location
             3.05%             find  [.] __GI___libc_malloc
             3.04%             perf  [.] __GI_memcpy
             1.71%             find  [.] __fprintf_chk
             1.29%             bash  [.] __gconv_transform_utf8_internal
             0.79%      dbus-daemon  [.] __GI_strlen
        #
        # (For a higher level overview, try: perf report --sort comm,dso)
        #
        [root@doppio linux-2.6-tip]#
      
      So I think this is really, really nice in that it demonstrates
      the portability of perf.data files and the use of build-ids
      accross such aliens worlds :-)
      
      There are some things to fix tho, like the bitmap on the header,
      but things are looking good.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric 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: <1263478990-8200-2-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ba21594c
    • A
      perf tools: Don't cast RIP to pointers · 0d755034
      Arnaldo Carvalho de Melo 提交于
      Since they can come from another architecture with bigger
      pointers, i.e. processing a 64-bit perf.data on a 32-bit arch.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric 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: <1263478990-8200-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0d755034