1. 30 May, 2009 3 commits
    • Ingo Molnar's avatar
      perf_counter tools: Fix 'make install' · 7fbd5544
      Ingo Molnar authored
      'make install' didnt install perf itself - which needs a special
      rule to be copied to bindir.
      
      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: default avatarIngo Molnar <mingo@elte.hu>
      7fbd5544
    • Ingo Molnar's avatar
      perf_counter tools: Print 'CPU utilization factor' in builtin-stat · d7c29318
      Ingo Molnar authored
      Before:
      
       Performance counter stats for '/home/mingo/hackbench':
      
          5728.862689  task clock ticks     (msecs)
                34426  context switches     #        0.006 M/sec
                 3835  CPU migrations       #        0.001 M/sec
                18158  pagefaults           #        0.003 M/sec
          16218109156  CPU cycles           #     2830.947 M/sec
          13519616840  instructions         #     2359.913 M/sec
             55941661  cache references     #        9.765 M/sec
             23554938  cache misses         #        4.112 M/sec
      
       Wall-clock time elapsed:   528.886980 msecs
      
      After:
      
       Performance counter stats for '/home/mingo/hackbench':
      
          5845.443541  task clock ticks     #      11.886 CPU utilization factor
                38289  context switches     #       0.007 M/sec
                 4208  CPU migrations       #       0.001 M/sec
                17755  pagefaults           #       0.003 M/sec
          16664668576  CPU cycles           #    2850.882 M/sec
          13468113991  instructions         #    2304.036 M/sec
             57445468  cache references     #       9.827 M/sec
             26896502  cache misses         #       4.601 M/sec
      
       Wall-clock time elapsed:   491.802357 msecs
      
      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: default avatarIngo Molnar <mingo@elte.hu>
      d7c29318
    • Arnaldo Carvalho de Melo's avatar
      perf_counter tools: Add locking to perf top · c44613a4
      Arnaldo Carvalho de Melo authored
      perf_counter tools: Add locking to perf top
      
      We need to protect the active_symbols list as two threads change it:
      the main thread adding entries to the head and the display thread
      decaying entries from any place in the list.
      
      Also related: take a snapshot of syme->count[0] before using it to
      calculate the weight and to show the same number used in this calc when
      displaying the symbol usage.
      Reported-by: default avatarMike Galbraith <efault@gmx.de>
      Tested-by: default avatarMike Galbraith <efault@gmx.de>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20090529200307.GR4747@ghostprotocols.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      c44613a4
  2. 29 May, 2009 13 commits
    • Arnaldo Carvalho de Melo's avatar
      perf_counter tools: Shorten the DSO names using cwd · b78c07d4
      Arnaldo Carvalho de Melo authored
      [acme@emilia linux-2.6-tip]$ pwd
      /home/acme/git/linux-2.6-tip
      
      Before (still available using -P/--full-paths)
      
      [acme@emilia linux-2.6-tip]$ perf report -P | head -10
          11.48%             perf: 7454 [kernel]: clear_page_c
           4.89%             perf: 7454 [kernel]: vsnprintf
           4.61%             perf: 7454 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: dso__find_symbol
           4.09%             perf: 7454 [kernel]: number
           4.06%             perf: 7454 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: dso__fprintf
           4.00%             perf: 7454 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: symbol_filter
      
      New default:
      
      [acme@emilia linux-2.6-tip]$ perf report | head -10
          11.48%             perf: 7454 [kernel]: clear_page_c
           4.89%             perf: 7454 [kernel]: vsnprintf
           4.61%             perf: 7454 ./Documentation/perf_counter/perf: dso__find_symbol
           4.09%             perf: 7454 [kernel]: number
           4.06%             perf: 7454 ./Documentation/perf_counter/perf: dso__fprintf
           4.00%             perf: 7454 ./Documentation/perf_counter/perf: symbol_filter
      Suggested-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20090529164859.GN4747@ghostprotocols.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      b78c07d4
    • Peter Zijlstra's avatar
      perf_counter: Ammend cleanup in fork() fail · bbbee908
      Peter Zijlstra authored
      When fork() fails we cannot use perf_counter_exit_task() since that
      assumes to operate on current. Write a new helper that cleans up
      unused/clean contexts.
      Signed-off-by: default avatarPeter 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: default avatarIngo Molnar <mingo@elte.hu>
      bbbee908
    • Peter Zijlstra's avatar
      perf_counter: Clean up task_ctx vs interrupts · 665c2142
      Peter Zijlstra authored
      Remove the local_irq_save() etc.. in routines that are smp function
      calls, or have IRQs disabled by other means.
      
      Then change the COMM, MMAP, and swcounter context iteration to
      current->perf_counter_ctxp and RCU, since it really doesn't matter
      which context they iterate, they're all folded.
      Signed-off-by: default avatarPeter 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: default avatarIngo Molnar <mingo@elte.hu>
      665c2142
    • Peter Zijlstra's avatar
      perf_counter: Fix COMM and MMAP events for cpu wide counters · efb3d172
      Peter Zijlstra authored
      Commit a63eaf34 ("perf_counter: Dynamically allocate tasks'
      perf_counter_context struct") broke COMM and MMAP notification for
      cpu wide counters by dropping out early if there was no task context,
      thereby also not iterating the cpu context.
      Signed-off-by: default avatarPeter 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: default avatarIngo Molnar <mingo@elte.hu>
      efb3d172
    • Ingo Molnar's avatar
      perf_counter: Robustify counter-free logic · 012b84da
      Ingo Molnar authored
      This fixes a nasty crash and highlights a bug that we were
      freeing failed-fork() counters incorrectly.
      
      (the fix for that will come separately)
      
      [ Impact: fix crashes/lockups with inherited counters ]
      Acked-by: default avatarPeter 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: default avatarIngo Molnar <mingo@elte.hu>
      012b84da
    • Ingo Molnar's avatar
      perf_counter: Fix cpuctx->task_ctx races · 3f4dee22
      Ingo Molnar authored
      Peter noticed that we are sometimes reading cpuctx->task_ctx with
      interrupts enabled.
      Noticed-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Acked-by: default avatarPeter 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: default avatarIngo Molnar <mingo@elte.hu>
      3f4dee22
    • Paul Mackerras's avatar
      perf_counter: Don't swap contexts containing locked mutex · ad3a37de
      Paul Mackerras authored
      Peter Zijlstra pointed out that under some circumstances, we can take
      the mutex in a context or a counter and then swap that context or
      counter to another task, potentially leading to lock order inversions
      or the mutexes not protecting what they are supposed to protect.
      
      This fixes the problem by making sure that we never take a mutex in a
      context or counter which could get swapped to another task.  Most of
      the cases where we take a mutex is on a top-level counter or context,
      i.e. a counter which has an fd associated with it or a context that
      contains such a counter.  This adds WARN_ON_ONCE statements to verify
      that.
      
      The two cases where we need to take the mutex on a context that is a
      clone of another are in perf_counter_exit_task and
      perf_counter_init_task.  The perf_counter_exit_task case is solved by
      uncloning the context before starting to remove the counters from it.
      The perf_counter_init_task is a little trickier; we temporarily
      disable context swapping for the parent (forking) task by setting its
      ctx->parent_gen to the all-1s value after locking the context, if it
      is a cloned context, and restore the ctx->parent_gen value at the end
      if the context didn't get uncloned in the meantime.
      
      This also moves the increment of the context generation count to be
      within the same critical section, protected by the context mutex, that
      adds the new counter to the context.  That way, taking the mutex is
      sufficient to ensure that both the counter list and the generation
      count are stable.
      
      [ Impact: fix hangs, races with inherited and PID counters ]
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      Acked-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <18975.31580.520676.619896@drongo.ozlabs.ibm.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ad3a37de
    • Ingo Molnar's avatar
      perf_counter tools: Also display time-normalized stat results · be1ac0d8
      Ingo Molnar authored
      Add new column that normalizes counter results by
      'nanoseconds spent running' unit.
      
      Before:
      
       Performance counter stats for '/home/mingo/hackbench':
      
         10469.403605  task clock ticks     (msecs)
                75502  context switches     (events)
                 9501  CPU migrations       (events)
                36158  pagefaults           (events)
          31975676185  CPU cycles           (events)
          26257738659  instructions         (events)
            108740581  cache references     (events)
             54606088  cache misses         (events)
      
       Wall-clock time elapsed:   810.514504 msecs
      
      After:
      
       Performance counter stats for '/home/mingo/hackbench':
      
         10469.403605  task clock ticks     (msecs)
                75502  context switches     #        0.007 M/sec
                 9501  CPU migrations       #        0.001 M/sec
                36158  pagefaults           #        0.003 M/sec
          31975676185  CPU cycles           #     3054.202 M/sec
          26257738659  instructions         #     2508.045 M/sec
            108740581  cache references     #       10.387 M/sec
             54606088  cache misses         #        5.216 M/sec
      
       Wall-clock time elapsed:   810.514504 msecs
      
      The advantage of that column is that it is characteristic of the
      execution workflow, regardless of runtime. Hence 'hackbench 10'
      will look similar to 'hackbench 15' - while the absolute counter
      values are very different.
      
      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: default avatarIngo Molnar <mingo@elte.hu>
      be1ac0d8
    • Ingo Molnar's avatar
      perf_counter tools: Split display into reading and printing · 2996f5dd
      Ingo Molnar authored
      We introduce the extra pass to allow the print-out to possibly
      rely on already read counters.
      
      [ Impact: cleanup ]
      
      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: default avatarIngo Molnar <mingo@elte.hu>
      2996f5dd
    • Ingo Molnar's avatar
      perf_counter tools: Clean up builtin-stat.c's do_perfstat() · c04f5e5d
      Ingo Molnar authored
      [ Impact: cleanup ]
      
      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: default avatarIngo Molnar <mingo@elte.hu>
      c04f5e5d
    • Yong Wang's avatar
      perf_counter/x86: Always use NMI for performance-monitoring interrupt · c323d95f
      Yong Wang authored
      Always use NMI for performance-monitoring interrupt as there could be
      racy situations if we switch between irq and nmi mode frequently.
      Signed-off-by: default avatarYong Wang <yong.y.wang@intel.com>
      LKML-Reference: <20090529052835.GA13657@ywang-moblin2.bj.intel.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      c323d95f
    • Mike Galbraith's avatar
      perf_counter tools: Fix top symbol table max_ip typo · da417a75
      Mike Galbraith authored
      Signed-off-by: default avatarMike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      da417a75
    • Mike Galbraith's avatar
      perf_counter tools: Fix top symbol table dump typo · a3ec8d70
      Mike Galbraith authored
      Signed-off-by: default avatarMike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a3ec8d70
  3. 28 May, 2009 10 commits
    • Mike Galbraith's avatar
      perf_counter tools: Document '--' option parsing terminator · 9e096753
      Mike Galbraith authored
      Signed-off-by: default avatarMike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      9e096753
    • Arnaldo Carvalho de Melo's avatar
      perf_counter tools: Convert builtin-top to use libperf symbol routines · de04687f
      Arnaldo Carvalho de Melo authored
      Now both perf top and report use the same routines.
      Signed-off-by: default avatarArnaldo 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: <20090528175541.GG4747@ghostprotocols.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      de04687f
    • Arnaldo Carvalho de Melo's avatar
      perf_counter tools: Optionally pass a symbol filter to the dso load routines · 69ee69f6
      Arnaldo Carvalho de Melo authored
      Will be used by perf top.
      Signed-off-by: default avatarArnaldo 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: <20090528175526.GF4747@ghostprotocols.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      69ee69f6
    • Arnaldo Carvalho de Melo's avatar
      perf_counter tools: Consolidate dso methods to load kernel symbols · a827c875
      Arnaldo Carvalho de Melo authored
      Now one has just to use dso__load_kernel() optionally passing a vmlinux
      filename.
      
      Will make things easier for perf top that will want to pass a callback
      to filter some symbols.
      Signed-off-by: default avatarArnaldo 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>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a827c875
    • Arnaldo Carvalho de Melo's avatar
      perf_counter tools: struct symbol priv area · 0085c954
      Arnaldo Carvalho de Melo authored
      When creating a dso instance allow asking that all symbols in this dso
      have a private area just before the symbol.
      
      perf top will use this for its counters, etc.
      Signed-off-by: default avatarArnaldo 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: <20090528175513.GD4747@ghostprotocols.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      0085c954
    • Arnaldo Carvalho de Melo's avatar
      perf_counter tools: Move symbol resolution classes from report to libperf · a2928c42
      Arnaldo Carvalho de Melo authored
      Will be used by perf top as well.
      Signed-off-by: default avatarArnaldo 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: <20090528175504.GC4747@ghostprotocols.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a2928c42
    • Paul Mackerras's avatar
      perf_counter: Fix race in attaching counters to tasks and exiting · c93f7669
      Paul Mackerras authored
      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: default avatarPaul Mackerras <paulus@samba.org>
      Acked-by: default avatarPeter 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: default avatarIngo Molnar <mingo@elte.hu>
      c93f7669
    • Ingo Molnar's avatar
      perf_counter tools: report: Add help text for --sort · 63299f05
      Ingo Molnar authored
      Acked-by: default avatarPeter 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: default avatarIngo Molnar <mingo@elte.hu>
      63299f05
    • Peter Zijlstra's avatar
      perf_counter tools: report: Implement header output for --sort variants · ca8cdeef
      Peter Zijlstra authored
      Implement this style of header:
      
       #
       # Overhead          Command       File: Symbol
       # ........          .......       ............
       #
      
      for the various --sort variants as well.
      Signed-off-by: default avatarPeter 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: default avatarIngo Molnar <mingo@elte.hu>
      ca8cdeef
    • Ingo Molnar's avatar
      perf_counter: Fix perf_counter_init_task() on !CONFIG_PERF_COUNTERS · d3e78ee3
      Ingo Molnar authored
      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: default avatarIngo Molnar <mingo@elte.hu>
      d3e78ee3
  4. 27 May, 2009 14 commits
    • Ingo Molnar's avatar
      pref_counter: tools: report: Robustify in case of weird events · 55717314
      Ingo Molnar authored
      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: default avatarIngo Molnar <mingo@elte.hu>
      55717314
    • Ingo Molnar's avatar
      pref_counter: tools: report: Add header printout & prettify · 2d65537e
      Ingo Molnar authored
      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: default avatarIngo Molnar <mingo@elte.hu>
      2d65537e
    • Peter Zijlstra's avatar
      pref_counter: tools: report: Add dso sorting · 55e5ec41
      Peter Zijlstra authored
      Signed-off-by: default avatarPeter 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: default avatarIngo Molnar <mingo@elte.hu>
      55e5ec41
    • Peter Zijlstra's avatar
      perf_counter: tools: report: Add comm sorting · 992444b1
      Peter Zijlstra authored
      Signed-off-by: default avatarPeter 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: default avatarIngo Molnar <mingo@elte.hu>
      992444b1
    • Peter Zijlstra's avatar
      pref_counter: tools: report: Add --sort option · 37f440cb
      Peter Zijlstra authored
      option parsing for dynamic sorting.
      Signed-off-by: default avatarPeter 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: default avatarIngo Molnar <mingo@elte.hu>
      37f440cb
    • Peter Zijlstra's avatar
      perf_counter: tools: report: Dynamic sort/print bits · 1aa16738
      Peter Zijlstra authored
      Make the sorting and printing dynamic.
      Signed-off-by: default avatarPeter 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: default avatarIngo Molnar <mingo@elte.hu>
      1aa16738
    • Peter Zijlstra's avatar
      perf_counter: tools: report: Rework histogram code · e7fb08b1
      Peter Zijlstra authored
      In preparation for configurable sorting, rework the histgram code a bit.
      Signed-off-by: default avatarPeter 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: default avatarIngo Molnar <mingo@elte.hu>
      e7fb08b1
    • Peter Zijlstra's avatar
      perf_counter: tools: report: Add vmlinux support · 450aaa2b
      Peter Zijlstra authored
      Allow to use vmlinux instead of kallsyms.
      Signed-off-by: default avatarPeter 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: default avatarIngo Molnar <mingo@elte.hu>
      450aaa2b
    • Peter Zijlstra's avatar
      perf_counter: tools: /usr/lib/debug%s.debug support · b7a16eac
      Peter Zijlstra authored
      Some distros seem to store debuginfo in weird places.
      Signed-off-by: default avatarPeter 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: default avatarIngo Molnar <mingo@elte.hu>
      b7a16eac
    • Ingo Molnar's avatar
      perf report: Remove <ctype.h> include · d716fba4
      Ingo Molnar authored
      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: default avatarPekka 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: default avatarIngo Molnar <mingo@elte.hu>
      d716fba4
    • Mike Galbraith's avatar
      perf record: Fix the profiling of existing pid or whole box · ef65b2a0
      Mike Galbraith authored
      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: default avatarMike 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: default avatarIngo Molnar <mingo@elte.hu>
      ef65b2a0
    • Ingo Molnar's avatar
      perf_counter tools: Add built-in pager support · a930d2c0
      Ingo Molnar authored
      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: default avatarIngo Molnar <mingo@elte.hu>
      a930d2c0
    • Ingo Molnar's avatar
      perf_counter tools: Rename output.perf to perf.data · 23ac9cbe
      Ingo Molnar authored
      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: default avatarIngo Molnar <mingo@elte.hu>
      23ac9cbe
    • Ingo Molnar's avatar
      perf_counter tools: Introduce stricter C code checking · 16f762a2
      Ingo Molnar authored
      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: default avatarIngo Molnar <mingo@elte.hu>
      16f762a2