1. 21 10月, 2009 2 次提交
    • A
      perf annotate: Remove requirement of passing a symbol name · 8f0b0373
      Arnaldo Carvalho de Melo 提交于
      If the user doesn't pass a symbol name to annotate, it will
      annotate all the symbols that have hits, in order, just like
      'perf report -s comm,dso,symbol'.
      
      This is a natural followup patch to the one that uses
      output_hists to find the symbols with hits.
      
      The common case is to annotate the first few entries at the top
      of a perf report, so lets type less characters.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <1256058509-19678-1-git-send-email-acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      8f0b0373
    • A
      perf annotate: Use the sym_priv_size area for the histogram · e4204992
      Arnaldo Carvalho de Melo 提交于
      We have this sym_priv_size mechanism for attaching private areas
      to struct symbol entries but annotate wasn't using it, adding
      private areas to struct symbol in addition to a ->priv pointer.
      
      Scrap all that and use the sym_priv_size mechanism.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <1256055940-19511-1-git-send-email-acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      e4204992
  2. 20 10月, 2009 7 次提交
    • A
      perf tools: Add ->unmap_ip operation to struct map · ed52ce2e
      Arnaldo Carvalho de Melo 提交于
      We need this because we get section relative addresses when
      reading the symtabs, but when a tool like 'perf annotate' needs
      to match these address to what 'objdump -dS' produces we need
      the address + section back again.
      
      So in annotate now we look at the 'struct hist_entry' instances
      (that weren't really being used) so that we iterate only over
      the symbols that had some hit and get the map where that
      particular hit happened so that we can get the right address to
      match with annotate.
      
      Verified that at least:
      
       perf annotate mmap_read_counter # Uses the ~/bin/perf binary
       perf annotate --vmlinux /home/acme/git/build/perf/vmlinux intel_pmu_enable_all
      
      on a 'perf record perf top' session seems to work.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <1255979877-12533-1-git-send-email-acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ed52ce2e
    • A
      perf timechart: Add a process filter · bbe2987b
      Arjan van de Ven 提交于
      During the Kernel Summit demo of perf/ftrace/timechart, there
      was a feature request to have a process filter for timechart so
      that you can zoom into one or a few processes that you are
      really interested in.
      
      This patch adds basic support for this feature, the -p
      (--process) option now can select a PID or a process name to be
      shown. Multiple -p options are allowed, and the combined set
      will be included in the output.
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20091020070939.7d0fb8a7@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      bbe2987b
    • I
      Merge branch 'perf/urgent' into perf/core · c258449b
      Ingo Molnar 提交于
      Merge reason: Queue up dependent patch.
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c258449b
    • A
      perf timechart: Improve the visual appearance of scheduler delays · 2e600d01
      Arjan van de Ven 提交于
      [from KS feedback]
      
      Currently, scheduler delays are shown in a mostly transparent,
      light yellow color. This color is rather hard to see on several
      screens, especially projectors.
      
      This patch changes the color of the scheduler delays to be a
      much more "hard" yellow that survived the kernel summit
      projector.
      Reported-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: Arjan van de Ven <arjan@linux.intel.com
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20091020064731.20ae126a@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      2e600d01
    • A
      perf timechart: Fix the wakeup-arrows that point to non-visible processes · 3bc2a39c
      Arjan van de Ven 提交于
      The timechart wakeup arrows currently show no process
      information when the waker/wakee are processes that are not
      actually chosen to be shown on the timechart.
      
      This patch fixes this oversight, by looking through all
      processes (after giving preference to visible processes) as well
      as falling back to just showing the PID if no name for the
      process can be resolved.
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20091020064649.0e4959b2@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      3bc2a39c
    • A
      perf tools: Add bunch of missing headers to LIB_H · 79b9ad36
      Arnaldo Carvalho de Melo 提交于
      Build dependencies were not properly mapped out.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1255973491-11626-1-git-send-email-acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      79b9ad36
    • A
      perf tools: Add missing tools/perf/util/include/string.h · 20639c15
      Arnaldo Carvalho de Melo 提交于
      To cure a bunch of:
      
      In file included from util/include/linux/bitmap.h:1,
                       from util/header.h:8,
                       from builtin-trace.c:7:
      util/include/../../../../include/linux/bitmap.h:8:26: error:
      linux/string.h: No such file or directory make: ***
      [builtin-trace.o] Error 1 make: *** Waiting for unfinished
      jobs....
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <srostedt@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      LKML-Reference: <1255972296-11500-1-git-send-email-acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      20639c15
  3. 19 10月, 2009 9 次提交
    • I
      perf stat: Count branches first · dd86e72a
      Ingo Molnar 提交于
      Count branches first, cache-misses second. The reason is that
      on x86 branches are not counted by all counters on all CPUs.
      
      Before:
      
       Performance counter stats for 'ls':
      
             0.756653  task-clock-msecs         #      0.802 CPUs
                    0  context-switches         #      0.000 M/sec
                    0  CPU-migrations           #      0.000 M/sec
                  250  page-faults              #      0.330 M/sec
              2375725  cycles                   #   3139.781 M/sec
              1628129  instructions             #      0.685 IPC
                19643  cache-references         #     25.960 M/sec
                 4608  cache-misses             #      6.090 M/sec
               342532  branches                 #    452.694 M/sec
        <not counted>  branch-misses
      
          0.000943356  seconds time elapsed
      
      After:
      
       Performance counter stats for 'ls':
      
             1.056734  task-clock-msecs         #      0.859 CPUs
                    0  context-switches         #      0.000 M/sec
                    0  CPU-migrations           #      0.000 M/sec
                  259  page-faults              #      0.245 M/sec
              3345932  cycles                   #   3166.295 M/sec
              3074090  instructions             #      0.919 IPC
               616928  branches                 #    583.806 M/sec
                39279  branch-misses            #      6.367 %
                21312  cache-references         #     20.168 M/sec
                 3661  cache-misses             #      3.464 M/sec
      
          0.001230551  seconds time elapsed
      
      (also prettify the printout of branch misses, in case it's
       getting scaled.)
      
      Cc: Tim Blechmann <tim@klingt.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <4ADC3975.8050109@klingt.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ---
       tools/perf/builtin-stat.c |    2 ++
       1 files changed, 2 insertions(+), 0 deletions(-)
      
      diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
      index c373683..95a55ea 100644
      --- a/tools/perf/builtin-stat.c
      +++ b/tools/perf/builtin-stat.c
      @@ -59,6 +59,8 @@ static struct perf_event_attr default_attrs[] = {
         { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_INSTRUCTIONS	},
         { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CACHE_REFERENCES},
         { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CACHE_MISSES	},
      +  { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_INSTRUCTIONS},
      +  { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_MISSES	},
      
       };
      ---
       tools/perf/builtin-stat.c |   20 ++++++++++----------
       1 files changed, 10 insertions(+), 10 deletions(-)
      
      diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
      index 95a55ea..90e0a26 100644
      --- a/tools/perf/builtin-stat.c
      +++ b/tools/perf/builtin-stat.c
      @@ -50,17 +50,17 @@
      
       static struct perf_event_attr default_attrs[] = {
      
      -  { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_TASK_CLOCK	},
      -  { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_CONTEXT_SWITCHES},
      -  { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_CPU_MIGRATIONS	},
      -  { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_PAGE_FAULTS	},
      -
      -  { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES	},
      -  { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_INSTRUCTIONS	},
      -  { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CACHE_REFERENCES},
      -  { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CACHE_MISSES	},
      -  { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_INSTRUCTIONS},
      -  { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_MISSES	},
      +  { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_TASK_CLOCK		},
      +  { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_CONTEXT_SWITCHES	},
      +  { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_CPU_MIGRATIONS		},
      +  { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_PAGE_FAULTS		},
      +
      +  { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES		},
      +  { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_INSTRUCTIONS		},
      +  { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CACHE_REFERENCES	},
      +  { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CACHE_MISSES		},
      +  { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_INSTRUCTIONS	},
      +  { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_MISSES		},
      
       };
      dd86e72a
    • I
      perf stat: Re-align the default_attrs[] array · 56aab464
      Ingo Molnar 提交于
      Clean up the array definition to be vertically aligned.
      
      No functional effects.
      
      Cc: Tim Blechmann <tim@klingt.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <4ADC3975.8050109@klingt.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ---
       tools/perf/builtin-stat.c |    2 ++
       1 files changed, 2 insertions(+), 0 deletions(-)
      
      diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
      index c373683..95a55ea 100644
      --- a/tools/perf/builtin-stat.c
      +++ b/tools/perf/builtin-stat.c
      @@ -59,6 +59,8 @@ static struct perf_event_attr default_attrs[] = {
         { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_INSTRUCTIONS	},
         { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CACHE_REFERENCES},
         { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CACHE_MISSES	},
      +  { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_INSTRUCTIONS},
      +  { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_MISSES	},
      
       };
      56aab464
    • T
      perf stat: Add branch performance events to default output · 12133aff
      Tim Blechmann 提交于
      Adds performance event information about branches
      and branch misses to the default output of perf stat.
      Signed-off-by: NTim Blechmann <tim@klingt.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <4ADC3975.8050109@klingt.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      12133aff
    • R
      perf tools: Display better error messages on missing packages · 1abc7f55
      Randy Dunlap 提交于
      Check for libelf headers and glibc headers separately so that
      the error message correctly identifies which package
      installation is missing/needed.
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Cc: paulus@samba.org
      Cc: a.p.zijlstra@chello.nl
      Cc: efault@gmx.de
      Cc: fweisbec@gmail.com
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <4ADBCCE8.3060300@oracle.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1abc7f55
    • T
      perf top: Fix --delay_secs 0 division by zero · dc79959a
      Tim Blechmann 提交于
      Add delay_secs sanity check to handle_keypress,
      this fixes a division by zero crash.
      Signed-off-by: NTim Blechmann <tim@klingt.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <4AD9EBFD.106@klingt.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      dc79959a
    • F
      perf tools: Use DECLARE_BITMAP instead of an open-coded array · db9f11e3
      Frederic Weisbecker 提交于
      Use DECLARE_BITMAP instead of an open coded array for our bitmap
      of featured sections.
      
      This makes the array an unsigned long instead of a u64 but since
      we use a 256 bits bitmap, the array size shouldn't vary between
      different boxes.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1255795038-13751-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      db9f11e3
    • F
      perf tools: Introduce bitmask'ed additional headers · 2ba08250
      Frederic Weisbecker 提交于
      This provides a new set of bitmasked headers. A new field is
      added in the perf headers that implements a bitmap storing
      optional features present in the perf.data file.
      
      The layout can be pictured like this:
      
      (Usual perf headers)(Features bitmap)[Feature 0][Feature
      n][Feature 255]
      
      If the bit n is set, then the feature n is used in this file.
      They are all set in order. This brings a backward and forward
      compatibility.
      
      The trace_info section has moved into such optional features,
      this is the first and only one for now.
      
      This is backward compatible with the .32 file version although
      it doesn't support the previous separate trace.info file.
      
      And finally it doesn't support the current interim development
      version.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1255792354-11304-2-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      2ba08250
    • F
      perf tools: Use kernel bitmap library · 5a116dd2
      Frederic Weisbecker 提交于
      Use the kernel bitmap library for internal perf tools uses.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1255792354-11304-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      5a116dd2
    • A
      perf stat: Add branch performance metric · 11018201
      Anton Blanchard 提交于
      When we count both branches and branch-misses it is useful to
      print out the percentage of branch-misses:
      
       # perf stat -e branches -e branch-misses /bin/true
      
       Performance counter stats for '/bin/true':
      
               401684  branches                 #      0.000 M/sec
                23301  branch-misses            #      5.801 %
      Signed-off-by: NAnton Blanchard <anton@samba.org>
      Cc: paulus@samba.org
      Cc: a.p.zijlstra@chello.nl
      LKML-Reference: <20091018112923.GQ4808@kryten>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      11018201
  4. 17 10月, 2009 1 次提交
  5. 16 10月, 2009 1 次提交
    • I
      perf tools: Bump version to 0.0.2 · 210f9cb2
      Ingo Molnar 提交于
      We released the first version of perf with 0.0.1 in v2.6.31,
      time to double our version number to 0.0.2 ;-)
      
      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>
      210f9cb2
  6. 15 10月, 2009 20 次提交
    • I
      events: Harmonize event field names and print output names · 434a83c3
      Ingo Molnar 提交于
      Now that we can filter based on fields via perf record, people
      will start using filter expressions and will expect them to
      be obvious.
      
      The primary way to see which fields are available is by looking
      at the trace output, such as:
      
        gcc-18676 [000]   343.011728: irq_handler_entry: irq=0 handler=timer
        cc1-18677 [000]   343.012727: irq_handler_entry: irq=0 handler=timer
        cc1-18677 [000]   343.032692: irq_handler_entry: irq=0 handler=timer
        cc1-18677 [000]   343.033690: irq_handler_entry: irq=0 handler=timer
        cc1-18677 [000]   343.034687: irq_handler_entry: irq=0 handler=timer
        cc1-18677 [000]   343.035686: irq_handler_entry: irq=0 handler=timer
        cc1-18677 [000]   343.036684: irq_handler_entry: irq=0 handler=timer
      
      While 'irq==0' filters work, the 'handler==<x>' filter expression
      does not work:
      
        $ perf record -R -f -a -e irq:irq_handler_entry --filter handler=timer sleep 1
         Error: failed to set filter with 22 (Invalid argument)
      
      The problem is that while an 'irq' field exists and is recognized
      as a filter field - 'handler' does not exist - its name is 'name'
      in the output.
      
      To solve this, we need to synchronize the printout and the field
      names, wherever possible.
      
      In cases where the printout prints a non-field, we enclose
      that information in square brackets, such as:
      
        perf-1380  [013]   724.903505: softirq_exit: vec=9 [action=RCU]
        perf-1380  [013]   724.904482: softirq_exit: vec=1 [action=TIMER]
      
      This way users can use filter expressions more intuitively: all
      fields that show up as 'primary' (non-bracketed) information is
      filterable.
      
      This patch harmonizes the field names for all irq, bkl, power,
      sched and timer events.
      
      We might in fact think about dropping the print format bit of
      generic tracepoints altogether, and just print the fields that
      are being recorded.
      
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      434a83c3
    • I
      tracing/events: Fix locking imbalance in the filter code · a66abe7f
      Ingo Molnar 提交于
      Américo Wang noticed that we have a locking imbalance in the
      error paths of ftrace_profile_set_filter(), causing potential
      leakage of event_mutex.
      
      Also clean up other error codepaths related to event_mutex
      while at it.
      
      Plus fix an initialized variable in the subsystem filter code.
      Reported-by: NAmérico Wang <xiyou.wangcong@gmail.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <2375c9f90910150247u5ccb8e2at58c764e385ffa490@mail.gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a66abe7f
    • L
      perf trace: Add filter Suppport · c171b552
      Li Zefan 提交于
      Add a new option "--filter <filter_str>" to perf record, and
      it should be right after "-e trace_point":
      
       #./perf record -R -f -e irq:irq_handler_entry --filter irq==18
       ^C
       # ./perf trace
                  perf-4303  ... irq_handler_entry: irq=18 handler=eth0
                  init-0     ... irq_handler_entry: irq=18 handler=eth0
                  init-0     ... irq_handler_entry: irq=18 handler=eth0
                  init-0     ... irq_handler_entry: irq=18 handler=eth0
                  init-0     ... irq_handler_entry: irq=18 handler=eth0
      
      See Documentation/trace/events.txt for the syntax of filter
      expressions.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <4AD6955F.90602@cn.fujitsu.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c171b552
    • L
      tracing/profile: Add filter support · 6fb2915d
      Li Zefan 提交于
      - Add an ioctl to allocate a filter for a perf event.
      
      - Free the filter when the associated perf event is to be freed.
      
      - Do the filtering in perf_swevent_match().
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <4AD69546.8050401@cn.fujitsu.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      6fb2915d
    • L
      tracing/filters: Use a different op for glob match · b0f1a59a
      Li Zefan 提交于
      "==" will always do a full match, and "~" will do a glob match.
      
      In the future, we may add "=~" for regex match.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <4AD69528.3050309@cn.fujitsu.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b0f1a59a
    • L
      tracing/filters: Refactor subsystem filter code · fce29d15
      Li Zefan 提交于
      Change:
      	for_each_pred
      		for_each_subsystem
      To:
      	for_each_subsystem
      		for_each_pred
      
      This change also prepares for later patches.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <4AD69502.8060903@cn.fujitsu.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      fce29d15
    • I
      Merge branch 'tracing/core' into perf/core · 713490e0
      Ingo Molnar 提交于
      Merge reason: to add event filter support we need the following
      commits from the tracing tree:
      
       3f6fe06d: tracing/filters: Unify the regex parsing helpers
       1889d209: tracing/filters: Provide basic regex support
       737f453f: tracing/filters: Cleanup useless headers
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      713490e0
    • S
      perf tools: Remove all char * typecasts and use const in prototype · c4dc775f
      Steven Rostedt 提交于
      The (char *) for all the static strings was a fix for the
      symptom and not the disease. The real issue was that the
      function prototypes needed to be declared "const char *".
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <20091014194400.635935008@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c4dc775f
    • S
      perf tools: Handle - and + in parsing trace print format · afdf1a40
      Steven Rostedt 提交于
      The opterators '-' and '+' are not handled in the trace print
      format.
      
      To do: '++' and '--'.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <20091014194400.330843045@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      afdf1a40
    • S
      perf tools: Add latency format to trace output · cda48461
      Steven Rostedt 提交于
      Add the irqs disabled, preemption count, need resched, and other
      info that is shown in the latency format of ftrace.
      
       # perf trace -l
          perf-16457   2..s2. 53636.260344: kmem_cache_free: call_site=ffffffff811198f
          perf-16457   2..s2. 53636.264330: kmem_cache_free: call_site=ffffffff811198f
          perf-16457   2d.s4. 53636.300006: kmem_cache_free: call_site=ffffffff810d889
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <20091014194400.076588953@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      cda48461
    • S
      perf tools: Handle both versions of ftrace output · 0d1da915
      Steven Rostedt 提交于
      The ftrace output events can have either arguments or no
      arguments. The parser needs to be able to handle both.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <20091014194359.790221427@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0d1da915
    • S
      perf tools: Fix bprintk reading in trace output · ffa18955
      Steven Rostedt 提交于
      The bprintk parsing was broken in more ways than one.
      
      The file parsing was incorrect, and the words used by the
      arguments are always 4 bytes aligned, even on 64-bit machines.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <20091014194359.520931637@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ffa18955
    • S
      perf tools: Still continue on failed parsing of an event · 07a4bddd
      Steven Rostedt 提交于
      Even though an event may fail to parse, we should not kill the
      entire report. The trace should still be able to show what it
      can.
      
      If an event fails to parse, a warning is printed, and the output
      continues.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <20091014194359.190809589@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      07a4bddd
    • S
      perf tools: Handle the case with and without the "signed" trace field · 13999e59
      Steven Rostedt 提交于
      The trace format files now have a "signed" field. But we should
      still be able to handle the kernels that do not have this field.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <20091014194358.888239553@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      13999e59
    • S
      perf tools: Handle newlines in trace parsing better · f1d1feec
      Steven Rostedt 提交于
      New lines between args in the trace format can break the
      parsing. This should not be the case.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <20091014194358.637991808@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f1d1feec
    • S
      perf tools: Handle * as typecast in trace parsing · b99af874
      Steven Rostedt 提交于
      The '*' is currently only treated as a multiplication, and it
      needs to be handled as a typecast pointer.
      
      This is the version used by trace-cmd.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <20091014194358.409327875@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b99af874
    • S
      perf tools: Handle arrays in print fields for trace parsing · 0959b8d6
      Steven Rostedt 提交于
      The array used by the ftrace stack events (caller[x]) causes
      issues with the parser. This adds code to handle the case, but
      it also assumes that the array is of type long.
      
      Note, this is a special case used (currently) only by the ftrace
      user and kernel stack records.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <20091014194358.124833639@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0959b8d6
    • S
      perf tools: Handle trace parsing of < and > · 298ebc3e
      Steven Rostedt 提交于
      The code to handle the '<' and '>' ops was all in place, but
      they were not in the switch statement to consider them as valid
      ops.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <20091014194357.807434040@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      298ebc3e
    • S
      perf tools: Fix backslash processing on trace print formats · 91ff2bc1
      Steven Rostedt 提交于
      The handling of backslashes was broken. It would stop parsing
      when encountering one. Also, '\n', '\t', '\r' and '\\' were not
      converted.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <20091014194357.521974680@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      91ff2bc1
    • S
      perf tools: Handle print concatenations in event format file · 924a79af
      Steven Rostedt 提交于
      kmem_alloc ftrace event format had a string that was broken up
      by two tokens. "string 1" "string 2". This patch lets the parser
      be able to handle the concatenation.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <20091014194357.253818714@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      924a79af