1. 02 6月, 2009 13 次提交
    • P
      perf_counter: tools: Expand the COMM,MMAP event synthesizer · f70e87d7
      Peter Zijlstra 提交于
      Include code to pre-construct mappings based on /proc,
      on system wide recording.
      
      Fix the existing code to properly fill out ->pid and ->tid.
      
      The PID should be the Thread Group ID (PIDTYPE_PID of task->group_leader)
      The TID should be the Thread ID (PIDTYPE_PID of task)
      
      Furthermore, change the default sorting of report to comm,dso for a
      better quick overview.
      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>
      f70e87d7
    • P
      perf_counter: Use PID namespaces properly · 709e50cf
      Peter Zijlstra 提交于
      Stop using task_struct::pid and start using PID namespaces.
      
      PIDs will be reported in the PID namespace of the monitoring
      task at the moment of counter creation.
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Oleg Nesterov <oleg@tv-sign.ru>
      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>
      709e50cf
    • P
      perf_counter: Remove unused prev_state field · bf4e0ed3
      Paul Mackerras 提交于
      This removes the prev_state field of struct perf_counter since
      it is now unused.  It was only used by the cpu migration
      counter, which doesn't use it any more.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      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: <18979.35052.915728.626374@cargo.ozlabs.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      bf4e0ed3
    • P
      perf_counter: Fix cpu migration counter · 3f731ca6
      Paul Mackerras 提交于
      This fixes the cpu migration software counter to count
      correctly even when contexts get swapped from one task to
      another.  Previously the cpu migration counts reported by perf
      stat were bogus, ranging from negative to several thousand for
      a single "lat_ctx 2 8 32" run.  With this patch the cpu
      migration count reported for "lat_ctx 2 8 32" is almost always
      between 35 and 44.
      
      This fixes the problem by adding a call into the perf_counter
      code from set_task_cpu when tasks are migrated.  This enables
      us to use the generic swcounter code (with some modifications)
      for the cpu migration counter.
      
      This modifies the swcounter code to allow a NULL regs pointer
      to be passed in to perf_swcounter_ctx_event() etc.  The cpu
      migration counter does this because there isn't necessarily a
      pt_regs struct for the task available.  In this case, the
      counter will not have interrupt capability - but the migration
      counter didn't have interrupt capability before, so this is no
      loss.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      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: <18979.35006.819769.416327@cargo.ozlabs.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      3f731ca6
    • P
      perf_counter: Initialize per-cpu context earlier on cpu up · f38b0820
      Paul Mackerras 提交于
      This arranges for perf_counter's notifier for cpu hotplug
      operations to be called earlier than the migration notifier in
      sched.c by increasing its priority to 20, compared to the 10
      for the migration notifier.  The reason for doing this is that
      a subsequent commit to convert the cpu migration counter to use
      the generic swcounter infrastructure will add a call into the
      perf_counter subsystem when tasks get migrated.  Therefore the
      perf_counter subsystem needs a chance to initialize its per-cpu
      data for the new cpu before it can get called from the
      migration code.
      
      This also adds a comment to the migration notifier noting that
      its priority needs to be lower than that of the perf_counter
      notifier.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <18981.1900.792795.836858@cargo.ozlabs.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f38b0820
    • M
      perf_counter tools: Fix uninitialized variable in perf-report.c · 10a28255
      Mike Galbraith 提交于
      # make prefix=/usr/local V=1
      gcc -o builtin-report.o -c -O2 -ggdb3 -Wall -Werror -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement   -DSHA1_HEADER='<openssl/sha.h>'  builtin-report.c
      cc1: warnings being treated as errors
      builtin-report.c: In function ‘__cmd_report’:
      builtin-report.c:626: error: ‘cwdlen’ may be used uninitialized in this function
      Signed-off-by: NMike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      LKML-Reference: <new-submission>
      10a28255
    • M
      perf_counter tools: Cleanup Makefile · c1079abd
      Mike Galbraith 提交于
      We currently build perf-stat/record etc, only to do nothing
      with them.  We also install the perf binary in two places,
      $prefix/bin and $perfexec_instdir, which appears to be for
      binaries which perf would exec were a command not linked in.
      Correct this, and comment out broken/incomplete targets dist
      and coverage.
      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>
      c1079abd
    • M
      perf_counter tools: Make .gitignore reflect perf_counter tools files · c25486c5
      Mike Galbraith 提交于
      Make .gitignore reflect perf_counter tools files so
      git status doesn't gripe about untracked files.
      Signed-off-by: NMike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c25486c5
    • A
      perf_counter tools: Add missing rb_erase in dso__delete_symbols · c8c96525
      Arnaldo Carvalho de Melo 提交于
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20090601205057.GB7805@ghostprotocols.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c8c96525
    • A
      perf_counter tools: Use hex2u64 in more places · a0055ae2
      Arnaldo Carvalho de Melo 提交于
      This has also a nice side effect, tools built on newer systems such as
      fedora 10 again work on systems with older versions of glibc:
      
      My workstation:
      
      [acme@doppio ~]$ rpm -q glibc.x86_64
      glibc-2.9-3.x86_64
      
      Test machine:
      
      [acme@emilia ~]$ rpm -q glibc.x86_64
      glibc-2.5-24
      
      Before:
      
      [acme@emilia ~]$ perf
      perf: /lib64/libc.so.6: version `GLIBC_2.7' not found (required by perf)
      [acme@emilia ~]$ nm `which perf` | grep GLIBC_2\.7
                       U __isoc99_sscanf@@GLIBC_2.7
      [acme@emilia ~]$
      
      After:
      [acme@emilia ~]$ perf
      usage: perf [--version] [--help] COMMAND [ARGS]
      
      The most commonly used perf commands are:
         record   Run a command and record its profile into perf.data
         report   Read perf.data (created by perf record) and display the
      profile
         stat     Run a command and gather performance counter statistics
         top      Run a command and profile it
      
      See 'perf help COMMAND' for more information on a specific command.
      [acme@emilia ~]$ nm `which perf` | grep GLIBC_2\.7
      [acme@emilia ~]$
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20090601205019.GA7805@ghostprotocols.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a0055ae2
    • A
      perf_counter tools: Add string.[ch] · ea5cc87c
      Arnaldo Carvalho de Melo 提交于
      Add hex conversion libraries. We are going to replace sscanf()
      uses with them.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ea5cc87c
    • M
      perf_counter tools: Guard against record damaging existing files · 229c4eed
      Mike Galbraith 提交于
      Signed-off-by: NMike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      229c4eed
    • I
      perf_counter: Tidy up style details · 22a4f650
      Ingo Molnar 提交于
       - whitespace fixlets
       - make local variable definitions more consistent
      
      [ 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: NIngo Molnar <mingo@elte.hu>
      22a4f650
  2. 01 6月, 2009 4 次提交
    • P
      perf_counter: Allow software counters to count while task is not running · 880ca15a
      Paul Mackerras 提交于
      This changes perf_swcounter_match() so that per-task software
      counters can count events that occur while their associated
      task is not running.  This will allow us to use the generic
      software counter code for counting task migrations, which can
      occur while the task is not scheduled in.
      
      To do this, we have to distinguish between the situations where
      the counter is inactive because its task has been scheduled
      out, and those where the counter is inactive because it is part
      of a group that was not able to go on the PMU.  In the former
      case we want the counter to count, but not in the latter case.
      If the context is active, we have the latter case.  If the
      context is inactive then we need to know whether the counter
      was counting when the context was last active, which we can
      determine by comparing its ->tstamp_stopped timestamp with the
      context's timestamp.
      
      This also folds three checks in perf_swcounter_match, checking
      perf_event_raw(), perf_event_type() and perf_event_id()
      individually, into a single 64-bit comparison on
      counter->hw_event.config, as an optimization.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      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: <18979.34810.259718.955621@cargo.ozlabs.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      880ca15a
    • P
      perf_counter: Provide functions for locking and pinning the context for a task · 25346b93
      Paul Mackerras 提交于
      This abstracts out the code for locking the context associated
      with a task.  Because the context might get transferred from
      one task to another concurrently, we have to check after
      locking the context that it is still the right context for the
      task and retry if not.  This was open-coded in
      find_get_context() and perf_counter_init_task().
      
      This adds a further function for pinning the context for a
      task, i.e. marking it so it can't be transferred to another
      task.  This adds a 'pin_count' field to struct
      perf_counter_context to indicate that a context is pinned,
      instead of the previous method of setting the parent_gen count
      to all 1s.  Pinning the context with a pin_count is easier to
      undo and doesn't require saving the parent_gen value.  This
      also adds a perf_unpin_context() to undo the effect of
      perf_pin_task_context() and changes perf_counter_init_task to
      use it.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      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: <18979.34748.755674.596386@cargo.ozlabs.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      25346b93
    • I
      Merge branch 'linus' into perfcounters/core · 23db9f43
      Ingo Molnar 提交于
      Merge reason: merge almost-rc8 into perfcounters/core, which was -rc6
                    based - to pick up the latest upstream fixes.
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      23db9f43
    • I
      perf_counter tools: Fix unknown command help text · 27b9613b
      Ingo Molnar 提交于
      Arjan reported this error when entering an unknown command to perf:
      
        $ perf start
        fatal: Uh oh. Your system reports no Git commands at all.
      
      The Git code expects there to be perf-* commands - but since Perf
      is a 'pure' utility with no dash commands anymore, this old assumption
      of Git does not hold anymore. Remove that error check.
      Reported-by: NArjan van de Ven <arjan@linux.intel.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: 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>
      27b9613b
  3. 30 5月, 2009 5 次提交
    • I
      perf_counter tools: Generate per command manpages (and pdf/html, etc.) · c1c2365a
      Ingo Molnar 提交于
      Import Git's nice .txt => {man/html/pdf} generation machinery.
      
      Fix various errors in the Documentation/perf*.txt description as well.
      
      Also fix a bug in builtin-help: we'd map 'perf help top' to 'perftop'
      if only the 'perf' binary is in the default PATH - confusing the manpage
      logic. I dont fully understand why Git did it this way - but i suppose
      it's a migration artifact from their migration from standalone git-xyz
      commands to 'git xyz' commands. The perf tools were always using the
      modern form so it's not an issue there.
      
      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>
      c1c2365a
    • I
      perf_counter tools: Fix 'make install' · 7fbd5544
      Ingo Molnar 提交于
      '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: NIngo Molnar <mingo@elte.hu>
      7fbd5544
    • I
      perf_counter tools: Print 'CPU utilization factor' in builtin-stat · d7c29318
      Ingo Molnar 提交于
      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: NIngo Molnar <mingo@elte.hu>
      d7c29318
    • A
      perf_counter tools: Add locking to perf top · c44613a4
      Arnaldo Carvalho de Melo 提交于
      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: NMike Galbraith <efault@gmx.de>
      Tested-by: NMike Galbraith <efault@gmx.de>
      Signed-off-by: NArnaldo 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: NIngo Molnar <mingo@elte.hu>
      c44613a4
    • A
      perf_counter tools: Shorten the DSO names using cwd · b78c07d4
      Arnaldo Carvalho de Melo 提交于
      [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: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NArnaldo 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: NIngo Molnar <mingo@elte.hu>
      b78c07d4
  4. 29 5月, 2009 18 次提交