1. 15 Dec, 2009 18 commits
    • Masami Hiramatsu's avatar
      perf probe: Check hyphen only argument · ce11a603
      Masami Hiramatsu authored
      Check hyphen only command argument, because perf-probe doesn't
      support event recording feature yet.
      
      e.g.
      
       # perf probe -
        Error: '-' is not supported.
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Jim Keniston <jkenisto@us.ibm.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Frank Ch. Eigler <fche@redhat.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: K.Prasad <prasad@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: systemtap <systemtap@sources.redhat.com>
      Cc: DLE <dle-develop@lists.sourceforge.net>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20091215153128.17436.9266.stgit@dhcp-100-2-132.bos.redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ce11a603
    • Masami Hiramatsu's avatar
      perf probe: Check the result of e_snprintf() · 7e990a51
      Masami Hiramatsu authored
      Fix show_perf_probe_event() to check the result of e_snprintf().
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Jim Keniston <jkenisto@us.ibm.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Frank Ch. Eigler <fche@redhat.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: K.Prasad <prasad@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: systemtap <systemtap@sources.redhat.com>
      Cc: DLE <dle-develop@lists.sourceforge.net>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20091215153121.17436.34674.stgit@dhcp-100-2-132.bos.redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      7e990a51
    • Masami Hiramatsu's avatar
      perf probe: Cleanup struct session in builtin-probe.c · fac13fd5
      Masami Hiramatsu authored
      Clean up struct session in builtin-probe.c, including
      change need_dwarf to bool and move listing flag into
      struct session as list_events flag.
      
      This also changes parse_perf_probe_event() interface
      due to code readability.
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Jim Keniston <jkenisto@us.ibm.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Frank Ch. Eigler <fche@redhat.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: K.Prasad <prasad@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: systemtap <systemtap@sources.redhat.com>
      Cc: DLE <dle-develop@lists.sourceforge.net>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20091215153114.17436.77000.stgit@dhcp-100-2-132.bos.redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      fac13fd5
    • Peter Zijlstra's avatar
      perf_events: Fix perf_event_attr layout · f13c12c6
      Peter Zijlstra authored
      The miss-alignment of bp_addr created a 32bit hole, causing
      different structure packings on 32 and 64 bit machines.
      
      Fix that by moving __reserve_2 into that hole.
      
      Further, remove the useless struct and redundant __bp_reserve
      muck.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <1260902591.8023.781.camel@laptop>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f13c12c6
    • Arnaldo Carvalho de Melo's avatar
      perf diff: Fix documentation · cdccc690
      Arnaldo Carvalho de Melo authored
      Add a newline do fix this problem:
      
      ERROR: perf-diff.txt: line 31: closing [blockdef-listing]
      delimiter expected
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260882082-10007-1-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      cdccc690
    • Ingo Molnar's avatar
      perf diff: Improve the help text · d30531c6
      Ingo Molnar authored
      Fix the short line displayed by 'perf' and also fix some other
      details in the longer text.
      
      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: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      d30531c6
    • Paul Mackerras's avatar
      perf_event: Fix incorrect range check on cpu number · 0f624e7e
      Paul Mackerras authored
      It is quite legitimate for CPUs to be numbered sparsely, meaning
      that it possible for an online CPU to have a number which is
      greater than the total count of possible CPUs.
      
      Currently find_get_context() has a sanity check on the cpu
      number where it checks it against num_possible_cpus().  This
      test can fail for a legitimate cpu number if the
      cpu_possible_mask is sparsely populated.
      
      This fixes the problem by checking the CPU number against
      nr_cpumask_bits instead, since that is the appropriate check to
      ensure that the cpu number is same to pass to cpu_isset()
      subsequently.
      Reported-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      Tested-by: default avatarMichael Neuling <mikey@neuling.org>
      Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Cc: <stable@kernel.org>
      LKML-Reference: <20091215084032.GA18661@brick.ozlabs.ibm.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      0f624e7e
    • Tom Zanussi's avatar
      perf trace/scripting: Update Documentation · a6005123
      Tom Zanussi authored
      Update the perf-trace page with new and missing options and
      remove some unused ones.
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Cc: fweisbec@gmail.com
      Cc: rostedt@goodmis.org
      LKML-Reference: <1260867220-15699-7-git-send-email-tzanussi@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a6005123
    • Tom Zanussi's avatar
      perf trace/scripting: Add 'record' and 'report' options · 3875294f
      Tom Zanussi authored
      Allow scripts to be recorded/executed by simply specifying the
      script root name (the script name minus extension) along with
      'record' or 'report' to 'perf trace'.
      
      The script names shown by 'perf trace -l' can be directly used
      to run the command-line contained within the corresponding
      '-record' and '-report' versions of scripts in the scripts/*/bin
      directories.
      
      For example, to record the trace data needed to run the
      wakeup-latency.pl script, the user can easily find the name of
      the corresponding script from the script list and invoke it
      using 'perf trace record', without having to remember the
      details of how to do the same thing using the lower-level perf
      trace command-line options:
      
      root@tropicana:~# perf trace -l
      List of available trace scripts:
        workqueue-stats                      workqueue stats (ins/exe/create/destroy)
        wakeup-latency                       system-wide min/max/avg wakeup latency
        rw-by-file <comm>                    r/w activity for a program, by file
        check-perf-trace                     useless but exhaustive test script
        rw-by-pid                            system-wide r/w activity
      
      root@tropicana:~# perf trace record wakeup-latency
      ^C[ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.296 MB perf.data (~12931
      samples) ]
      
      To run the wakeup-latency.pl script using the captured data,
      change 'record' to 'report' in the command-line:
      
      root@tropicana:~# perf trace report wakeup-latency
      
      wakeup_latency stats:
      
      total_wakeups: 65
      avg_wakeup_latency (ns): 22417
      min_wakeup_latency (ns): 3470
      max_wakeup_latency (ns): 223311
      
      perf trace Perl script stopped
      
      If the script takes options, thay can be simply added to the end
      of the 'report' invocation:
      
      root@tropicana:~# perf trace record rw-by-file
      ^C[ perf record: Woken up 2 times to write data ]
      [ perf record: Captured and wrote 0.782 MB perf.data (~34171
      samples) ]
      
      root@tropicana:~# perf trace report rw-by-file perf
      
      file read counts for perf:
      
          fd     # reads  bytes_requested
      ------  ----------  -----------
         122        1934     1980416
         120           1          32
      
      file write counts for perf:
      
          fd    # writes  bytes_written
      ------  ----------  -----------
           3        4006      280568
      
      perf trace Perl script stopped
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Cc: fweisbec@gmail.com
      Cc: rostedt@goodmis.org
      LKML-Reference: <1260867220-15699-6-git-send-email-tzanussi@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      3875294f
    • Tom Zanussi's avatar
      perf trace/scripting: List available scripts · 4b9c0c59
      Tom Zanussi authored
      Lists the available perf trace scripts, one per line e.g.:
      
      root@tropicana:~# perf trace -l
      List of available trace scripts:
        workqueue-stats                      workqueue stats (ins/exe/create/destroy)
        wakeup-latency                       system-wide min/max/avg wakeup latency
        rw-by-file <comm>                    r/w activity for a program, by file
        check-perf-trace                     useless but exhaustive test script
        rw-by-pid                            system-wide r/w activity
      
      To be consistent with the other listing options in perf, the
      current latency trace option was changed to '-L', and '-l' is
      now used to access the script listing as:
      
      To create the list, it searches each scripts/*/bin directory for
      files ending with "-report" and reads information found in
      certain comment lines contained in those shell scripts:
      
        - if the comment line starts with "description:", the rest of the
          line is used as a 'half-line' description.  To keep each line in
          the list to a single line, the description should be limited to 40
          characters (the rest of the line contains the script name and
          args)
      
        - if the comment line starts with "args:", the rest of the line
          names the args the script supports.  Required args should be
          surrounded by <> brackets, optional args by [] brackets.
      
      The current scripts in scripts/perl/bin have also been updated
      with description: and args: comments.
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Cc: fweisbec@gmail.com
      Cc: rostedt@goodmis.org
      LKML-Reference: <1260867220-15699-5-git-send-email-tzanussi@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      4b9c0c59
    • Tom Zanussi's avatar
      perf trace/scripting: Check return val of perl_run() · 8f11d85a
      Tom Zanussi authored
      The return value from perl_run() is currently ignored, but it
      should be checked and used to exit perf if there are problems
      loading the script.
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Cc: fweisbec@gmail.com
      Cc: rostedt@goodmis.org
      LKML-Reference: <1260867220-15699-4-git-send-email-tzanussi@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      8f11d85a
    • Tom Zanussi's avatar
      perf trace/scripting: Don't install unneeded files · a3a7cb7b
      Tom Zanussi authored
      README and Makefile.PL don't need to be installed for Perl
      run-time support.
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Cc: fweisbec@gmail.com
      Cc: rostedt@goodmis.org
      LKML-Reference: <1260867220-15699-3-git-send-email-tzanussi@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a3a7cb7b
    • Tom Zanussi's avatar
      perf trace/scripting: Add support for script args · 586bc5cc
      Tom Zanussi authored
      One oversight of the original scripting_ops patch was a lack of
      support for passing args to handler scripts.  This adds
      argc/argv to the start_script() scripting_op, and changes the
      rw-by-file script to take 'comm' arg rather than the 'perf'
      value currently hard-coded.  It also takes the opportunity to do
      some related minor cleanup.
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Cc: fweisbec@gmail.com
      Cc: rostedt@goodmis.org
      LKML-Reference: <1260867220-15699-2-git-send-email-tzanussi@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      586bc5cc
    • Frederic Weisbecker's avatar
      perf tools: Make symbol_conf static · c249a4ce
      Frederic Weisbecker authored
      perf top, report and annotate all define their own symbol_conf,
      it should be static.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260843322-6602-1-git-send-regression-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      c249a4ce
    • Arnaldo Carvalho de Melo's avatar
      perf diff: Introduce tool to show performance difference · 86a9eee0
      Arnaldo Carvalho de Melo authored
      I guess it is enough to show some examples:
      
      [root@doppio linux-2.6-tip]# rm -f perf.data*
      [root@doppio linux-2.6-tip]# ls -la perf.data*
      ls: cannot access perf.data*: No such file or directory
      [root@doppio linux-2.6-tip]# perf record -f find / > /dev/null
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.062 MB perf.data (~2699 samples) ]
      [root@doppio linux-2.6-tip]# ls -la perf.data*
      -rw------- 1 root root 74440 2009-12-14 20:03 perf.data
      [root@doppio linux-2.6-tip]# perf record -f find / > /dev/null
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.062 MB perf.data (~2692 samples) ]
      [root@doppio linux-2.6-tip]# ls -la perf.data*
      -rw------- 1 root root 74280 2009-12-14 20:03 perf.data
      -rw------- 1 root root 74440 2009-12-14 20:03 perf.data.old
      [root@doppio linux-2.6-tip]# perf diff | head -5
         1        -34994580     /lib64/libc-2.10.1.so   _IO_vfprintf_internal
         2        -15307806         [kernel.kallsyms]   __kmalloc
         3    +1   +3665941     /lib64/libc-2.10.1.so   __GI_memmove
         4    +4  +23508995     /lib64/libc-2.10.1.so   _int_malloc
         5    +7  +38538813         [kernel.kallsyms]   __d_lookup
      [root@doppio linux-2.6-tip]# perf diff -p | head -5
         1        +1.00%     /lib64/libc-2.10.1.so   _IO_vfprintf_internal
         2                       [kernel.kallsyms]   __kmalloc
         3    +1             /lib64/libc-2.10.1.so   __GI_memmove
         4    +4             /lib64/libc-2.10.1.so   _int_malloc
         5    +7  -1.00%         [kernel.kallsyms]   __d_lookup
      [root@doppio linux-2.6-tip]# perf diff -v | head -5
         1        361449551 326454971 -34994580     /lib64/libc-2.10.1.so   _IO_vfprintf_internal
         2        151009241 135701435 -15307806         [kernel.kallsyms]   __kmalloc
         3    +1  101805328 105471269  +3665941     /lib64/libc-2.10.1.so   __GI_memmove
         4    +4   78041440 101550435 +23508995     /lib64/libc-2.10.1.so   _int_malloc
         5    +7   59536172  98074985 +38538813         [kernel.kallsyms]   __d_lookup
      [root@doppio linux-2.6-tip]# perf diff -vp | head -5
         1        9.00% 8.00% +1.00%     /lib64/libc-2.10.1.so   _IO_vfprintf_internal
         2        3.00% 3.00%                [kernel.kallsyms]   __kmalloc
         3    +1  2.00% 2.00%            /lib64/libc-2.10.1.so   __GI_memmove
         4    +4  2.00% 2.00%            /lib64/libc-2.10.1.so   _int_malloc
         5    +7  1.00% 2.00% -1.00%         [kernel.kallsyms]   __d_lookup
      [root@doppio linux-2.6-tip]#
      
      This should be enough for diffs where the system is non
      volatile, i.e. when one doesn't updates binaries.
      
      For volatile environments, stay tuned for the next perf tool
      feature: a buildid cache populated by 'perf record', managed by
      'perf buildid-cache' a-la ccache, and used by all the report
      tools.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
      Cc: Stephen Hemminger <shemminger@vyatta.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      LKML-Reference: <1260828571-3613-3-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      86a9eee0
    • Arnaldo Carvalho de Melo's avatar
      perf record: Rename perf.data to perf.data.old if --force/-f is used · b38d3464
      Arnaldo Carvalho de Melo authored
      Suggested-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260828571-3613-2-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      b38d3464
    • Arnaldo Carvalho de Melo's avatar
      perf util: Remove setup_sorting dups · c8829c7a
      Arnaldo Carvalho de Melo authored
      And it is also needed by 'perf diff'.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260828571-3613-1-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      c8829c7a
    • Arnaldo Carvalho de Melo's avatar
      perf session: Event statistics also are per session · f823e441
      Arnaldo Carvalho de Melo authored
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260810361-22828-1-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f823e441
  2. 14 Dec, 2009 12 commits
    • Arnaldo Carvalho de Melo's avatar
      perf session: Adopt the sample_type variable · c019879b
      Arnaldo Carvalho de Melo authored
      All tools had copies, and perf diff would have to specify a
      sample_type_check method just for copying it.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260807780-19377-2-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      c019879b
    • Arnaldo Carvalho de Melo's avatar
      perf session: Adopt resolve_callchain · a328626b
      Arnaldo Carvalho de Melo authored
      This is really a generic library routine, so declutter
      builtin-report.c a bit by moving it to the library.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260807780-19377-1-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a328626b
    • Arnaldo Carvalho de Melo's avatar
      perf session: Move the hist_entries rb tree to perf_session · 4e4f06e4
      Arnaldo Carvalho de Melo authored
      As we'll need to sort multiple times for multiple perf sessions,
      so that we can then do a diff.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260803439-16783-1-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      4e4f06e4
    • Arnaldo Carvalho de Melo's avatar
      perf tools: No need for three rb_trees for sorting hist entries · b9bf0892
      Arnaldo Carvalho de Melo authored
      All hist entries are in only one of them, so use just one and a
      temporary rb_root while sorting/collapsing.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260797831-11220-1-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      b9bf0892
    • Arnaldo Carvalho de Melo's avatar
      perf session: Move kmaps to perf_session · 4aa65636
      Arnaldo Carvalho de Melo authored
      There is still some more work to do to disentangle map creation
      from DSO loading, but this happens only for the kernel, and for
      the early adopters of perf diff, where this disentanglement
      matters most, we'll be testing different kernels, so no problem
      here.
      
      Further clarification: right now we create the kernel maps for
      the various modules and discontiguous kernel text maps when
      loading the DSO, we should do it as a two step process, first
      creating the maps, for multiple mappings with the same DSO
      store, then doing the dso load just once, for the first hit on
      one of the maps sharing this DSO backing store.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260741029-4430-6-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      4aa65636
    • Arnaldo Carvalho de Melo's avatar
      perf session: Move the global threads list to perf_session · b3165f41
      Arnaldo Carvalho de Melo authored
      So that we can process two perf.data files.
      
      We still need to add a O_MMAP mode for perf_session so that we
      can do all the mmap stuff in it.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260741029-4430-5-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      b3165f41
    • Arnaldo Carvalho de Melo's avatar
      perf session: Reduce the number of parms to perf_session__process_events · ec913369
      Arnaldo Carvalho de Melo authored
      By having the cwd/cwdlen in the perf_session struct and
      full_paths in perf_event_ops.
      
      Now its just a matter of passing the ops.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260741029-4430-4-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ec913369
    • Arnaldo Carvalho de Melo's avatar
      perf session: Register the idle thread in perf_session__process_events · 13df45ca
      Arnaldo Carvalho de Melo authored
      No need for all tools to register it and then immediately call
      perf_session__process_events.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260741029-4430-3-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      13df45ca
    • Arnaldo Carvalho de Melo's avatar
      perf session: Ditch register_perf_file_handler · 301a0b02
      Arnaldo Carvalho de Melo authored
      Pass the event_ops to perf_session__process_events instead.
      
      Also move the event_ops definition to session.h, starting to
      move things around to their right place, trimming the many
      unneeded headers we have.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260741029-4430-2-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      301a0b02
    • Arnaldo Carvalho de Melo's avatar
      perf session: Pass the perf_session to the event handling operations · d8f66248
      Arnaldo Carvalho de Melo authored
      They will need it to get the right threads list, etc.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260741029-4430-1-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      d8f66248
    • David Miller's avatar
      perf sched: Fix build failure on sparc · 2cd9046c
      David Miller authored
      Here, tvec->tv_usec is "unsigned int" not "unsigned long".
      
      Since the type is different on every platform, it's probably
      best to just use long printf formats and cast.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      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>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20091213.235622.53363059.davem@davemloft.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      2cd9046c
    • Hitoshi Mitake's avatar
      perf bench: Add "all" pseudo subsystem and "all" pseudo suite · 2044279d
      Hitoshi Mitake authored
      This patch adds a new "all" pseudo subsystem and an "all" pseudo
      suite. These are for testing all subsystem and its all suite, or
      all suite of one subsystem.
      
      (This patch also contains a few trivial comment fixes for
      bench/* and output style fixes. I judged that there are no
      necessity to make them into individual patch.)
      
      Example of use:
      
      | % ./perf bench sched all                      # Test all suites of sched subsystem
      | # Running sched/messaging benchmark...
      | # 20 sender and receiver processes per group
      | # 10 groups == 400 processes run
      |
      |      Total time: 0.414 [sec]
      |
      | # Running sched/pipe benchmark...
      | # Extecuted 1000000 pipe operations between two tasks
      |
      |      Total time: 10.999 [sec]
      |
      |       10.999317 usecs/op
      |           90914 ops/sec
      |
      | % ./perf bench all                            # Test all suites of all subsystems
      | # Running sched/messaging benchmark...
      | # 20 sender and receiver processes per group
      | # 10 groups == 400 processes run
      |
      |      Total time: 0.420 [sec]
      |
      | # Running sched/pipe benchmark...
      | # Extecuted 1000000 pipe operations between two tasks
      |
      |      Total time: 11.741 [sec]
      |
      |       11.741346 usecs/op
      |           85169 ops/sec
      |
      | # Running mem/memcpy benchmark...
      | # Copying 1MB Bytes from 0x7ff33e920010 to 0x7ff3401ae010 ...
      |
      |      808.407437 MB/Sec
      Signed-off-by: default avatarHitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1260691319-4683-1-git-send-email-mitake@dcl.info.waseda.ac.jp>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      2044279d
  3. 12 Dec, 2009 8 commits
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Introduce perf_session class · 94c744b6
      Arnaldo Carvalho de Melo authored
      That does all the initialization boilerplate, opening the file,
      reading the header, checking if it is valid, etc.
      
      And that will as well have the threads list, kmap (now) global
      variable, etc, so that we can handle two (or more) perf.data files
      describing sessions to compare.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260573842-19720-1-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      94c744b6
    • Arnaldo Carvalho de Melo's avatar
      perf symbols: Ditch dso->find_symbol · ea08d8cb
      Arnaldo Carvalho de Melo authored
      It is always wired to dso__find_symbol.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260564999-13371-1-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ea08d8cb
    • Arnaldo Carvalho de Melo's avatar
      perf symbols: Allow lookups by symbol name too · 79406cd7
      Arnaldo Carvalho de Melo authored
      Configurable via symbol_conf.sort_by_name, so that the cost of an
      extra rb_node on all 'struct symbol' instances is not paid by tools
      that only want to decode addresses.
      
      How to use it:
      
      	symbol_conf.sort_by_name = true;
      	symbol_init(&symbol_conf);
      
      	struct map *map = map_groups__find_by_name(kmaps, MAP__VARIABLE, "[kernel.kallsyms]");
      
      	if (map == NULL) {
      		pr_err("couldn't find map!\n");
      		kernel_maps__fprintf(stdout);
      	} else {
      		struct symbol *sym = map__find_symbol_by_name(map, sym_filter, NULL);
      		if (sym == NULL)
      			pr_err("couldn't find symbol %s!\n", sym_filter);
      		else
      			pr_info("symbol %s: %#Lx-%#Lx \n", sym_filter, sym->start, sym->end);
      	}
      
      Looking over the vmlinux/kallsyms is common enough that I'll add a
      variable to the upcoming struct perf_session to avoid the need to
      use map_groups__find_by_name to get the main vmlinux/kallsyms map.
      
      The above example looks on the 'variable' symtab, but it is just
      like that for the functions one.
      
      Also the sort operation is done when we first use
      map__find_symbol_by_name, in a lazy way.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260564622-12392-1-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      79406cd7
    • Arnaldo Carvalho de Melo's avatar
      perf symbols: Add missing "Variables" entry to map_type__name · 22ccec57
      Arnaldo Carvalho de Melo authored
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260552208-6824-1-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      22ccec57
    • Arnaldo Carvalho de Melo's avatar
      perf symbols: Add support for 'variable' symtabs · f1dfa0b1
      Arnaldo Carvalho de Melo authored
      Example:
      
      {
      	u64 addr = strtoull(sym_filter, NULL, 16);
      	struct map *map = map_groups__find(kmaps, MAP__VARIABLE, addr);
      
      	if (map == NULL)
      		pr_err("couldn't find map!\n");
      	else {
      		struct symbol *sym = map__find_symbol(map, addr, NULL);
      		if (sym == NULL)
      			pr_err("couldn't find addr!\n");
      		else
      			pr_info("addr %#Lx is in %s global var\n", addr, sym->name);
      	}
      	exit(0);
      }
      
      Added just after symbol__init() call in 'perf top', then:
      
      {
              u64 addr = strtoull(sym_filter, NULL, 16);
              struct map *map = map_groups__find(kmaps, MAP__VARIABLE, addr);
      
              if (map == NULL)
                      pr_err("couldn't find map!\n");
              else {
                      struct symbol *sym = map__find_symbol(map, addr, NULL);
                      if (sym == NULL)
                              pr_err("couldn't find addr!\n");
                      else
                              pr_info("addr %#Lx is in %s global var\n", addr, sym->name);
              }
              exit(0);
      }
      
      [root@doppio linux-2.6-tip]# grep ' [dD] ' /proc/kallsyms | grep ' sched'
      ffffffff817827d8 d sched_nr_latency
      ffffffff81782ce0 d sched_domains_mutex
      ffffffff8178c070 d schedstr.22423
      ffffffff817909a0 d sched_register_mutex
      ffffffff81823490 d sched_feat_names
      ffffffff81823558 d scheduler_running
      ffffffff818235b8 d sched_clock_running
      ffffffff818235bc D sched_clock_stable
      ffffffff81824f00 d sched_switch_trace
      [root@doppio linux-2.6-tip]# perf top -s 0xffffffff817827d9
      addr 0xffffffff817827d9 is in sched_nr_latency global var
      [root@doppio linux-2.6-tip]# perf top -s ffffffff81782ce0
      addr 0xffffffff81782ce0 is in sched_domains_mutex global var
      [root@doppio linux-2.6-tip]#
      [root@doppio linux-2.6-tip]# perf top -s ffffffff81782ce0 --vmlinux OFF
      The file OFF cannot be used, trying to use /proc/kallsyms...addr 0xffffffff81782ce0 is in sched_domains_mutex global var
      [root@doppio linux-2.6-tip]# perf top -s ffffffff818235bc --vmlinux OFF
      The file OFF cannot be used, trying to use /proc/kallsyms...addr 0xffffffff818235bc is in sched_clock_stable global var
      [root@doppio linux-2.6-tip]#
      
      So it works with both /proc/kallsyms and with ELF symtabs, either
      the one on the vmlinux explicitely passed via --vmlinux or in one
      in the vmlinux_path that matches the buildid for the running kernel
      or the one found in the buildid header section in a perf.data file.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260550239-5372-4-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f1dfa0b1
    • Arnaldo Carvalho de Melo's avatar
      perf symbols: Introduce ELF counterparts to symbol_type__is_a · d45868d3
      Arnaldo Carvalho de Melo authored
      For selecting the right types of symbols in ELF symtabs.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260550239-5372-3-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      d45868d3
    • Arnaldo Carvalho de Melo's avatar
      perf symbols: Introduce symbol_type__is_a · 6893d4ee
      Arnaldo Carvalho de Melo authored
      For selecting the right types of symbols in /proc/kallsyms, will be
      followed by elf_symbol_type__is_a, for the same purpose on ELF
      symtabs.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260550239-5372-2-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      6893d4ee
    • Arnaldo Carvalho de Melo's avatar
      perf symbols: Rename kthreads to kmaps, using another abstraction for it · 9958e1f0
      Arnaldo Carvalho de Melo authored
      Using a struct thread instance just to hold the kernel space maps
      (vmlinux + modules) is overkill and confuses people trying to
      understand the perf symbols abstractions.
      
      The kernel maps are really present in all threads, i.e. the kernel
      is a library, not a separate thread.
      
      So introduce the 'map_groups' abstraction and use it for the kernel
      maps, now in the kmaps global variable.
      
      It, in turn, will move, together with the threads list to the
      perf_file abstraction, so that we can support multiple perf_file
      instances, needed by perf diff.
      
      Brainstormed-with: Eduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260550239-5372-1-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      9958e1f0
  4. 11 Dec, 2009 2 commits