1. 06 Jun, 2009 9 commits
    • Ingo Molnar's avatar
      perf_counter tools: Add 'perf annotate' feature · 0b73da3f
      Ingo Molnar authored
      Add new perf sub-command to display annotated source code:
      
       $ perf annotate decode_tree_entry
      
      ------------------------------------------------
       Percent |	Source code & Disassembly of /home/mingo/git/git
      ------------------------------------------------
               :
               :	/home/mingo/git/git:     file format elf64-x86-64
               :
               :
               :	Disassembly of section .text:
               :
               :	00000000004a0da0 <decode_tree_entry>:
               :		*modep = mode;
               :		return str;
               :	}
               :
               :	static void decode_tree_entry(struct tree_desc *desc, const char *buf, unsigned long size)
               :	{
          3.82 :	  4a0da0:	41 54                	push   %r12
               :		const char *path;
               :		unsigned int mode, len;
               :
               :		if (size < 24 || buf[size - 21])
          0.17 :	  4a0da2:	48 83 fa 17          	cmp    $0x17,%rdx
               :		*modep = mode;
               :		return str;
               :	}
               :
               :	static void decode_tree_entry(struct tree_desc *desc, const char *buf, unsigned long size)
               :	{
          0.00 :	  4a0da6:	49 89 fc             	mov    %rdi,%r12
          0.00 :	  4a0da9:	55                   	push   %rbp
          3.37 :	  4a0daa:	53                   	push   %rbx
               :		const char *path;
               :		unsigned int mode, len;
               :
               :		if (size < 24 || buf[size - 21])
          0.08 :	  4a0dab:	76 73                	jbe    4a0e20 <decode_tree_entry+0x80>
          0.00 :	  4a0dad:	80 7c 16 eb 00       	cmpb   $0x0,-0x15(%rsi,%rdx,1)
          3.48 :	  4a0db2:	75 6c                	jne    4a0e20 <decode_tree_entry+0x80>
               :	static const char *get_mode(const char *str, unsigned int *modep)
               :	{
               :		unsigned char c;
               :		unsigned int mode = 0;
               :
               :		if (*str == ' ')
          1.94 :	  4a0db4:	0f b6 06             	movzbl (%rsi),%eax
          0.39 :	  4a0db7:	3c 20                	cmp    $0x20,%al
          0.00 :	  4a0db9:	74 65                	je     4a0e20 <decode_tree_entry+0x80>
               :			return NULL;
               :
               :		while ((c = *str++) != ' ') {
          0.06 :	  4a0dbb:	89 c2                	mov    %eax,%edx
               :			if (c < '0' || c > '7')
          1.99 :	  4a0dbd:	31 ed                	xor    %ebp,%ebp
               :		unsigned int mode = 0;
               :
               :		if (*str == ' ')
               :			return NULL;
               :
               :		while ((c = *str++) != ' ') {
          1.74 :	  4a0dbf:	48 8d 5e 01          	lea    0x1(%rsi),%rbx
               :			if (c < '0' || c > '7')
          0.00 :	  4a0dc3:	8d 42 d0             	lea    -0x30(%rdx),%eax
          0.17 :	  4a0dc6:	3c 07                	cmp    $0x7,%al
          0.00 :	  4a0dc8:	76 0d                	jbe    4a0dd7 <decode_tree_entry+0x37>
          0.00 :	  4a0dca:	eb 54                	jmp    4a0e20 <decode_tree_entry+0x80>
          0.00 :	  4a0dcc:	0f 1f 40 00          	nopl   0x0(%rax)
         16.57 :	  4a0dd0:	8d 42 d0             	lea    -0x30(%rdx),%eax
          0.14 :	  4a0dd3:	3c 07                	cmp    $0x7,%al
          0.00 :	  4a0dd5:	77 49                	ja     4a0e20 <decode_tree_entry+0x80>
               :				return NULL;
               :			mode = (mode << 3) + (c - '0');
          3.12 :	  4a0dd7:	0f b6 c2             	movzbl %dl,%eax
               :		unsigned int mode = 0;
               :
               :		if (*str == ' ')
               :			return NULL;
               :
               :		while ((c = *str++) != ' ') {
          0.00 :	  4a0dda:	0f b6 13             	movzbl (%rbx),%edx
         16.74 :	  4a0ddd:	48 83 c3 01          	add    $0x1,%rbx
               :			if (c < '0' || c > '7')
               :				return NULL;
               :			mode = (mode << 3) + (c - '0');
      
      The first column is the percentage of samples that arrived on that
      particular line - relative to the total cost of the function.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      0b73da3f
    • Ingo Molnar's avatar
      perf_counter tools: Prepare for 'perf annotate' · 8035e428
      Ingo Molnar authored
      Prepare for the 'perf annotate' implementation by splitting off
      builtin-annotate.c from builtin-report.c.
      
      ( We keep this commit separate to ease the later librarization
        of the facilities that perf-report and perf-annotate shares. )
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      8035e428
    • Ingo Molnar's avatar
      perf_counter tools: Tidy up manpage details · 6e6b754f
      Ingo Molnar authored
      Also fix a misalignment in usage string printing.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      6e6b754f
    • Ingo Molnar's avatar
      perf_counter tools: Uniform help printouts · 502fc5c7
      Ingo Molnar authored
      Also add perf list to command-list.txt.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      502fc5c7
    • Thomas Gleixner's avatar
      perf_counter tools: Add help for perf list · 386b05e3
      Thomas Gleixner authored
      Also update other areas of the help texts.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      386b05e3
    • Ingo Molnar's avatar
      perf_counter tools: Fix cache-event printout · 8faf3b54
      Ingo Molnar authored
      Also standardize the cache printout (so that it can be pasted back
      into the command) and sort out the aliases.
      
      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>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      8faf3b54
    • Thomas Gleixner's avatar
      perf_counter tools: Add 'perf list' to list available events · 86847b62
      Thomas Gleixner authored
      perf list: List all the available event types which can be used in
      -e (--event) options.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      86847b62
    • Ingo Molnar's avatar
      perf_counter: Implement generalized cache event types · 8326f44d
      Ingo Molnar authored
      Extend generic event enumeration with the PERF_TYPE_HW_CACHE
      method.
      
      This is a 3-dimensional space:
      
             { L1-D, L1-I, L2, ITLB, DTLB, BPU } x
             { load, store, prefetch } x
             { accesses, misses }
      
      User-space passes in the 3 coordinates and the kernel provides
      a counter. (if the hardware supports that type and if the
      combination makes sense.)
      
      Combinations that make no sense produce a -EINVAL.
      Combinations that are not supported by the hardware produce -ENOTSUP.
      
      Extend the tools to deal with this, and rewrite the event symbol
      parsing code with various popular aliases for the units and
      access methods above. So 'l1-cache-miss' and 'l1d-read-ops' are
      both valid aliases.
      
      ( x86 is supported for now, with the Nehalem event table filled in,
        and with Core2 and Atom having placeholder tables. )
      
      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>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      8326f44d
    • Ingo Molnar's avatar
      perf_counter: Separate out attr->type from attr->config · a21ca2ca
      Ingo Molnar authored
      Counter type is a frequently used value and we do a lot of
      bit juggling by encoding and decoding it from attr->config.
      
      Clean this up by creating a separate attr->type field.
      
      Also clean up the various similarly complex user-space bits
      all around counter attribute management.
      
      The net improvement is significant, and it will be easier
      to add a new major type (which is what triggered this cleanup).
      
      (This changes the ABI, all tools are adapted.)
      (PowerPC build-tested.)
      
      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>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a21ca2ca
  2. 05 Jun, 2009 16 commits
  3. 04 Jun, 2009 15 commits
    • Frederic Weisbecker's avatar
      perf_counter tools: Fix warn_unused_result warnings · 76a0f40f
      Frederic Weisbecker authored
      Fix warnings for return values that we don't care about:
      
       util/quote.c:222: attention : ignoring return value of ‘fwrite’, declared with attribute warn_unused_result
       util/quote.c:235: attention : ignoring return value of ‘fwrite’, declared with attribute warn_unused_result
       util/quote.c: In function ‘write_name_quotedpfx’:
       util/quote.c:290: attention : ignoring return value of ‘fwrite’, declared with attribute warn_unused_result
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.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: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1244146558-8635-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      76a0f40f
    • Arnaldo Carvalho de Melo's avatar
      perf report: Add -vvv to print the list of threads and its mmaps · 9ac99545
      Arnaldo Carvalho de Melo authored
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      9ac99545
    • Frederic Weisbecker's avatar
      perf_counter: Sleep before refresh using poll in perf top · 0f5486b5
      Frederic Weisbecker authored
      perf top is refreshed every delay_secs the thread runs in such
      loop:
      
      while (sleep(delay_secs)) {
      	print_sym_table();
      }
      
      At the end of print_sym_table(), poll is used without sleep delay
      to check if we have something from stdin.
      
      It means that this check is done only every delay_secs, which can
      be higher that 2 secs if the user defined a custom refresh rate.
      
      We can drop sleep() here and directly use poll to wait between
      refresh periods, so that the reaction after the user stops perf top
      after typing "Enter" is immediate and doesn't suffer from the
      delay_secs latency.
      
      Nb: poll doesn't add any overhead that can parasite perf top measures
      since it sleeps the entire timeout here.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.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: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1244141284-7507-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      0f5486b5
    • Peter Zijlstra's avatar
      perf_counter tools: Use fork and remove munmap events · 62fc4453
      Peter Zijlstra authored
      Use fork events to clone comm and map data and remove everything
      munmap related
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      62fc4453
    • Peter Zijlstra's avatar
      perf_counter: Remove munmap stuff · d99e9446
      Peter Zijlstra authored
      In name of keeping it simple, only track mmap events. Userspace
      will have to remove old overlapping maps when it encounters them.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      d99e9446
    • Peter Zijlstra's avatar
      perf_counter: Add fork event · 60313ebe
      Peter Zijlstra authored
      Create a fork event so that we can easily clone the comm and
      dso maps without having to generate all those events.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      60313ebe
    • Ingo Molnar's avatar
      perf stat: Update help text · 20c84e95
      Ingo Molnar authored
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      20c84e95
    • Ingo Molnar's avatar
      perf report: Bail out if there are unrecognized options/arguments · edc52dea
      Ingo Molnar authored
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      edc52dea
    • Ingo Molnar's avatar
      perf_counter tools: Dont output in color on !tty · 13d0ab5e
      Ingo Molnar authored
      Dont emit ASCII color characters if the terminal is not a tty,
      such as when perf report gets redirected into a file.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      13d0ab5e
    • Ingo Molnar's avatar
      perf_counter tools: Add color terminal output support · 8fc0321f
      Ingo Molnar authored
      Add Git's color printing library to util/color.[ch].
      
      Add it to perf report, with a trivial example to print high-overhead
      entries in red, low-overhead entries in green.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      8fc0321f
    • Peter Zijlstra's avatar
      perf report: Add consistent spacing rules · 71dd8945
      Peter Zijlstra authored
      Make the sort header and the print function have the same column width.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      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>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      71dd8945
    • Ingo Molnar's avatar
      perf report: Print out the total number of events · 05ca061e
      Ingo Molnar authored
      So that the statistical quality of the profile can be estimated at a glance.
      
      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>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      05ca061e
    • Ingo Molnar's avatar
      perf_counter tools: Print out symbol parsing errors only if --verbose · bd74137e
      Ingo Molnar authored
      Also, add a suggestion to 'perf report', if the default sort order is
      used.
      
      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>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      bd74137e
    • Peter Zijlstra's avatar
      perf report: Simplify symbol output · 95ed6fd0
      Peter Zijlstra authored
      The DSO can be printed already - no need to repeat it in the
      symbol field.
      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>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      95ed6fd0
    • Ingo Molnar's avatar
      perf_counter tools: Build with native optimization · af794b94
      Ingo Molnar authored
      Build the tools with -march=native by default.
      
      No measurable difference in speed though, compared to the
      default, on a Nehalem testbox.
      
      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>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      af794b94