1. 15 Apr, 2010 4 commits
    • Ingo Molnar's avatar
      Merge branch 'perf/live' into perf/core · 84b13fd5
      Ingo Molnar authored
      Conflicts:
      	tools/perf/builtin-record.c
      
      Merge reason: add the live tracing feature, resolve conflict.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      84b13fd5
    • Frederic Weisbecker's avatar
      perf: Make the trace events sample period default to 1 · f9212819
      Frederic Weisbecker authored
      Trace events are mostly used for tracing and then require not to
      be lost when possible. As opposite to hardware events that really
      require to trigger after a given sample period, trace events mostly
      need to trigger everytime.
      
      It is a frustrating experience to trace with perf and realize we
      lost a lot of events because we forgot the "-c 1" option.
      
      Then default sample_period to 1 for trace events but let the user
      override it.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      f9212819
    • Frederic Weisbecker's avatar
      perf: Always record tracepoints raw samples from perf record · bdef3b02
      Frederic Weisbecker authored
      Trace events are mostly used for tracing rather than simple
      counting. Don't bother anymore with adding -R when using them,
      just record raw samples of trace events every time.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      bdef3b02
    • Frederic Weisbecker's avatar
      perf: Make -f the default for perf record · 7865e817
      Frederic Weisbecker authored
      Force the overwriting mode by default if append mode is not explicit.
      Adding -f every time one uses perf on a daily basis quickly becomes a
      burden.
      
      Keep the -f among the options though to avoid breaking some random
      users scripts.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      7865e817
  2. 14 Apr, 2010 16 commits
    • Thomas Gleixner's avatar
      perf: Fix dynamic field detection · a1e2f60e
      Thomas Gleixner authored
      Checking if a tracing field is an array with a dynamic length
      requires to check the field type and seek the "__data_loc"
      string that prepends the actual type, as can be found in a trace
      event format file:
      
      	field:__data_loc char[] name;	offset:16;	size:4;	signed:1;
      
      But we actually use strcmp() to check if the field type fully
      matches "__data_loc", which may fail as we trip over the rest of
      the type.
      
      To fix this, use strncmp to only check if it starts with
      "__data_loc".
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1271282283-23721-1-git-send-regression-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a1e2f60e
    • Frederic Weisbecker's avatar
      perf: Fix hlist related build error · 95476b64
      Frederic Weisbecker authored
      hlist helpers need to be available for all software events, not
      only trace events.
      
      Pull them out outside the ifdef CONFIG_EVENT_TRACING section.
      
      Fixes:
      	kernel/perf_event.c:4573: error: implicit declaration of function 'swevent_hlist_put'
      	kernel/perf_event.c:4614: error: implicit declaration of function 'swevent_hlist_get'
      	kernel/perf_event.c:5534: error: implicit declaration of function 'swevent_hlist_release
      Reported-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1271281338-23491-1-git-send-regression-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      95476b64
    • Frederic Weisbecker's avatar
      perf: Make clock software events consistent with general exclusion rules · df8290bf
      Frederic Weisbecker authored
      The cpu/task clock events implement their own version of exclusion
      on top of exclude_user and exclude_kernel.
      
      The result is that when the event triggered in the kernel but we
      have exclude_kernel set, we try to rewind using task_pt_regs.
      There are two side effects of this:
      
      - we call task_pt_regs even on kernel threads, which doesn't give
        us the desired result.
      - if the event occured in the kernel, we shouldn't rewind to the
        user context. We want to actually ignore the event.
      
      get_irq_regs() will always give us the right interrupted context, so
      use its result and submit it to perf_exclude_context() that knows
      when an event must be ignored.
      Signed-off-by: default avatarFrederic 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: Ingo Molnar <mingo@elte.hu>
      df8290bf
    • Frederic Weisbecker's avatar
      perf: Store active software events in a hashlist · 76e1d904
      Frederic Weisbecker authored
      Each time a software event triggers, we need to walk through
      the entire list of events from the current cpu and task contexts
      to retrieve a running perf event that matches.
      We also need to check a matching perf event is actually counting.
      
      This walk is wasteful and makes the event fast path scaling
      down with a growing number of events running on the same
      contexts.
      
      To solve this, we store the running perf events in a hashlist to
      get an immediate access to them against their type:event_id when
      they trigger.
      
      v2: - Fix SWEVENT_HLIST_SIZE definition (and re-learn some basic
            maths along the way)
          - Only allocate hlist for online cpus, but keep track of the
            refcount on offline possible cpus too, so that we allocate it
            if needed when it becomes online.
          - Drop the kref use as it's not adapted to our tricks anymore.
      
      v3: - Fix bad refcount check (address instead of value). Thanks to
            Eric Dumazet who spotted this.
          - While exiting cpu, move the hlist release out of the IPI path
            to lock the hlist mutex sanely.
      Signed-off-by: default avatarFrederic 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: Ingo Molnar <mingo@elte.hu>
      76e1d904
    • Tom Zanussi's avatar
      perf trace: Invoke live mode automatically if record/report not specified · a0cccc2e
      Tom Zanussi authored
      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: default avatarTom Zanussi <tzanussi@gmail.com>
      Acked-by: default avatarThomas 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: default avatarIngo Molnar <mingo@elte.hu>
      a0cccc2e
    • Tom Zanussi's avatar
      perf trace/scripting: Enable scripting shell scripts for live mode · 00b21a01
      Tom Zanussi authored
      It should be possible to run any perf trace script in 'live
      mode'. This requires being able to pass in e.g. '-i -' or other
      args, which the current shell scripts aren't equipped to handle.
       In a few cases, there are required or optional args that also
      need special handling. This patch makes changes the current set
      of shell scripts as necessary.
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Acked-by: default avatarThomas 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-11-git-send-email-tzanussi@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      00b21a01
    • Tom Zanussi's avatar
      perf trace/scripting: Add rwtop and sctop scripts · 47902f36
      Tom Zanussi authored
      A couple of scripts, one in Python and the other in Perl, that
      demonstrate 'live mode' tracing.  For each, the output of the
      perf event stream is fed continuously to the script, which
      continuously aggregates the data and reports the current results
      every 3 seconds, or at the optionally specified interval.  After
      the current results are displayed, the aggregations are cleared
      and the cycle begins anew.
      
      To run the scripts, simply pipe the output of the 'perf trace
      record' step as input to the corresponding 'perf trace report'
      step, using '-' as the filename to -o and -i:
      
       $ perf trace record sctop -o - | perf trace report sctop -i -
      
      Also adds clear_term() utility functions to the Util.pm and
      Util.py utility modules, for use by any script to clear the
      screen.
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Acked-by: default avatarThomas 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-10-git-send-email-tzanussi@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      47902f36
    • Tom Zanussi's avatar
      perf: Convert perf header build_ids into build_id events · c7929e47
      Tom Zanussi authored
      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: default avatarTom Zanussi <tzanussi@gmail.com>
      Acked-by: default avatarThomas 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: default avatarIngo Molnar <mingo@elte.hu>
      c7929e47
    • Tom Zanussi's avatar
      perf: Convert perf tracing data into a tracing_data event · 9215545e
      Tom Zanussi authored
      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: default avatarTom Zanussi <tzanussi@gmail.com>
      Acked-by: default avatarThomas 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: default avatarIngo Molnar <mingo@elte.hu>
      9215545e
    • Tom Zanussi's avatar
      perf: Convert perf event types into event type events · cd19a035
      Tom Zanussi authored
      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: default avatarTom Zanussi <tzanussi@gmail.com>
      Acked-by: default avatarThomas 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: default avatarIngo Molnar <mingo@elte.hu>
      cd19a035
    • Tom Zanussi's avatar
      perf: Convert perf header attrs into attr events · 2c46dbb5
      Tom Zanussi authored
      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: default avatarTom Zanussi <tzanussi@gmail.com>
      Acked-by: default avatarThomas 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: default avatarIngo Molnar <mingo@elte.hu>
      2c46dbb5
    • Tom Zanussi's avatar
      perf trace: Introduce special handling for pipe input · c239da3b
      Tom Zanussi authored
      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: default avatarTom Zanussi <tzanussi@gmail.com>
      Acked-by: default avatarThomas 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: default avatarIngo Molnar <mingo@elte.hu>
      c239da3b
    • Tom Zanussi's avatar
      perf report: Introduce special handling for pipe input · 46656ac7
      Tom Zanussi authored
      Adds special treatment for stdin - if the user specifies '-i -'
      to perf report, the intent is that the event stream be written
      to 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: default avatarTom Zanussi <tzanussi@gmail.com>
      Acked-by: default avatarThomas 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-4-git-send-email-tzanussi@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      46656ac7
    • Tom Zanussi's avatar
      perf record: Introduce special handling for pipe output · 529870e3
      Tom Zanussi authored
      Adds special treatment for stdout - if the user specifies '-o -'
      to perf record, the intent is that the event stream be written
      to stdout rather than to a disk file.
      
      Also, redirect stdout of forked child to stderr - in pipe mode,
      stdout of the forked child interferes with the stdout perf
      stream, so redirect it to stderr where it can still be seen but
      won't be mixed in with the perf output.
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Acked-by: default avatarThomas 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-3-git-send-email-tzanussi@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      529870e3
    • Tom Zanussi's avatar
      perf: Add pipe-specific header read/write and event processing code · 8dc58101
      Tom Zanussi authored
      This patch makes several changes to allow the perf event stream
      to be sent and received over a pipe:
      
      - adds pipe-specific versions of the header read/write code
      
      - adds pipe-specific version of the event processing code
      
      - adds a range of event types to be used for header or other
        pseudo events, above the range used by the kernel
      
      - checks the return value of event handlers, which they can use
        to skip over large events during event processing rather than actually
        reading them into event objects.
      
      - unifies the multiple do_read() functions and updates its
        users.
      
      Note that none of these changes affect the existing perf data
      file format or processing - this code only comes into play if
      perf output is sent to stdout (or is read from stdin).
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Acked-by: default avatarThomas 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-2-git-send-email-tzanussi@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      8dc58101
    • Ian Munsie's avatar
      perf: Fix endianness argument compatibility with OPT_BOOLEAN() and introduce OPT_INCR() · c0555642
      Ian Munsie authored
      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: default avatarIan Munsie <imunsie@au.ibm.com>
      Acked-by: default avatarDavid 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: default avatarIngo Molnar <mingo@elte.hu>
      c0555642
  3. 09 Apr, 2010 1 commit
  4. 08 Apr, 2010 13 commits
  5. 07 Apr, 2010 6 commits