1. 24 1月, 2011 6 次提交
    • A
      perf tools: Move event__parse_sample to evsel.c · d0dd74e8
      Arnaldo Carvalho de Melo 提交于
      To avoid linking more stuff in the python binding I'm working on, future
      csets will make the sample type be taken from the evsel itself, but for
      that we need to first have one file per cpu and per sample_type, not a
      single perf.data file.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d0dd74e8
    • A
      perf threads: Move thread_map to separate file · fd78260b
      Arnaldo Carvalho de Melo 提交于
      To untangle it from struct thread handling, that is tied to symbols, etc.
      
      Right now in the python bindings I'm working on I need just a subset of
      the util/ files, untangling it allows me to do that.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      fd78260b
    • A
      perf tools: Pass the struct opt to the wildcard parsing routine · 17ea1b70
      Arnaldo Carvalho de Melo 提交于
      It is needed because it will call parse_event for each tracepoint
      name that matches, and we pass the perf_evlist via opt->value.
      
      Problem introduced in 4503fdd where my assumption about opt being
      always non NULL made me not look at callers of parse_events outside
      builtin-*.c.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      17ea1b70
    • M
      perf probe: Add --funcs to show available functions in symtab · e80711ca
      Masami Hiramatsu 提交于
      Add --funcs to show available functions in symtab.
      
      Originally this feature came from Srikar's uprobes patches
      ( http://lkml.org/lkml/2010/8/27/244 )
      
      e.g.
      ...
      __ablkcipher_walk_complete
      __absent_pages_in_range
      __account_scheduler_latency
      __add_pages
      __alloc_pages_nodemask
      __alloc_percpu
      __alloc_reserved_percpu
      __alloc_skb
      __alloc_workqueue_key
      __any_online_cpu
      __ata_ehi_push_desc
      ...
      
      This also supports symbols in module, e.g.
      
      ...
      cleanup_module
      cpuid_maxphyaddr
      emulate_clts
      emulate_instruction
      emulate_int_real
      emulate_invlpg
      emulator_get_dr
      emulator_set_dr
      emulator_task_switch
      emulator_write_emulated
      emulator_write_phys
      fx_init
      ...
      
      Original-patch-from: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: 2nddept-manager@sdl.hitachi.co.jp
      Cc: Franck Bui-Huu <fbuihuu@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20110113124611.22426.10835.stgit@ltc236.sdl.hitachi.co.jp>
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      [ committer note: Add missing elf.h for STB_GLOBAL that broke a RHEL4 build ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e80711ca
    • M
      perf probe: Enable to put probe inline function call site · 5069ed86
      Masami Hiramatsu 提交于
      Enable to put probe inline function call site. This will increase line-based
      probe-ability.
      
      <Without this patch>
      $ ./perf probe -L schedule:48
      <schedule:48>
                      pre_schedule(rq, prev);
      
           50         if (unlikely(!rq->nr_running))
                              idle_balance(cpu, rq);
      
                      put_prev_task(rq, prev);
                      next = pick_next_task(rq);
      
           56         if (likely(prev != next)) {
                              sched_info_switch(prev, next);
                              trace_sched_switch_out(prev, next);
                              perf_event_task_sched_out(prev, next);
      
      <With this patch>
      $ ./perf probe -L schedule:48
      <schedule:48>
           48         pre_schedule(rq, prev);
      
           50         if (unlikely(!rq->nr_running))
           51                 idle_balance(cpu, rq);
      
           53         put_prev_task(rq, prev);
           54         next = pick_next_task(rq);
      
           56         if (likely(prev != next)) {
           57                 sched_info_switch(prev, next);
           58                 trace_sched_switch_out(prev, next);
           59                 perf_event_task_sched_out(prev, next);
      
      Cc: 2nddept-manager@sdl.hitachi.co.jp
      Cc: Franck Bui-Huu <fbuihuu@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20110113124604.22426.48873.stgit@ltc236.sdl.hitachi.co.jp>
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5069ed86
    • M
      perf probe: Introduce lines walker interface · 4cc9cec6
      Masami Hiramatsu 提交于
      Introduce die_walk_lines() for walking on the line list of given die, and use
      it in line_range finder and probe point finder.
      
      Cc: 2nddept-manager@sdl.hitachi.co.jp
      Cc: Franck Bui-Huu <fbuihuu@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20110113124558.22426.48170.stgit@ltc236.sdl.hitachi.co.jp>
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      [ committer note: s/%ld/%zd/ for a size_t nlines var that broke f14 x86 build]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4cc9cec6
  2. 23 1月, 2011 16 次提交
    • F
      perf callchain: Don't give arbitrary gender to callchain tree nodes · 529363b7
      Frederic Weisbecker 提交于
      Some little callchain tree nodes shyly asked me if they can have
      sisters.
      
      How cute!
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <1294977121-5700-5-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      529363b7
    • F
      perf callchain: Rename register_callchain_param into callchain_register_param · 16537f13
      Frederic Weisbecker 提交于
      To make the callchain API naming more consistent.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <1294977121-5700-4-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      16537f13
    • F
      perf callchain: Rename cumul_hits into callchain_cumul_hits · f08c3154
      Frederic Weisbecker 提交于
      That makes the callchain API naming more consistent and
      reduce potential naming clashes.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <1294977121-5700-3-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f08c3154
    • F
      perf callchain: Feed callchains into a cursor · 1b3a0e95
      Frederic Weisbecker 提交于
      The callchains are fed with an array of a fixed size.
      As a result we iterate over each callchains three times:
      
      - 1st to resolve symbols
      - 2nd to filter out context boundaries
      - 3rd for the insertion into the tree
      
      This also involves some pairs of memory allocation/deallocation
      everytime we insert a callchain, for the filtered out array of
      addresses and for the array of symbols that comes along.
      
      Instead, feed the callchains through a linked list with persistent
      allocations. It brings several pros like:
      
      - Merge the 1st and 2nd iterations in one. That was possible before
      but in a way that would involve allocating an array slightly taller
      than necessary because we don't know in advance the number of context
      boundaries to filter out.
      
      - Much lesser allocations/deallocations. The linked list keeps
      persistent empty entries for the next usages and is extendable at
      will.
      
      - Makes it easier for multiple sources of callchains to feed a
      stacktrace together. This is deemed to pave the way for cfi based
      callchains wherein traditional frame pointer based kernel
      stacktraces will precede cfi based user ones, producing an overall
      callchain which size is hardly predictable. This requirement
      makes the static array obsolete and makes a linked list based
      iterator a much more flexible fit.
      
      Basic testing on a big perf file containing callchains (~ 176 MB)
      has shown a throughput gain of about 11% with perf report.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <1294977121-5700-2-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1b3a0e95
    • A
      perf evlist: Steal mmap reading routine from 'perf top' · 04391deb
      Arnaldo Carvalho de Melo 提交于
      Will be used in the upcoming 'perf test' entry for the evlist mmap
      routines.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      04391deb
    • A
      perf tools: Add missing cpu_map__delete() · 915fce20
      Arnaldo Carvalho de Melo 提交于
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      915fce20
    • A
      perf evlist: Move the mmap array from perf_evsel · 70db7533
      Arnaldo Carvalho de Melo 提交于
      Adopting the new model used in 'perf record', where we don't have a map
      per thread per cpu, instead we have an mmap per cpu, established on the
      first fd for that cpu and ask the kernel using the
      PERF_EVENT_IOC_SET_OUTPUT ioctl to send events for the other fds on that
      cpu for the one with the mmap.
      
      The methods moved from perf_evsel to perf_evlist, but for easing review
      they were modified in place, in evsel.c, the next patch will move the
      migrated methods to evlist.c.
      
      With this 'perf top' now uses the same mmap model used by 'perf record'
      and the next patches will make 'perf record' use these new routines,
      establishing a common codebase for both tools.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      70db7533
    • A
      perf evsel: Introduce mmap support · 70082dd9
      Arnaldo Carvalho de Melo 提交于
      Out of the code in 'perf top'. Record is next in line.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      70082dd9
    • A
      perf evsel: Allow specifying if the inherit bit should be set · 9d04f178
      Arnaldo Carvalho de Melo 提交于
      As this is a per-cpu attribute, we can't set it up in advance and use it
      for all the calls.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9d04f178
    • A
      perf evsel: Support event groups · f08199d3
      Arnaldo Carvalho de Melo 提交于
      The perf_evsel__open now have an extra boolean argument specifying if
      event grouping is desired.
      
      The first file descriptor created on a CPU becomes the group leader.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f08199d3
    • A
      perf evlist: Adopt the pollfd array · 5c581041
      Arnaldo Carvalho de Melo 提交于
      Allocating just the space needed for nr_cpus * nr_threads * nr_evsels,
      not the MAX_NR_CPUS and counters.
      
      LKML-Reference: <new-submission>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5c581041
    • A
      perf evsel: Introduce perf_evlist · 361c99a6
      Arnaldo Carvalho de Melo 提交于
      Killing two more perf wide global variables: nr_counters and evsel_list
      as a list_head.
      
      There are more operations that will need more fields in perf_evlist,
      like the pollfd for polling all the fds in a list of evsel instances.
      
      Use option->value to pass the evsel_list to parse_{events,filters}.
      
      LKML-Reference: <new-submission>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      361c99a6
    • T
      perf tools: Fix time function double declaration with glibc · 00e99a49
      Thomas Renninger 提交于
      It's enough to include the local "debug.h" file to trigger it.
      
      man time reveals this is already declared in glibc:
      
      time - get time in seconds
      -> rename the variable.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: arjan@infradead.org
      LPU-Reference: <1295620209-13859-2-git-send-email-trenn@suse.de>
      Signed-off-by: NThomas Renninger <trenn@suse.de>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      00e99a49
    • A
      perf tools: Fix build when using gcc 3.4.6 · 5c7a6682
      Arnaldo Carvalho de Melo 提交于
      [acme@localhost linux]$ make O=~acme/git/build/perf -C tools/perf
      make: Entering directory `/home/acme/git/linux/tools/perf'
      Makefile:526: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev
      Makefile:582: newt not found, disables TUI support. Please install newt-devel or libnewt-dev
          CC /home/acme/git/build/perf/builtin-annotate.o
      In file included from builtin-annotate.c:23:
      util/parse-events.h:26: warning: declaration of 'evsel_list' shadows a global declaration
      util/parse-events.h:12: warning: shadowed declaration is here
      make: *** [/home/acme/git/build/perf/builtin-annotate.o] Error 1
      make: Leaving directory `/home/acme/git/linux/tools/perf'
      [acme@localhost linux]$ gcc --version | head -1
      gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-11)
      [acme@localhost linux]$
      
      Fix it by renaming the parameter to evlist.
      
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5c7a6682
    • A
      perf tools: Add missing header, fixes build · a860a608
      Arnaldo Carvalho de Melo 提交于
      We need the definiton for __always_inline in bitops.h to fix the build
      on distros where it isn't available or compiler.h doesn't get included
      indirectly.
      
      One of the fixes needed to build perf on RHEL4 systems, for instance.
      
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a860a608
    • A
      perf tools: Fix 64 bit integer format strings · 9486aa38
      Arnaldo Carvalho de Melo 提交于
      Using %L[uxd] has issues in some architectures, like on ppc64.  Fix it
      by making our 64 bit integers typedefs of stdint.h types and using
      PRI[ux]64 like, for instance, git does.
      
      Reported by Denis Kirjanov that provided a patch for one case, I went
      and changed all cases.
      Reported-by: NDenis Kirjanov <dkirjanov@kernel.org>
      Tested-by: NDenis Kirjanov <dkirjanov@kernel.org>
      LKML-Reference: <20110120093246.GA8031@hera.kernel.org>
      Cc: Denis Kirjanov <dkirjanov@kernel.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Pingtian Han <phan@redhat.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9486aa38
  3. 22 1月, 2011 1 次提交
  4. 18 1月, 2011 2 次提交
    • A
      perf tools: Fix tracepoint id to string perf.data header table · ad7f4e3f
      Arnaldo Carvalho de Melo 提交于
      It was broken by f006d25a that passed just the event name, not the complete
      sys:event that it expected to open the /sys/.../sys/sys:event/id file to get
      the id.
      
      Fix it by moving it to after parse_events in cmd_record, as at that point
      we can just traverse the evsel_list and use evsel->attr.config +
      event_name(evsel) instead of re-opening the /id file.
      Reported-by: NFranck Bui-Huu <vagabon.xyz@gmail.com>
      Cc: Franck Bui-Huu <vagabon.xyz@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Han Pingtian <phan@redhat.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <20110117202801.GG2085@ghostprotocols.net>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ad7f4e3f
    • A
      perf tools: Fix handling of wildcards in tracepoint event selectors · dd9a9ad5
      Arnaldo Carvalho de Melo 提交于
      It wasn't accounting the ':' when consuming bytes in the the event
      selector string, so parse_events() would fail in this test:
      
                      if (!(*str == 0 || *str == ',' || isspace(*str)))
                              return -1;
      
      as *str would be pointing to '*', the last character in the '-e' arg in:
      
      $ perf record -q -a -D -e sched:sched_* | perf script -i - -s perf-script.py
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      dd9a9ad5
  5. 11 1月, 2011 2 次提交
    • A
      perf session: Fix infinite loop in __perf_session__process_events · 3d03e2ea
      Arnaldo Carvalho de Melo 提交于
      In this if statement:
      
              if (head + event->header.size >= mmap_size) {
                      if (mmaps[map_idx]) {
                              munmap(mmaps[map_idx], mmap_size);
                              mmaps[map_idx] = NULL;
                      }
      
                      page_offset = page_size * (head / page_size);
                      file_offset += page_offset;
                      head -= page_offset;
                      goto remap;
              }
      
      With, for instance, these values:
      
      head=2992
      event->header.size=48
      mmap_size=3040
      
      We end up endlessly looping back to remap. Off by one.
      
      Problem introduced in 55b4462.
      Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Reported-by: NIngo Molnar <mingo@elte.hu>
      Reported-by: NDavid Ahern <daahern@cisco.com>
      Bisected-by: NDavid Ahern <daahern@cisco.com>
      Tested-by: NDavid Ahern <daahern@cisco.com>
      Cc: David Ahern <daahern@cisco.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3d03e2ea
    • A
      perf evsel: Support perf_evsel__open(cpus > 1 && threads > 1) · 0252208e
      Arnaldo Carvalho de Melo 提交于
      And a test for it:
      
      [acme@felicio linux]$ perf test
       1: vmlinux symtab matches kallsyms: Ok
       2: detect open syscall event: Ok
       3: detect open syscall event on all cpus: Ok
      [acme@felicio linux]$
      
      Translating C the test does:
      
      1. generates different number of open syscalls on each CPU
         by using sched_setaffinity
      2. Verifies that the expected number of events is generated
         on each CPU
      
      It works as expected.
      
      LKML-Reference: <new-submission>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0252208e
  6. 07 1月, 2011 2 次提交
    • L
      perf tools: Pass whole attr to event selectors · 23a2f3ab
      Lin Ming 提交于
      Since commit 69aad6f1(perf tools: Introduce event selectors), only
      perf_event_attr::type and ::config are passed to event selector, which
      makes perf tool not work correctly.
      
      For example, PEBS does not work because perf_event_attr::precise_ip is
      not passed to the syscall.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      LKML-Reference: <1294369869.20563.19.camel@minggr.sh.intel.com>
      Signed-off-by: NLin Ming <ming.m.lin@intel.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      23a2f3ab
    • H
      perf tools: Fix buffer overflow error when specifying all tracepoints · f006d25a
      Han Pingtian 提交于
      I found when specifying all tracepoints with -e to one of subcommand,
      such as 'stat', the program will trigger a buffer overflow error, like
      this:
      
      *** buffer overflow detected ***: ./perf terminated
      ======= Backtrace: =========
      /lib64/libc.so.6(__fortify_fail+0x37)[0x382cefb2c7]
      ....
      
      The tracepoints are separated by comma, something like this:
      
      $ perf stat -a -e `perf list |grep Tracepoint|awk -F'[' '{gsub(/[[:space:]]+/,"",$1);array[FNR]=$1}END{outputs=array[1];for (i=2;i<=FNR;i++){ outputs=outputs "," array[i];};print outputs}'`
      
      The root reason of this problem is that store_event_type() is called for all
      events, and will overflow the 'filename' at:
      
          strncat(filename, orgname, strlen(orgname));
      
      This patch fixes it by calling store_event_type() only when the event name has
      been found.
      
      LKML-Reference: <20110106093922.GB6713@hpt.nay.redhat.com>
      Signed-off-by: NHan Pingtian <phan@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f006d25a
  7. 06 1月, 2011 2 次提交
    • A
      perf session: Warn about errors when processing pipe events too · 11095994
      Arnaldo Carvalho de Melo 提交于
      Just like we do at __perf_session__process_events
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      11095994
    • S
      perf tools: Fix perf_event.h header usage · d030260a
      Stephane Eranian 提交于
      This patch fixes the usage of the perf_event.h header file
      between command modules and the supporting code in util.
      
      It is necessary to ensure that ALL files use the SAME
      perf_event.h header from the kernel source tree.
      
      There were a couple of #include <linux/perf_event.h> mixed
      with #include "../../perf_event.h".
      
      This caused issues on some distros because of mismatch
      in the layout of struct perf_event_attr. That eventually
      led perf stat to segfault.
      
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <robert.richter@amd.com>
      Cc: Stephane Eranian <eranian@gmail.com>
      LKML-Reference: <4d233cf0.2308e30a.7b00.ffffc187@mx.google.com>
      Signed-off-by: NStephane Eranian <eranian@google.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d030260a
  8. 04 1月, 2011 9 次提交
    • T
      perf timechart: Adjust perf timechart to the new power events · 20c457b8
      Thomas Renninger 提交于
      builtin-timechart must only pass -e power:xy events if they are supported by
      the running kernel, otherwise try to fetch the old power:power{start,end}
      events.
      
      For this I added the tiny helper function:
      
         int is_valid_tracepoint(const char *event_string)
      
      to parse-events.[hc], which could be more generic as an interface and support
      hardware/software/... events, not only tracepoints, but someone else could
      extend that if needed...
      Signed-off-by: NThomas Renninger <trenn@suse.de>
      Acked-by: NArjan van de Ven <arjan@linux.intel.com>
      Acked-by: NJean Pihet <j-pihet@ti.com>
      LKML-Reference: <1294073445-14812-4-git-send-email-trenn@suse.de>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      20c457b8
    • A
      perf evsel: Auto allocate resources needed for some methods · 4eed11d5
      Arnaldo Carvalho de Melo 提交于
      While writing the first user of the routines created from the ad-hoc
      routines in the existing builtins I noticed that the resulting set of
      calls was too long, reduce it by doing some best effort allocations.
      
      Tools that need to operate on multiple threads and cpus should pre-allocate
      enough resources by explicitely calling the perf_evsel__alloc_{fd,counters}
      methods.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4eed11d5
    • A
      perf evsel: Use {cpu,thread}_map to shorten list of parameters · 86bd5e86
      Arnaldo Carvalho de Melo 提交于
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      86bd5e86
    • A
      perf tools: Refactor all_tids to hold nr and the map · 5c98d466
      Arnaldo Carvalho de Melo 提交于
      So that later, we can pass the thread_map instance instead of
      (thread_num, thread_map) for things like perf_evsel__open and friends,
      just like was done with cpu_map.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5c98d466
    • A
      perf tools: Refactor cpumap to hold nr and the map · 60d567e2
      Arnaldo Carvalho de Melo 提交于
      So that later, we can pass the cpu_map instance instead of (nr_cpus, cpu_map)
      for things like perf_evsel__open and friends.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      60d567e2
    • A
      perf evsel: Introduce per cpu and per thread open helpers · 48290609
      Arnaldo Carvalho de Melo 提交于
      Abstracting away the loops needed to create the various event fd handlers.
      
      The users have to pass a confiruged perf->evsel.attr field, which is already
      usable after perf_evsel__new (constructor) time, using defaults.
      
      Comes out of the ad-hoc routines in builtin-stat, that now uses it.
      
      Fixed a small silly bug where we were die()ing before killing our
      children, dysfunctional family this one 8-)
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      48290609
    • A
      perf evsel: Steal the counter reading routines from stat · c52b12ed
      Arnaldo Carvalho de Melo 提交于
      Making them hopefully generic enough to be used in 'perf test',
      well see.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c52b12ed
    • A
      perf evsel: Delete the event selectors at exit · 70d544d0
      Arnaldo Carvalho de Melo 提交于
      Freeing all the possibly allocated resources, reducing complexity
      on each tool exit path.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      70d544d0
    • A
      perf util: Move do_read from session to util · 1e7972cc
      Arnaldo Carvalho de Melo 提交于
      Not really something to be exported from session.c. Rename it to
      'readn' as others did in the past.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1e7972cc