1. 29 5月, 2009 2 次提交
  2. 28 5月, 2009 12 次提交
    • P
      perf_counter: Fix race in attaching counters to tasks and exiting · c93f7669
      Paul Mackerras 提交于
      Commit 564c2b21 ("perf_counter: Optimize context switch between
      identical inherited contexts") introduced a race where it is possible
      that a counter being attached to a task could get attached to the
      wrong task, if the task is one that has inherited its context from
      another task via fork.  This happens because the optimized context
      switch could switch the context to another task after find_get_context
      has read task->perf_counter_ctxp.  In fact, it's possible that the
      context could then get freed, if the other task then exits.
      
      This fixes the problem by protecting both the context switch and the
      critical code in find_get_context with spinlocks.  The context switch
      locks the cxt->lock of both the outgoing and incoming contexts before
      swapping them.  That means that once code such as find_get_context
      has obtained the spinlock for the context associated with a task,
      the context can't get swapped to another task.  However, the context
      may have been swapped in the interval between reading
      task->perf_counter_ctxp and getting the lock, so it is necessary to
      check and retry.
      
      To make sure that none of the contexts being looked at in
      find_get_context can get freed, this changes the context freeing code
      to use RCU.  Thus an rcu_read_lock() is sufficient to ensure that no
      contexts can get freed.  This part of the patch is lifted from a patch
      posted by Peter Zijlstra.
      
      This also adds a check to make sure that we can't add a counter to a
      task that is exiting.
      
      There is also a race between perf_counter_exit_task and
      find_get_context; this solves the race by moving the get_ctx that
      was in perf_counter_alloc into the locked region in find_get_context,
      so that once find_get_context has got the context for a task, it
      won't get freed even if the task calls perf_counter_exit_task.  It
      doesn't matter if new top-level (non-inherited) counters get attached
      to the context after perf_counter_exit_task has detached the context
      from the task.  They will just stay there and never get scheduled in
      until the counters' fds get closed, and then perf_release will remove
      them from the context and eventually free the context.
      
      With this, we are now doing the unclone in find_get_context rather
      than when a counter was added to or removed from a context (actually,
      we were missing the unclone_ctx() call when adding a counter to a
      context).  We don't need to unclone when removing a counter from a
      context because we have no way to remove a counter from a cloned
      context.
      
      This also takes out the smp_wmb() in find_get_context, which Peter
      Zijlstra pointed out was unnecessary because the cmpxchg implies a
      full barrier anyway.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <18974.33033.667187.273886@cargo.ozlabs.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c93f7669
    • I
      perf_counter tools: report: Add help text for --sort · 63299f05
      Ingo Molnar 提交于
      Acked-by: NPeter 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>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      63299f05
    • P
      perf_counter tools: report: Implement header output for --sort variants · ca8cdeef
      Peter Zijlstra 提交于
      Implement this style of header:
      
       #
       # Overhead          Command       File: Symbol
       # ........          .......       ............
       #
      
      for the various --sort variants as well.
      Signed-off-by: NPeter 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: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ca8cdeef
    • I
      perf_counter: Fix perf_counter_init_task() on !CONFIG_PERF_COUNTERS · d3e78ee3
      Ingo Molnar 提交于
      Pointed out by compiler warnings:
      
         tip/include/linux/perf_counter.h:644: warning: no return statement in function returning non-void
      
      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>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      d3e78ee3
    • I
      pref_counter: tools: report: Robustify in case of weird events · 55717314
      Ingo Molnar 提交于
      This error condition:
      
        aldebaran:~/linux/linux/Documentation/perf_counter> perf report
        dso__load_sym: cannot get elf header.
        failed to open: /etc/ld.so.cache
        problem processing PERF_EVENT_MMAP, bailing out
      
      caused the profile to be very short - as the error was at the beginning
      of the file and we bailed out completely.
      
      Be more permissive and consider the event broken instead.
      
      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>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      55717314
    • I
      pref_counter: tools: report: Add header printout & prettify · 2d65537e
      Ingo Molnar 提交于
      Old default output:
      
       3.12%    perf-report [.] ./perf-report:       dsos__find
       2.44%    perf-report [k] kernel:              kallsyms_expand_symbol
       2.28%          :4483 [.] <unknown>:           <unknown>
       2.05%          :4174 [k] kernel:              _spin_lock_irqsave
       2.01%    perf-report [k] kernel:              vsnprintf
       1.92%    perf-report [k] kernel:              format_decode
       1.92%          :4438 [k] kernel:              _spin_lock
      
      New default output:
      
       #
       # Overhead          Command       File: Symbol
       # ........          .......       ............
       #
            6.54%             perf  [k]  kernel: kallsyms_expand_symbol
            6.26%             perf  [.]  /home/mingo/tip/Documentation/perf_counter/perf: dso__insert_symbol
            4.76%             perf  [.]  /home/mingo/tip/Documentation/perf_counter/perf: hex2long
            4.55%             perf  [k]  kernel: number
            4.48%             perf  [k]  kernel: format_decode
            4.09%             perf  [k]  kernel: vsnprintf
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <20090527182101.229504802@chello.nl>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      2d65537e
    • P
      pref_counter: tools: report: Add dso sorting · 55e5ec41
      Peter Zijlstra 提交于
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <20090527182101.229504802@chello.nl>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      55e5ec41
    • P
      perf_counter: tools: report: Add comm sorting · 992444b1
      Peter Zijlstra 提交于
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <20090527182101.129302022@chello.nl>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      992444b1
    • P
      pref_counter: tools: report: Add --sort option · 37f440cb
      Peter Zijlstra 提交于
      option parsing for dynamic sorting.
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <20090527182101.041817692@chello.nl>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      37f440cb
    • P
      perf_counter: tools: report: Dynamic sort/print bits · 1aa16738
      Peter Zijlstra 提交于
      Make the sorting and printing dynamic.
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <20090527182100.921953817@chello.nl>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1aa16738
    • P
      perf_counter: tools: report: Rework histogram code · e7fb08b1
      Peter Zijlstra 提交于
      In preparation for configurable sorting, rework the histgram code a bit.
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <20090527182100.796410098@chello.nl>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      e7fb08b1
    • P
      perf_counter: tools: report: Add vmlinux support · 450aaa2b
      Peter Zijlstra 提交于
      Allow to use vmlinux instead of kallsyms.
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <20090527182100.740018486@chello.nl>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      450aaa2b
  3. 27 5月, 2009 15 次提交
    • P
      perf_counter: tools: /usr/lib/debug%s.debug support · b7a16eac
      Peter Zijlstra 提交于
      Some distros seem to store debuginfo in weird places.
      Signed-off-by: NPeter 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>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b7a16eac
    • I
      perf report: Remove <ctype.h> include · d716fba4
      Ingo Molnar 提交于
      Pekka reported build failure in builtin-report.c:
      
          CC builtin-report.o
          In file included from builtin-report.c:7:
          /usr/include/ctype.h:102: error: expected expression before token
      
      And observed:
      
      | Removing #include <ctype.h> from builtin-report.c makes the problem
      | go away. I am running Ubuntu 9.04 that has gcc 4.3.3 and libc 2.9.
      Reported-by: NPekka J Enberg <penberg@cs.helsinki.fi>
      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>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      d716fba4
    • M
      perf record: Fix the profiling of existing pid or whole box · ef65b2a0
      Mike Galbraith 提交于
      Perf record bails if no command argument is provided, so you can't use
      naked -a or -p to profile a running task or the whole box.
      
      Allow foreground profiling of an existing pid or the entire system.
      
      [ Impact: fix command option handling bug ]
      Signed-off-by: NMike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      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: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ef65b2a0
    • I
      perf_counter tools: Add built-in pager support · a930d2c0
      Ingo Molnar 提交于
      Add Git's pager.c (and sigchain) code. A command only
      has to call setup_pager() to get paged interactive
      output.
      
      Non-interactive (redirected, command-piped, etc.) uses
      are not affected.
      
      Update perf-report to make use of this.
      
      [ Impact: new feature ]
      
      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>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a930d2c0
    • I
      perf_counter tools: Rename output.perf to perf.data · 23ac9cbe
      Ingo Molnar 提交于
      output.perf is only output to perf-record - it's input to
      perf-report. So change it to a more direction-neutral name.
      
      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>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      23ac9cbe
    • I
      perf_counter tools: Introduce stricter C code checking · 16f762a2
      Ingo Molnar 提交于
      Tighten up our C code requirements:
      
       - disallow warnings
       - disallow declarations-mixed-with-statements
       - require proper prototypes
       - require C99 (with gcc extensions)
      
      Fix up a ton of problems these measures unearth:
      
       - unused functions
       - needlessly global functions
       - missing prototypes
       - code mixed with declarations
      
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      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: John Kacur <jkacur@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20090526222155.GJ4424@ghostprotocols.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      16f762a2
    • A
      perf report: Show the IP only in --verbose mode · 815e777f
      Arnaldo Carvalho de Melo 提交于
      perf: report should show the IP only in --verbose mode
      
      [acme@emilia ~]$ perf report | head
       4.95          find [k] _spin_lock
       2.19          find [k] ext3fs_dirhash	[ext3]
       1.87          find [k] __rcu_read_lock
       1.86          find [k] _atomic_dec_and_lock
       1.86          find [.] /lib64/libc-2.5.so: __GI_strlen
       1.85          find [k] __kmalloc
       1.62          find [.] /lib64/libc-2.5.so: vfprintf
       1.59          find [k] __rcu_read_unlock
       1.55          find [k] __d_lookup
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      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: John Kacur <jkacur@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20090526224614.GK4424@ghostprotocols.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      815e777f
    • I
      perf report: Only load text symbols from kallsyms, fix · af83632f
      Ingo Molnar 提交于
      - allow 'W' symbols too
       - Convert initializations to C99 style
       - whitespace cleanups
      
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      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: John Kacur <jkacur@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20090526222155.GJ4424@ghostprotocols.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      af83632f
    • A
      perf report: Only load text symbols from kallsyms · 03f6316d
      Arnaldo Carvalho de Melo 提交于
      Just like we do for userspace when reading the symtab, reducing the
      number of entries we insert on the symbols rbtree.
      
      Before:
      
      [acme@emilia ~]$ rm -f perf_report.perf ; perf record -o perf_report.perf perf stat perf report > /dev/null
      
       Performance counter stats for 'perf':
      
           218.138382  task clock ticks     (msecs)
                    4  context switches     (events)
                    8  CPU migrations       (events)
                 2136  pagefaults           (events)
             32746212  CPU cycles           (events)  (scaled from 67.04%)
             11961102  instructions         (events)  (scaled from 66.19%)
                49841  cache references     (events)  (scaled from 21.96%)
                13777  cache misses         (events)  (scaled from 21.98%)
      
       Wall-clock time elapsed:   218.702477 msecs
      
      [acme@emilia ~]$ perf report -i perf_report.perf | head
      11.06          perf [.] 0x00000000000057cb /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: dso__find_symbol
       9.15          perf [.] 0x00000000000056a0 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: dso__insert_symbol
       8.72          perf [k] 0xffffffff8101b1d2 intel_pmu_enable_all
       8.51          perf [.] 0x0000000000006672 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: thread__symbol_incnew
       3.83          perf [k] 0xffffffff811cfc5a vsnprintf
       3.40          perf [.] 0x0000000000005e33 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: hex
       3.40          perf [.] 0x0000000000005ec7 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: hex2long
       3.19          perf [k] 0xffffffff811ce1c1 number
       2.77          perf [.] 0x0000000000006869 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: threads__findnew
       2.77          perf [.] 0x000000000000fde3 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: rb_insert_color
      [acme@emilia ~]$
      
      After:
      
      acme@emilia ~]$ rm -f perf_report.perf ; perf record -o perf_report.perf perf stat perf report > /dev/null
      
       Performance counter stats for 'perf':
      
           190.228511  task clock ticks     (msecs)
                    4  context switches     (events)
                    7  CPU migrations       (events)
                 1625  pagefaults           (events)
             29578745  CPU cycles           (events)  (scaled from 66.92%)
             10516914  instructions         (events)  (scaled from 66.47%)
                44015  cache references     (events)  (scaled from 22.04%)
                 8248  cache misses         (events)  (scaled from 22.07%)
      
       Wall-clock time elapsed:   190.816096 msecs
      
      [acme@emilia ~]$ perf report -i perf_report.perf | head
      15.99          perf [.] 0x00000000000057a9 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: dso__find_symbol
      10.87          perf [.] 0x000000000000674d /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: thread__symbol_incnew
       8.74          perf [k] 0xffffffff8101b1d2 intel_pmu_enable_all
       5.54          perf [.] 0x0000000000005e42 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: hex
       4.48          perf [.] 0x0000000000005ebe /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: hex2long
       4.48          perf [k] 0xffffffff811cfba0 vsnprintf
       3.84          perf [.] 0x00000000000056b4 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: dso__insert_symbol
       3.62          perf [.] 0x00000000000068d0 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: threads__findnew
       3.20          perf [k] 0xffffffff811ce0b3 number
       2.56          perf [.] 0x0000000000006d78 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: __cmd_report
      [acme@emilia ~]$
      
      [ Impact: optimization ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      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: John Kacur <jkacur@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20090526222155.GJ4424@ghostprotocols.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      03f6316d
    • A
      perf report: Use hex2long instead of sscanf · d8d1656e
      Arnaldo Carvalho de Melo 提交于
      Before:
      
      [acme@emilia ~]$ perf record -o perf_report.perf perf stat perf report > /dev/null
      
       Performance counter stats for 'perf':
      
           245.414985  task clock ticks     (msecs)
                    6  context switches     (events)
                    6  CPU migrations       (events)
                 2108  pagefaults           (events)
             37493013  CPU cycles           (events)  (scaled from 67.04%)
             13576789  instructions         (events)  (scaled from 66.76%)
                57931  cache references     (events)  (scaled from 21.96%)
                12263  cache misses         (events)  (scaled from 21.98%)
      
       Wall-clock time elapsed:   246.575587 msecs
      
      [acme@emilia ~]$ perf report -i perf_report.perf | head
      12.15          perf [.] 0x000000000005432a /lib64/libc-2.5.so: _IO_vfscanf_internal
       9.38          perf [k] 0xffffffff8101b1d2 intel_pmu_enable_all
       8.53          perf [.] 0x00000000000056b8 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: dso__insert_symbol
       6.61          perf [.] 0x00000000000057cb /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: dso__find_symbol
       5.33          perf [k] 0xffffffff811ce082 number
       4.69          perf [.] 0x0000000000034829 /lib64/libc-2.5.so: ____strtoull_l_internal
       4.48          perf [.] 0x0000000000006505 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: thread__symbol_incnew
       3.41          perf [.] 0x000000000000fce6 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: rb_insert_color
       3.20          perf [k] 0xffffffff811cfc01 vsnprintf
       2.99          perf [k] 0xffffffff811ce5e8 format_decode
      
      After:
      
      [acme@emilia ~]$ perf record -o perf_report.perf perf stat perf report > /dev/null
      
       Performance counter stats for 'perf':
      
           218.186805  task clock ticks     (msecs)
                    4  context switches     (events)
                    7  CPU migrations       (events)
                 2133  pagefaults           (events)
             32735365  CPU cycles           (events)  (scaled from 67.04%)
             11952309  instructions         (events)  (scaled from 66.26%)
                50314  cache references     (events)  (scaled from 21.96%)
                13228  cache misses         (events)  (scaled from 21.98%)
      
       Wall-clock time elapsed:   218.810451 msecs
      
      [acme@emilia ~]$ perf report -i perf_report.perf | head
      10.68          perf [.] 0x000000000000578d /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: dso__find_symbol
       9.62          perf [.] 0x00000000000065f7 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: thread__symbol_incnew
       9.40          perf [.] 0x00000000000056b4 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: dso__insert_symbol
       9.19          perf [k] 0xffffffff8101b1d2 intel_pmu_enable_all
       5.13          perf [.] 0x0000000000005ec7 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: hex2long
       4.49          perf [k] 0xffffffff81083808 kallsyms_expand_symbol
       3.85          perf [k] 0xffffffff811ce2c1 number
       3.63          perf [.] 0x0000000000005e81 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: hex
       2.99          perf [.] 0x000000000000fd5b /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: rb_insert_color
       2.99          perf [k] 0xffffffff811cf251 string
      [acme@emilia ~]$
      
      [ Impact: optimization ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      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: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20090526222057.GI4424@ghostprotocols.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      d8d1656e
    • A
      perf report: Sort output by symbol usage · 3a4b8cc7
      Arnaldo Carvalho de Melo 提交于
      [acme@emilia ~]$ perf record find / > /dev/null 2>&1
      [acme@emilia ~]$ perf stat perf report | head -20
       4.95          find [k] 0xffffffff81393d65 _spin_lock
       3.89          find [.] 0x000000000000af89 /usr/bin/find: <unknown>
       2.19          find [k] 0xffffffffa00518e0 ext3fs_dirhash
       1.87          find [k] 0xffffffff810a6cea __rcu_read_lock
       1.86          find [k] 0xffffffff811c7312 _atomic_dec_and_lock
       1.86          find [.] 0x00000000000782ab /lib64/libc-2.5.so: __GI_strlen
       1.85          find [k] 0xffffffff810fedfb __kmalloc
       1.62          find [.] 0x00000000000430ff /lib64/libc-2.5.so: vfprintf
       1.59          find [k] 0xffffffff810a6d6d __rcu_read_unlock
       1.55          find [k] 0xffffffff81119395 __d_lookup
       1.39          find [.] 0x0000000000071b40 /lib64/libc-2.5.so: _int_malloc
       1.30          find [k] 0xffffffffa031c4fc nfs_do_filldir
       1.21          find [k] 0xffffffff811876a5 avc_has_perm_noaudit
       1.15          find [k] 0xffffffff810fef62 kmem_cache_alloc
       1.07          find [k] 0xffffffff811d03fb copy_user_generic_string
       1.03          find [k] 0xffffffffa0043882 ext3_htree_store_dirent
       0.99          find [k] 0xffffffff81393ebb _spin_lock_bh
       0.98          find [k] 0xffffffffa03319a2 nfs3_decode_dirent
       0.97          find [k] 0xffffffff8100bf20 system_call
       0.92          find [k] 0xffffffff8139437e _spin_unlock
      
       Performance counter stats for 'perf':
      
           244.278972  task clock ticks     (msecs)
                    8  context switches     (events)
                    9  CPU migrations       (events)
                 2104  pagefaults           (events)
             35329669  CPU cycles           (events)  (scaled from 75.40%)
             13740366  instructions         (events)  (scaled from 75.49%)
                59073  cache references     (events)  (scaled from 24.60%)
                  196  cache misses         (events)  (scaled from 24.51%)
      
       Wall-clock time elapsed:   246.060717 msecs
      
      [acme@emilia ~]$
      [acme@emilia ~]$ grep "model name" /proc/cpuinfo | head -1
      model name	: Intel(R) Xeon(R) CPU           E5405  @ 2.00GHz
      [acme@emilia ~]$ grep "model name" /proc/cpuinfo | wc -l
      8
      [acme@emilia ~]$
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <20090526191904.GH4424@ghostprotocols.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      3a4b8cc7
    • P
      perf report: More robust error handling · 6142f9ec
      Peter Zijlstra 提交于
      Don't let funny events confuse us, stick to what we know and
      try to find sensible data again.
      
      If we find an unknown event, check we're still u64 aligned, and
      increment by one u64. This ensures we're bound to happen upon a
      valid event soon.
      Signed-off-by: NPeter 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>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      6142f9ec
    • I
      perf report: add more debugging · f49515b1
      Ingo Molnar 提交于
      Add the offset of the file we are analyzing, and the size of the record.
      
      In case of problems it's easier to see where the parser lost track.
      
      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>
      Cc: John Kacur <jkacur@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f49515b1
    • I
      perf report: add counter for unknown events · 3e706114
      Ingo Molnar 提交于
      Add a counter for unknown event records.
      
      [ Impact: improve debugging ]
      
      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>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      3e706114
    • I
      perf report: add --dump-raw-trace option · 97b07b69
      Ingo Molnar 提交于
      To help the inspection of various data files, implement an ASCII dump
      method that just dumps the records as they are read in - then we exit.
      
      [ Impact: new feature ]
      
      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>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      97b07b69
  4. 26 5月, 2009 11 次提交
    • A
      perf: Don't assume /proc/kallsyms is ordered · abd54f68
      Arnaldo Carvalho de Melo 提交于
      perf: Don't assume /proc/kallsyms is ordered
      
      Since we _are_ ordering it by the symbol start, just traverse the
      freshly built rbtree setting the prev->end members to curr->start - 1.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      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: John Kacur <jkacur@redhat.com>
      LKML-Reference: <20090526152134.GF4424@ghostprotocols.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      abd54f68
    • A
      perf report: Fix kernel symbol resolution · 59d81029
      Arnaldo Carvalho de Melo 提交于
      kallsyms have just the symbol start, so we need to read two lines
      to get the len.
      
      [ Impact: fix incorrect kernel symbol display in perf report ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      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>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      59d81029
    • P
      perf report: Fix ELF symbol parsing · f17e04af
      Peter Zijlstra 提交于
      [ Impact: fix DSO symbol output in perf report ]
      Signed-off-by: NPeter 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>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f17e04af
    • M
      perf top: fix typo in -d option · db20c003
      Mike Galbraith 提交于
      Clean up copy/paste options parsing conversion error.
      
      [ Impact: reactivate -d option ]
      Signed-off-by: NMike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      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: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      db20c003
    • M
      perf top: Remove leftover NMI/IRQ bits · f91183fe
      Mike Galbraith 提交于
      79202b removed IRQ/NMI mode selection, so remove it from
      perf top as well.
      
      [ Impact: cleanup ]
      Signed-off-by: NMike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      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: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f91183fe
    • I
      perf report: Add help/manpage · 0bec253c
      Ingo Molnar 提交于
      Add a (minimal) manpage for perf report.
      
      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: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0bec253c
    • I
      perf record: Convert to Git option parsing · 53cb8bc2
      Ingo Molnar 提交于
      Remove getopt usage and use Git's much more advanced and more compact
      command option library.
      
      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: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      53cb8bc2
    • P
      perf report: Fix segfault on unknown symbols · f3e08c53
      Peter Zijlstra 提交于
      Ingo reported:
      
      > Program received signal SIGSEGV, Segmentation fault.
      > 0x0000003e25080f80 in strlen () from /lib64/libc.so.6
      > Missing separate debuginfos, use: debuginfo-install elfutils.x86_64
      > glibc.x86_64 zlib.x86_64
      > (gdb) bt
      > #0  0x0000003e25080f80 in strlen () from /lib64/libc.so.6
      > #1  0x0000003e2506954e in fputs () from /lib64/libc.so.6
      > #2  0x00000000004059e8 in cmd_report (argc=<value optimized out>,
      >     argv=<value optimized out>) at builtin-report.c:521
      > #3  0x0000000000402dad in handle_internal_command (argc=1, argv=0x7fffe1218e30)
      >     at perf.c:226
      > #4  0x0000000000402f6d in main (argc=1, argv=0x7fffe1218e30) at perf.c:324
      > (gdb)
      
      Signed-off-by Peter Zijlstra <a.p.zijlstra@chello.nl>
      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>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f3e08c53
    • A
      perf_counter: Use rb_tree for symhists and threads in report · ce7e4365
      Arnaldo Carvalho de Melo 提交于
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ce7e4365
    • A
      perf_counter: Add our private copy of list.h · 040e6034
      Arnaldo Carvalho de Melo 提交于
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      040e6034
    • A
      perf_counter: Use rb_trees in perf report · 35a50c8a
      Arnaldo Carvalho de Melo 提交于
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      35a50c8a