1. 24 4月, 2010 1 次提交
    • F
      perf: Use generic sample reordering in perf trace · e0a808c6
      Frederic Weisbecker 提交于
      Use the new generic sample events reordering from perf trace.
      Before that, the displayed traces were ordered as they were
      in the input as recorded by perf record (not time ordered).
      
      This makes eventually perf trace displaying the events as beeing
      time ordered.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      e0a808c6
  2. 14 4月, 2010 7 次提交
    • T
      perf trace: Invoke live mode automatically if record/report not specified · a0cccc2e
      Tom Zanussi 提交于
      Currently, live mode is invoked by explicitly invoking the
      record and report sides and connecting them with a pipe e.g.
      
       $ perf trace record rwtop -o - | perf trace report rwtop 5 -i -
      
      In terms of usability, it's not that bad, but it does require
      the user to type and remember more than necessary.
      
      This patch allows the user to accomplish the same thing without
      specifying the separate record/report steps or the pipe.  So the
      same command as above can be accomplished more simply as:
      
       $ perf trace rwtop 5
      
      Notice that the '-i -' and '-o -' aren't required in this case -
      they're added internally, and that any extra arguments are
      passed along to the report script (but not to the record
      script).
      
      The overall effect is that any of the scripts listed in 'perf
      trace -l' can now be used directly in live mode, with the
      expected arguments, by simply specifying the script and args to
      'perf trace'.
      Signed-off-by: NTom Zanussi <tzanussi@gmail.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: fweisbec@gmail.com
      Cc: rostedt@goodmis.org
      Cc: k-keiichi@bx.jp.nec.com
      Cc: acme@ghostprotocols.net
      LKML-Reference: <1270184365-8281-12-git-send-email-tzanussi@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a0cccc2e
    • T
      perf: Convert perf header build_ids into build_id events · c7929e47
      Tom Zanussi 提交于
      Bypasses the build_id perf header code and replaces it with a
      synthesized event and processing function that accomplishes the
      same thing, used when reading/writing perf data to/from a pipe.
      Signed-off-by: NTom Zanussi <tzanussi@gmail.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: fweisbec@gmail.com
      Cc: rostedt@goodmis.org
      Cc: k-keiichi@bx.jp.nec.com
      Cc: acme@ghostprotocols.net
      LKML-Reference: <1270184365-8281-9-git-send-email-tzanussi@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c7929e47
    • T
      perf: Convert perf tracing data into a tracing_data event · 9215545e
      Tom Zanussi 提交于
      Bypasses the tracing_data perf header code and replaces it with
      a synthesized event and processing function that accomplishes
      the same thing, used when reading/writing perf data to/from a
      pipe.
      
      The tracing data is pretty large, and this patch doesn't attempt
      to break it down into component events.  The tracing_data event
      itself doesn't actually contain the tracing data, rather it
      arranges for the event processing code to skip over it after
      it's read, using the skip return value added to the event
      processing loop in a previous patch.
      Signed-off-by: NTom Zanussi <tzanussi@gmail.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: fweisbec@gmail.com
      Cc: rostedt@goodmis.org
      Cc: k-keiichi@bx.jp.nec.com
      Cc: acme@ghostprotocols.net
      LKML-Reference: <1270184365-8281-8-git-send-email-tzanussi@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      9215545e
    • T
      perf: Convert perf event types into event type events · cd19a035
      Tom Zanussi 提交于
      Bypasses the event type perf header code and replaces it with a
      synthesized event and processing function that accomplishes the
      same thing, used when reading/writing perf data to/from a pipe.
      Signed-off-by: NTom Zanussi <tzanussi@gmail.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: fweisbec@gmail.com
      Cc: rostedt@goodmis.org
      Cc: k-keiichi@bx.jp.nec.com
      Cc: acme@ghostprotocols.net
      LKML-Reference: <1270184365-8281-7-git-send-email-tzanussi@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      cd19a035
    • T
      perf: Convert perf header attrs into attr events · 2c46dbb5
      Tom Zanussi 提交于
      Bypasses the attr perf header code and replaces it with a
      synthesized event and processing function that accomplishes the
      same thing, used when reading/writing perf data to/from a pipe.
      
      Making the attrs into events allows them to be streamed over a
      pipe along with the rest of the header data (in later patches).
      It also paves the way to allowing events to be added and removed
      from perf sessions dynamically.
      Signed-off-by: NTom Zanussi <tzanussi@gmail.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: fweisbec@gmail.com
      Cc: rostedt@goodmis.org
      Cc: k-keiichi@bx.jp.nec.com
      Cc: acme@ghostprotocols.net
      LKML-Reference: <1270184365-8281-6-git-send-email-tzanussi@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      2c46dbb5
    • T
      perf trace: Introduce special handling for pipe input · c239da3b
      Tom Zanussi 提交于
      Adds special treatment for stdin - if the user specifies '-i -'
      to perf trace, the intent is that the event stream be read from
      stdin rather than from a disk file.
      
      The actual handling of the '-' filename is done by the session;
      this just adds a signal handler to stop reporting, and turns off
      interference by the pager.
      Signed-off-by: NTom Zanussi <tzanussi@gmail.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: fweisbec@gmail.com
      Cc: rostedt@goodmis.org
      Cc: k-keiichi@bx.jp.nec.com
      Cc: acme@ghostprotocols.net
      LKML-Reference: <1270184365-8281-5-git-send-email-tzanussi@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c239da3b
    • I
      perf: Fix endianness argument compatibility with OPT_BOOLEAN() and introduce OPT_INCR() · c0555642
      Ian Munsie 提交于
      Parsing an option from the command line with OPT_BOOLEAN on a
      bool data type would not work on a big-endian machine due to the
      manner in which the boolean was being cast into an int and
      incremented. For example, running 'perf probe --list' on a
      PowerPC machine would fail to properly set the list_events bool
      and would therefore print out the usage information and
      terminate.
      
      This patch makes OPT_BOOLEAN work as expected with a bool
      datatype. For cases where the original OPT_BOOLEAN was
      intentionally being used to increment an int each time it was
      passed in on the command line, this patch introduces OPT_INCR
      with the old behaviour of OPT_BOOLEAN (the verbose variable is
      currently the only such example of this).
      
      I have reviewed every use of OPT_BOOLEAN to verify that a true
      C99 bool was passed. Where integers were used, I verified that
      they were only being used for boolean logic and changed them to
      bools to ensure that they would not be mistakenly used as ints.
      The major exception was the verbose variable which now uses
      OPT_INCR instead of OPT_BOOLEAN.
      Signed-off-by: NIan Munsie <imunsie@au.ibm.com>
      Acked-by: NDavid S. Miller <davem@davemloft.net>
      Cc: <stable@kernel.org> # NOTE: wont apply to .3[34].x cleanly, please backport
      Cc: Git development list <git@vger.kernel.org>
      Cc: Ian Munsie <imunsie@au1.ibm.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Eric B Munson <ebmunson@us.ibm.com>
      Cc: Valdis.Kletnieks@vt.edu
      Cc: WANG Cong <amwang@redhat.com>
      Cc: Thiago Farina <tfransosi@gmail.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      Cc: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Anton Blanchard <anton@samba.org>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1271147857-11604-1-git-send-email-imunsie@au.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c0555642
  3. 04 3月, 2010 2 次提交
  4. 25 2月, 2010 1 次提交
  5. 24 2月, 2010 1 次提交
    • T
      perf/scripts: Fix supported language listing option · f526d68b
      Tom Zanussi 提交于
      'perf trace -s list' prints a list of the supported scripting
      languages.  One problem with it is that it falls through and prints
      the trace as well.  The use of 'list' for this also makes it easy to
      confuse with 'perf trace -l', used for listing available scripts.  So
      change 'perf trace -s list' to 'perf trace -s lang' and fixes the
      fall-through problem.
      Signed-off-by: NTom Zanussi <tzanussi@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Keiichi KII <k-keiichi@bx.jp.nec.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <1264580883-15324-2-git-send-email-tzanussi@gmail.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      f526d68b
  6. 27 1月, 2010 1 次提交
  7. 16 1月, 2010 1 次提交
  8. 28 12月, 2009 3 次提交
  9. 19 12月, 2009 1 次提交
    • A
      perf diff: Fix usage array, it must end with a NULL entry · 0422a4fc
      Arnaldo Carvalho de Melo 提交于
      Fixing this:
      
       [acme@doppio linux-2.6-tip]$ perf diff --hell
         Error: unknown option `hell'
      
        usage: perf diff [<options>] [old_file] [new_file]
       Segmentation fault
       [acme@doppio linux-2.6-tip]$
      
      Also go over the other such arrays to check if they all were OK,
      they are, but there were some minor changes to do like making
      one static and renaming another to match the command it refers
      to.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic 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: <1261161358-23959-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0422a4fc
  10. 16 12月, 2009 2 次提交
  11. 15 12月, 2009 5 次提交
    • T
      perf trace/scripting: Add 'record' and 'report' options · 3875294f
      Tom Zanussi 提交于
      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: NTom 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: NIngo Molnar <mingo@elte.hu>
      3875294f
    • T
      perf trace/scripting: List available scripts · 4b9c0c59
      Tom Zanussi 提交于
      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: NTom 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: NIngo Molnar <mingo@elte.hu>
      4b9c0c59
    • T
      perf trace/scripting: Add support for script args · 586bc5cc
      Tom Zanussi 提交于
      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: NTom 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: NIngo Molnar <mingo@elte.hu>
      586bc5cc
    • A
      perf session: Event statistics also are per session · f823e441
      Arnaldo Carvalho de Melo 提交于
      Signed-off-by: NArnaldo 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: NIngo Molnar <mingo@elte.hu>
      f823e441
    • A
      perf session: Adopt the sample_type variable · c019879b
      Arnaldo Carvalho de Melo 提交于
      All tools had copies, and perf diff would have to specify a
      sample_type_check method just for copying it.
      Signed-off-by: NArnaldo 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: NIngo Molnar <mingo@elte.hu>
      c019879b
  12. 14 12月, 2009 7 次提交
  13. 12 12月, 2009 1 次提交
    • A
      perf tools: Introduce perf_session class · 94c744b6
      Arnaldo Carvalho de Melo 提交于
      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: NArnaldo 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: NIngo Molnar <mingo@elte.hu>
      94c744b6
  14. 07 12月, 2009 1 次提交
    • O
      perf: Make common SAMPLE_EVENT parser · 180f95e2
      OGAWA Hirofumi 提交于
      Currently, sample event data is parsed for each commands, and it
      is assuming that the data is not including other data. (E.g.
      timechart, trace, etc. can't parse the event if it has
      PERF_SAMPLE_CALLCHAIN)
      
      So, even if we record the superset data for multiple commands at
      a time, commands can't parse. etc.
      
      To fix it, this makes common sample event parser, and use it to
      parse sample event correctly. (PERF_SAMPLE_READ is unsupported
      for now though, it seems to be not using.)
      Signed-off-by: NOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <87hbs48imv.fsf@devron.myhome.or.jp>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      180f95e2
  15. 28 11月, 2009 4 次提交
    • I
      perf scripting: Fix build · cf72344d
      Ingo Molnar 提交于
      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: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      cf72344d
    • T
      perf trace: Add Perl scripting support · 16c632de
      Tom Zanussi 提交于
      Implement trace_scripting_ops to make Perl a supported perf
      trace scripting language.
      
      Additionally adds code that allows Perl trace scripts to access
      the 'flag' and 'symbolic' (__print_flags(), __print_symbolic())
      field information parsed from the trace format files.
      
      Also adds the Perl implementation of the generate_script()
      trace_scripting_op, which creates a ready-to-run perf trace Perl
      script based on existing trace data.  Scripts generated by this
      implementation print out all the fields for each event mentioned
      in perf.data (and will detect and generate the proper scripting
      code for 'flag' and 'symbolic' fields), and will additionally
      generate handlers for the special 'trace_unhandled',
      'trace_begin' and 'trace_end' handlers.  Script authors can
      simply remove the printing code to implement their own custom
      event handling.
      Signed-off-by: NTom Zanussi <tzanussi@gmail.com>
      Cc: fweisbec@gmail.com
      Cc: rostedt@goodmis.org
      Cc: anton@samba.org
      Cc: hch@infradead.org
      LKML-Reference: <1259133352-23685-4-git-send-email-tzanussi@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      16c632de
    • T
      perf trace: Add scripting ops · 956ffd02
      Tom Zanussi 提交于
      Adds an interface, scripting_ops, that when implemented for a
      particular scripting language enables built-in support for trace
      stream processing using that language.
      
      The interface is designed to enable full-fledged language
      interpreters to be embedded inside the perf executable and
      thereby make the full capabilities of the supported languages
      available for trace processing.
      
      See below for details on the interface.
      
      This patch also adds a couple command-line options to 'perf
      trace':
      
      The -s option option is used to specify the script to be run.
      Script names that can be used with -s take the form:
      
      [language spec:]scriptname[.ext]
      
      Scripting languages register a set of 'language specs' that can
      be used to specify scripts for the registered languages.  The
      specs can be used either as prefixes or extensions.
      
      If [language spec:] is used, the script is taken as a script of
      the matching language regardless of any extension it might have.
       If [language spec:] is not used, [.ext] is used to look up the
      language it corresponds to.  Language specs are case
      insensitive.
      
      e.g. Perl scripts can be specified in the following ways:
      
      Perl:scriptname
      pl:scriptname.py # extension ignored
      PL:scriptname
      scriptname.pl
      scriptname.perl
      
      The -g [language spec] option gives users an easy starting point
      for writing scripts in the specified language.  Scripting
      support for a particular language can implement a
      generate_script() scripting op that outputs an empty (or
      near-empty) set of handlers for all the events contained in a
      given perf.data trace file - this option gives users a direct
      way to access that.
      
      Adding support for a scripting language
      ---------------------------------------
      
      The main thing that needs to be done do add support for a new
      language is to implement the scripting_ops interface:
      
      It consists of the following four functions:
      
          start_script()
          stop_script()
          process_event()
          generate_script()
      
      start_script() is called before any events are processed, and is
      meant to give the scripting language support an opportunity to
      set things up to receive events e.g. create and initialize an
      instance of a language interpreter.
      
      stop_script() is called after all events are processed, and is
      meant to give the scripting language support an opportunity to
      clean up e.g. destroy the interpreter instance, etc.
      
      process_event() is called once for each event and takes as its
      main parameter a pointer to the binary trace event record to be
      processed. The implementation is responsible for picking out the
      binary fields from the event record and sending them to the
      script handler function associated with that event e.g. a
      function derived from the event name it's meant to handle e.g.
      'sched::sched_switch()'.  The 'format' information for trace
      events can be used to parse the binary data and map it into a
      form usable by a given scripting language; see the Perl
      implemention in subsequent patches for one possible way to
      leverage the existing trace format parsing code in perf and map
      that info into specific scripting language types.
      
      generate_script() should generate a ready-to-run script for the
      current set of events in the trace, preferably with bodies that
      print out every field for each event.  Again, look at the Perl
      implementation for clues as to how that can be done.  This is an
      optional, but very useful op.
      
      Support for a given language should also add a language-specific
      setup function and call it from setup_scripting().  The
      language-specific setup function associates the the scripting
      ops for that language with one or more 'language specifiers'
      (see below) using script_spec_register().  When a script name is
      specified on the command line, the scripting ops associated with
      the specified language are used to instantiate and use the
      appropriate interpreter to process the trace stream.
      
      In general, it should be relatively easy to add support for a
      new language, especially if the language implementation supports
      an interface allowing an interpreter to be 'embedded' inside
      another program (in this case the containing program will be
      'perf trace'). If so, it should be relatively straightforward to
      translate trace events into invocations of user-defined script
      functions where e.g. the function name corresponds to the event
      type and the function parameters correspond to the event fields.
       The event and field type information exported by the event
      tracing infrastructure (via the event 'format' files) should be
      enough to parse and send any piece of trace data to the user
      script.  The easiest way to see how this can be done would be to
      look at the Perl implementation contained in
      perf/util/trace-event-perl.c/.h.
      
      There are a couple of other things that aren't covered by the
      scripting_ops or setup interface and are technically optional,
      but should be implemented if possible.  One of these is support
      for 'flag' and 'symbolic' fields e.g. being able to use more
      human-readable values such as 'GFP_KERNEL' or
      HI/BLOCK_IOPOLL/TASKLET in place of raw flag values.  See the
      Perl implementation to see how this can be done. The other thing
      is support for 'calling back' into the perf executable to access
      e.g. uncommon fields not passed by default into handler
      functions, or any metadata the implementation might want to make
      available to users via the language interface.  Again, see the
      Perl implementation for examples.
      Signed-off-by: NTom Zanussi <tzanussi@gmail.com>
      Cc: fweisbec@gmail.com
      Cc: rostedt@goodmis.org
      Cc: anton@samba.org
      Cc: hch@infradead.org
      LKML-Reference: <1259133352-23685-2-git-send-email-tzanussi@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      956ffd02
    • A
      perf tools: Reorganize event processing routines, lotsa dups killed · 62daacb5
      Arnaldo Carvalho de Melo 提交于
      While implementing event__preprocess_sample, that will do all of
      the symbol lookup in one convenient function, I noticed that
      util/process_event.[ch] were not being used at all, then started
      looking if there were other functions that could be shared
      and...
      
      All those functions really don't need to receive offset + head,
      the only thing they did was common to all of them, so do it at
      one place instead.
      
      Stats about number of each type of event processed now is done
      in a central place.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1259346563-12568-11-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      62daacb5
  16. 24 11月, 2009 2 次提交
    • A
      perf symbols: Simplify symbol machinery setup · b32d133a
      Arnaldo Carvalho de Melo 提交于
      And also express its configuration toggles via a struct.
      
      Now all one has to do is to call symbol__init(NULL) if the
      defaults are OK, or pass a struct symbol_conf pointer with the
      desired configuration.
      
      If a tool uses kernel_maps__find_symbol() to look at the kernel
      and modules mappings for a symbol but didn't call symbol__init()
      first, that will generate a one time warning too, alerting the
      subcommand developer that symbol__init() must be called.
      Signed-off-by: NArnaldo 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: <1259071517-3242-2-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b32d133a
    • A
      perf symbols: Look for vmlinux in more places · cc612d81
      Arnaldo Carvalho de Melo 提交于
      Now that we can check the buildid to see if it really matches,
      this can be done safely:
      
        vmlinux
        /boot/vmlinux
        /boot/vmlinux-<uts.release>
        /lib/modules/<uts.release>/build/vmlinux
        /usr/lib/debug/lib/modules/%s/vmlinux
      
      More can be added - if you know about distros that put the
      vmlinux somewhere else please let us know.
      Signed-off-by: NArnaldo 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: <1259001550-8194-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      cc612d81