1. 17 Jun, 2010 2 commits
    • Eric B Munson's avatar
      perf symbols: Function descriptor symbol lookup · 70c3856b
      Eric B Munson authored
      Currently symbol resolution does not work for 64-bit programs on architectures
      that use function descriptors such as ppc64.
      
      The problem is that a symbol doesn't point to a text address, it points to a
      data area that contains (amongst other things) a pointer to the text address.
      
      We look for a section called ".opd" which is the function descriptor area. To
      create the full symbol table, when we see a symbol in the function descriptor
      section we load the first pointer and use that as the text address.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      LKML-Reference: <1276523793-15422-1-git-send-email-ebmunson@us.ibm.com>
      Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
      Signed-off-by: default avatarEric B Munson <ebmunson@us.ibm.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      70c3856b
    • Stephane Eranian's avatar
      perf record: Avoid synthesizing mmap() for all processes in per-thread mode · cf103a14
      Stephane Eranian authored
      A bug was introduced by commit c45c6ea2.
      
      Perf record was scanning /proc/PID to create synthetic PERF_RECOR_MMAP
      entries even though it was running in per-thread mode. There was a bogus
      check to select what mmaps to synthesize. We only need all processes in
      system-wide mode.
      
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <4c192107.4f1ee30a.4316.fffff98e@mx.google.com>
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      cf103a14
  2. 09 Jun, 2010 17 commits
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Reorganize the Makefile feature tests · f9af3a4c
      Arnaldo Carvalho de Melo authored
      Moving the tests to a separate file, feature-tests.mak and using a try-cc
      function similar to the try-run in Kbuild.
      
      This also makes the output more quiet as we can stop using the INTERMEDIATE
      target to remove the .perf.dev.null file needed for some gcc versions where
      /dev/null can't be used as the output file name.
      
      As the tests get shorter by uninlining the source code used to test for
      features, we can more properly use identation.
      
      The feature tests itself can be made more clear and reused, like when trying to
      see what is needed to have bfd_demangle.
      
      We also get a bit closer to reusing scripts/Kbuild.include, reducing the
      distance from the kernel build system.
      
      Tests performed:
      
      [root@emilia perf]# make -j9 O=/tmp/perf
      PERF_VERSION = 0.0.2.PERF
          GEN /tmp/perf/common-cmds.h
          * new build flags or prefix
          GEN perf-archive
          CC /tmp/perf/builtin-annotate.o
          CC /tmp/perf/bench/sched-messaging.o
          CC /tmp/perf/builtin-diff.o
      <SNIP>
          CC /tmp/perf/scripts/python/Perf-Trace-Util/Context.o
          CC /tmp/perf/perf.o
          CC /tmp/perf/builtin-help.o
          AR /tmp/perf/libperf.a
          LINK /tmp/perf/perf
      [root@emilia perf]#
      
      If we uninstall, for instance newt-devel we get:
      
      [root@emilia perf]# rpm -e newt-devel
      [root@emilia perf]# make -j9 O=/tmp/perf
      Makefile:564: newt not found, disables TUI support. Please install newt-devel or libnewt-dev
          * new build flags or prefix
          GEN perf-archive
          CC /tmp/perf/perf.o
          CC /tmp/perf/builtin-annotate.o
      <SNIP>
          AR /tmp/perf/libperf.a
          LINK /tmp/perf/perf
      [root@emilia perf]#
      
      And then binutils-devel:
      
      [root@emilia perf]# make -j9 O=/tmp/perf
      Makefile:564: newt not found, disables TUI support. Please install newt-devel or libnewt-dev
      Makefile:632: No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling
          * new build flags or prefix
          GEN perf-archive
          CC /tmp/perf/perf.o
      <SNIP>
          AR /tmp/perf/libperf.a
          LINK /tmp/perf/perf
      [root@emilia perf]#
      
      And then strictly required devel packages:
      
      [root@emilia perf]# rpm -e elfutils-libelf-devel elfutils-devel
      [root@emilia perf]# make -j9 O=/tmp/perf
      Makefile:509: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev
      Makefile:542: *** No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel.  Stop.
      [root@emilia perf]#
      
      After installing everything back on:
      
      [root@emilia perf]# yum install elfutils-devel binutils-devel newt-devel
      <SNIP>
      Installed:
        binutils-devel.x86_64 0:2.20.51.0.2-5.11.el6
        elfutils-devel.x86_64 0:0.147-1.el6
        elfutils-libelf-devel.x86_64 0:0.147-1.el6
        newt-devel.x86_64 0:0.52.11-1.el6
      
      Complete!
      [root@emilia perf]# make -j9
      PERF_VERSION = 0.0.2.PERF
          GEN common-cmds.h
          * new build flags or prefix
          GEN perf-archive
          CC builtin-annotate.o
      <SNIP>
          AR libperf.a
          LINK perf
      [root@emilia perf]# make -j9
      [root@emilia perf]#
      
      Thanks to Sam for pointing me to try-run.
      
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Michal Marek <mmarek@suse.cz>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f9af3a4c
    • Ingo Molnar's avatar
      Merge branch 'perf/core' of... · c726b61c
      Ingo Molnar authored
      Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing into perf/core
      c726b61c
    • Oleg Nesterov's avatar
      x86: Unify save_stack_address() and save_stack_address_nosched() · 018378c5
      Oleg Nesterov authored
      Cleanup. Factor the common code in save_stack_address() and
      save_stack_address_nosched().
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Cc: Roland McGrath <roland@redhat.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Vegard Nossum <vegard.nossum@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      LKML-Reference: <20100603193243.GA31534@redhat.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      018378c5
    • Oleg Nesterov's avatar
      x86: Make save_stack_address() !CONFIG_FRAME_POINTER friendly · 147ec4d2
      Oleg Nesterov authored
      If CONFIG_FRAME_POINTER=n, print_context_stack() shouldn't neglect the
      non-reliable addresses on stack, this is all we have if dump_trace(bp)
      is called with the wrong or zero bp.
      
      For example, /proc/pid/stack doesn't work if CONFIG_FRAME_POINTER=n.
      
      This patch obviously has no effect if CONFIG_FRAME_POINTER=y, otherwise
      it reverts 1650743c "x86: don't save unreliable stack trace entries".
      
      Also, remove the unnecessary type-cast.
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Cc: Roland McGrath <roland@redhat.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Vegard Nossum <vegard.nossum@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      LKML-Reference: <20100603193239.GA31530@redhat.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      147ec4d2
    • Li Zefan's avatar
      tracing: Remove kmemtrace ftrace plugin · 039ca4e7
      Li Zefan authored
      We have been resisting new ftrace plugins and removing existing
      ones, and kmemtrace has been superseded by kmem trace events
      and perf-kmem, so we remove it.
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
      Acked-by: default avatarEduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      [ remove kmemtrace from the makefile, handle slob too ]
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      039ca4e7
    • Peter Zijlstra's avatar
      perf: Fix build breakage for architecutes without atomic64_t · 7be79236
      Peter Zijlstra authored
      The local64.h include dependency was not dependent on PERF_EVENT=y,
      which meant that arch's without atomic64_t support ended up including
      it and failed to build.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <new-submission>
      7be79236
    • Peter Zijlstra's avatar
      perf: Convert perf_event to local_t · e7850595
      Peter Zijlstra authored
      Since now all modification to event->count (and ->prev_count
      and ->period_left) are local to a cpu, change then to local64_t so we
      avoid the LOCK'ed ops.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e7850595
    • Peter Zijlstra's avatar
      perf: Add perf_event::child_count · a6e6dea6
      Peter Zijlstra authored
      Only child counters adding back their values into the parent counter
      are responsible for cross-cpu updates to event->count.
      
      So if we pull that out into a new child_count variable, we get an
      event->count that is only modified locally.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a6e6dea6
    • Peter Zijlstra's avatar
      perf: Add perf_event_count() · b5e58793
      Peter Zijlstra authored
      Create a helper function for those sites that want to read the event count.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      b5e58793
    • Peter Zijlstra's avatar
      arch: Implement local64_t · 1996bda2
      Peter Zijlstra authored
      On 64bit, local_t is of size long, and thus we make local64_t an alias.
      On 32bit, we fall back to atomic64_t. (architecture can provide optimized
      32-bit version)
      
      (This new facility is to be used by perf events optimizations.)
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: linux-arch@vger.kernel.org
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      1996bda2
    • Peter Zijlstra's avatar
      perf: Simplify the ring-buffer logic: make perf_buffer_alloc() do everything needed · d57e34fd
      Peter Zijlstra authored
      Currently there are perf_buffer_alloc() + perf_buffer_init() + some
      separate bits, fold it all into a single perf_buffer_alloc() and only
      leave the attachment to the event separate.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      d57e34fd
    • Peter Zijlstra's avatar
      perf: Rename perf_mmap_data to perf_buffer · ca5135e6
      Peter Zijlstra authored
      Rename to clarify code.
      
      s/perf_mmap_data/perf_buffer/g and selective s/data/buffer/g
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ca5135e6
    • Cyrill Gorcunov's avatar
      perf, x86: Make a second write to performance counter if needed · 68aa00ac
      Cyrill Gorcunov authored
      On Netburst PMU we need a second write to a performance counter
      due to cpu erratum.
      
      A simple flag test instead of alternative instructions was choosen
      because wrmsrl is already a macro and if virtualization is turned
      on will need an additional wrapper call which is more expencise.
      
      nb: we should propably switch to jump-labels as only this facility
      reach the mainline.
      Signed-off-by: default avatarCyrill Gorcunov <gorcunov@openvz.org>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Robert Richter <robert.richter@amd.com>
      Cc: Lin Ming <ming.m.lin@intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20100602212304.GC5264@lenovo>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      68aa00ac
    • Peter Zijlstra's avatar
      perf: Cleanup {start,commit,cancel}_txn details · 8d2cacbb
      Peter Zijlstra authored
      Clarify some of the transactional group scheduling API details
      and change it so that a successfull ->commit_txn also closes
      the transaction.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1274803086.5882.1752.camel@twins>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      8d2cacbb
    • Eric B Munson's avatar
      perf: Add non-exec mmap() tracking · 3af9e859
      Eric B Munson authored
      Add the capacility to track data mmap()s. This can be used together
      with PERF_SAMPLE_ADDR for data profiling.
      Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
      [Updated code for stable perf ABI]
      Signed-off-by: default avatarEric B Munson <ebmunson@us.ibm.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1274193049-25997-1-git-send-email-ebmunson@us.ibm.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      3af9e859
    • Peter Zijlstra's avatar
      perf, trace: Remove superfluous rcu_read_lock() · 8ed92280
      Peter Zijlstra authored
      __DO_TRACE() already calls the callbacks under rcu_read_lock_sched(),
      which is sufficient for our needs, avoid doing it again.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      8ed92280
    • Peter Zijlstra's avatar
      perf, trace: Inline perf_swevent_put_recursion_context() · ecc55f84
      Peter Zijlstra authored
      Inline perf_swevent_put_recursion_context into perf_tp_event(), this
      shrinks the per trace template code footprint and saves a function
      call.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ecc55f84
  3. 08 Jun, 2010 8 commits
  4. 07 Jun, 2010 2 commits
  5. 05 Jun, 2010 7 commits
    • Arun Sharma's avatar
      perf report: Implement --sort cpu · f60f3593
      Arun Sharma authored
      In a shared multi-core environment, users want to analyze why their
      program was slow. In particular, if the code ran slower only on certain
      CPUs due to interference from other programs or kernel threads, the user
      should be able to notice that.
      
      Sample usage:
      
      perf record -f -a -- sleep 3
      perf report --sort cpu,comm
      
      Workload:
      
      program is running on 16 CPUs
      Experiencing interference from an antagonist only on 4 CPUs.
      
        Samples: 106218177676 cycles
      
        Overhead  CPU          Command
        ........  ...  ...............
      
           6.25%  2            program
           6.24%  6            program
           6.24%  11           program
           6.24%  5            program
           6.24%  9            program
           6.24%  10           program
           6.23%  15           program
           6.23%  7            program
           6.23%  3            program
           6.23%  14           program
           6.22%  1            program
           6.20%  13           program
           3.17%  12           program
           3.15%  8            program
           3.14%  0            program
           3.13%  4            program
           3.11%  4         antagonist
           3.11%  0         antagonist
           3.10%  8         antagonist
           3.07%  12        antagonist
      
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <20100505181612.GA5091@sharma-home.net>
      Signed-off-by: default avatarArun Sharma <aruns@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f60f3593
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Make event__preprocess_sample parse the sample · 41a37e20
      Arnaldo Carvalho de Melo authored
      Simplifying the tools that were using both in sequence and allowing
      upcoming simplifications, such as Arun's patch to sort by cpus.
      
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      41a37e20
    • Stephane Eranian's avatar
      perf annotate: Ask objdump to demangle symbols · 45d8e802
      Stephane Eranian authored
      Perf report is demangling symbols but not annotate.
      
      The former uses internal demangling via libbdf or libiberty. The latter
      executes objdump which by default does not demangle symbols.
      
      This patch adds the -C option to the objdump cmdline to enable symbol
      demangling.
      
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <4c07b323.2126e30a.6245.0e1e@mx.google.com>
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      45d8e802
    • Stephane Eranian's avatar
      perf buildid: add perfconfig option to specify buildid cache dir · 45de34bb
      Stephane Eranian authored
      This patch adds the ability to specify an alternate directory to store the
      buildid cache (buildids, copy of binaries). By default, it is hardcoded to
      $HOME/.debug. This directory contains immutable data. The layout of the
      directory is such that no conflicts in filenames are possible. A modification
      in a file, yields a different buildid and thus a different location in the
      subdir hierarchy.
      
      You may want to put the buildid cache elsewhere because of disk space
      limitation or simply to share the cache between users. It is also useful for
      remote collect vs. local analysis of profiles.
      
      This patch adds a new config option to the perfconfig file.  Under the tag
      'buildid', there is a dir option. For instance, if you have:
      
      $ cat /etc/perfconfig
      [buildid]
      dir = /var/cache/perf-buildid
      
      All buildids and binaries are be saved in the directory specified. The perf
      record, buildid-list, buildid-cache, report, annotate, and archive commands
      will it to pull information out.
      
      The option can be set in the system-wide perfconfig file or in the
      $HOME/.perfconfig file.
      
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <4c055fb7.df0ce30a.5f0d.ffffae52@mx.google.com>
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      45de34bb
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Make target to generate self contained source tarball · 8e5564e6
      Arnaldo Carvalho de Melo authored
      Useful for when people want to try some version of the perf tools and don't
      wants to download the kernel tarball.
      
      Here is a session using this new target:
      
        [root@emilia linux-2.6-tip]# make help | grep -i perf
          perf-tar-src-pkg    - Build perf-2.6.35-rc1.tar source tarball
          perf-targz-src-pkg  - Build perf-2.6.35-rc1.tar.gz source tarball
          perf-tarbz2-src-pkg - Build perf-2.6.35-rc1.tar.bz2 source tarball
        [root@emilia linux-2.6-tip]# make perf-tarbz2-src-pkg
          TAR
        [root@emilia linux-2.6-tip]# ls -la perf-2.6.35-rc1.tar.bz2
        -rw-r--r-- 1 root root 295731 May 31 11:18 perf-2.6.35-rc1.tar.bz2
        [root@emilia linux-2.6-tip]# tar xf perf-2.6.35-rc1.tar.bz2
        [root@emilia linux-2.6-tip]# cd perf-2.6.35-rc1
        [root@emilia perf-2.6.35-rc1]# ls
        arch  HEAD  include  lib  tools
        [root@emilia perf-2.6.35-rc1]# cd tools/perf
        [root@emilia perf]# make -j9 2>&1 | tail
            CC arch/x86/util/dwarf-regs.o
            CC util/probe-finder.o
            CC util/newt.o
            CC util/scripting-engines/trace-event-perl.o
            CC scripts/perl/Perf-Trace-Util/Context.o
            CC perf.o
            CC builtin-help.o
            AR libperf.a
            LINK perf
        rm .perf.dev.null
        [root@emilia perf]# ./perf record -a sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.262 MB perf.data (~11457 samples) ]
        [root@emilia perf]# ./perf report | head -12
        # Events: 6K cycles
        #
        # Overhead          Command       Shared Object  Symbol
        # ........  ...............  ..................  ......
        #
             4.73%             perf  [kernel.kallsyms]   [k] format_decode
             4.49%             perf  libc-2.12.so        [.] _IO_file_underflow_internal
             4.38%             init  [kernel.kallsyms]   [k] mwait_idle
             3.29%             perf  [kernel.kallsyms]   [k] vsnprintf
             2.38%             init  [kernel.kallsyms]   [k] sched_clock_local
             2.35%             init  [kernel.kallsyms]   [k] apic_timer_interrupt
             1.86%     sirq-timer/5  [kernel.kallsyms]   [k] find_busiest_group
        [root@emilia perf]#
      Acked-by: default avatarMichal Marek <mmarek@suse.cz>
      Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Michal Marek <mmarek@suse.cz>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <20100528185357.GA28009@ghostprotocols.net>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8e5564e6
    • Stephane Eranian's avatar
      perf tools: Add the ability to specify list of cpus to monitor · c45c6ea2
      Stephane Eranian authored
      This patch adds a -C option to stat, record, top to designate a list of CPUs to
      monitor. CPUs can be specified as a comma-separated list or ranges, no space
      allowed.
      
      Examples:
      $ perf record -a -C0-1,4-7 sleep 1
      $ perf top -C0-4
      $ perf stat -a -C1,2,3,4 sleep 1
      
      With perf record in per-thread mode with inherit mode on, samples are collected
      only when the thread runs on the designated CPUs.
      
      The -C option does not turn on system-wide mode automatically.
      
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <4bff9496.d345d80a.41fe.7b00@mx.google.com>
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c45c6ea2
    • Stephane Eranian's avatar
      perf report: Make -D print sampled CPU · 761844b9
      Stephane Eranian authored
      It is useful to know on which CPU a sample was captured on.
      The information is captured with perf record -R but it was
      not printed out by perf report -D. This patch adds this.
      
      When -R is not used, cpu is set to -1to indicate that
      the CPU is unknown (it is not captured).
      
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <4bff964c.e88cd80a.3106.7d31@mx.google.com>
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      761844b9
  6. 04 Jun, 2010 2 commits
  7. 03 Jun, 2010 2 commits
    • Steven Rostedt's avatar
      tracing: Remove ftrace_preempt_disable/enable · 5168ae50
      Steven Rostedt authored
      The ftrace_preempt_disable/enable functions were to address a
      recursive race caused by the function tracer. The function tracer
      traces all functions which makes it easily susceptible to recursion.
      One area was preempt_enable(). This would call the scheduler and
      the schedulre would call the function tracer and loop.
      (So was it thought).
      
      The ftrace_preempt_disable/enable was made to protect against recursion
      inside the scheduler by storing the NEED_RESCHED flag. If it was
      set before the ftrace_preempt_disable() it would not call schedule
      on ftrace_preempt_enable(), thinking that if it was set before then
      it would have already scheduled unless it was already in the scheduler.
      
      This worked fine except in the case of SMP, where another task would set
      the NEED_RESCHED flag for a task on another CPU, and then kick off an
      IPI to trigger it. This could cause the NEED_RESCHED to be saved at
      ftrace_preempt_disable() but the IPI to arrive in the the preempt
      disabled section. The ftrace_preempt_enable() would not call the scheduler
      because the flag was already set before entring the section.
      
      This bug would cause a missed preemption check and cause lower latencies.
      
      Investigating further, I found that the recusion caused by the function
      tracer was not due to schedule(), but due to preempt_schedule(). Now
      that preempt_schedule is completely annotated with notrace, the recusion
      no longer is an issue.
      Reported-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      5168ae50
    • Steven Rostedt's avatar
      tracing/sched: Make preempt_schedule() notrace · d1f74e20
      Steven Rostedt authored
      The function tracer code uses ftrace_preempt_disable() to disable
      preemption instead of normal preempt_disable(). But there's a slight
      race condition that may cause it to lose a preemption check.
      
      This was made to keep the function tracer from recursing on itself
      by disabling preemption then having the enable call the function tracer
      again, causing infinite recursion.
      
      The bug was assumed to happen if the call was just in schedule, but
      this is incorrect. The bug is caused by preempt_schedule() which
      is called by preempt_enable(). The calling of preempt_enable() when
      NEED_RESCHED was set would call preempt_schedule() which would call
      the function tracer again.
      
      By making the preempt_schedule() and add_preempt_count() notrace
      then this will prevent the inifinite recursion. This is because
      the add_preempt_count() would stop the preempt_enable() in the
      function tracer from calling preempt_schedule() again.
      
      The sub_preempt_count() is also made notrace just to keep it
      symmetric.
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      d1f74e20