1. 30 Jan, 2011 2 commits
    • Arnaldo Carvalho de Melo's avatar
      perf evlist: Move evlist methods to evlist.c · f8a95309
      Arnaldo Carvalho de Melo authored
      They were on evsel.c because they came from refactoring existing evsel
      methods, so, to make reviewing the changes easier, I kept it there, now
      its a plain move.
      
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f8a95309
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Initial python binding · 877108e4
      Arnaldo Carvalho de Melo authored
      First clarifying that this kind of binding is not a replacement or an
      equivalent to the 'perf script' way of using python with perf.
      
      The 'perf script' way is to process events and look at a given script
      for some python function that matches the events to pass each event for
      processing.
      
      This is a python module, i.e. everything is driven from the python
      script, that merely uses "import perf" or "from perf import".
      
      perf script is focused on tracepoints, this binding is focused on profiling as
      an initial target. More work is needed to make available tracepoint specific
      variables as event variables accessible via this binding.
      
      There is one example of such usage model, in
      tools/perf/python/twatch.py, a tool to watch "cycles" events together
      with task (fork, exit) and comm perf events.
      
      For now, due to me not being able to grok how python distutils cope with
      building C extensions outside the sources dir the install target just
      builds it, I'm using it as:
      
      [root@emilia linux]# export PYTHONPATH=~acme/git/build/perf/lib.linux-x86_64-2.6/
      [root@emilia linux]# tools/perf/python/twatch.py
      cpu:  4, pid: 30126, tid: 30126 { type: mmap, pid: 30126, tid: 30126, start: 0x4, length: 0x82e9ca03, offset: 0, filename:  }
      cpu:  6, pid:   47, tid:   47 { type: mmap, pid: 47, tid: 47, start: 0x6, length: 0xbef87c36, offset: 0, filename:  }
      cpu:  1, pid:    0, tid:    0 { type: mmap, pid: 0, tid: 0, start: 0x1, length: 0x775d1904, offset: 0, filename:  }
      cpu:  7, pid:    0, tid:    0 { type: mmap, pid: 0, tid: 0, start: 0x7, length: 0xc750aeb6, offset: 0, filename:  }
      cpu:  5, pid: 2255, tid: 2255 { type: mmap, pid: 2255, tid: 2255, start: 0x5, length: 0x76669635, offset: 0, filename:  }
      cpu:  0, pid:    0, tid:    0 { type: mmap, pid: 0, tid: 0, start: 0, length: 0x6422ef6b, offset: 0, filename:  }
      cpu:  2, pid: 2255, tid: 2255 { type: mmap, pid: 2255, tid: 2255, start: 0x2, length: 0xe078757a, offset: 0, filename:  }
      cpu:  1, pid: 5769, tid: 5769 { type: fork, pid: 30127, ppid: 5769, tid: 30127, ptid: 5769, time: 103893991270534}
      cpu:  6, pid: 30127, tid: 30127 { type: comm, pid: 30127, tid: 30127, comm: ls }
      cpu:  6, pid: 30127, tid: 30127 { type: exit, pid: 30127, ppid: 30127, tid: 30127, ptid: 30127, time: 103893993273024}
      
      The first 8 mmap events in this 8 way machine are a mistery that is still being
      investigated.
      
      More of the tools/perf/util/ APIs will be exposed via this python binding as
      the need arises. For now the focus is on creating events and processing them,
      symbol resolution is an obvious next step, with tracepoint variables as a close
      second step.
      
      Cc: Clark Williams <williams@redhat.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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      877108e4
  2. 29 Jan, 2011 6 commits
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Kill event_t typedef, use 'union perf_event' instead · 8115d60c
      Arnaldo Carvalho de Melo authored
      And move the event_t methods to the perf_event__ too.
      
      No code changes, just namespace consistency.
      
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8115d60c
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Rename 'struct sample_data' to 'struct perf_sample' · 8d50e5b4
      Arnaldo Carvalho de Melo authored
      Making the namespace more uniform.
      
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8d50e5b4
    • Arnaldo Carvalho de Melo's avatar
      perf top: Switch to non overwrite mode · 93fc64f1
      Arnaldo Carvalho de Melo authored
      Just like 'perf record'. Warn the user when PERF_RECORD_LOST events
      happen.
      
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      93fc64f1
    • Arnaldo Carvalho de Melo's avatar
      perf evlist: Support non overwrite mode in perf_evlist__read_on_cpu · 7bb41152
      Arnaldo Carvalho de Melo authored
      I.e. stash the overwrite mode in struct perf_evlist and act accordingly
      in perf_evlist__read_on_cpu, not checking for overwrites and touching
      the tail after consuming one event, like perf record does, for instance.
      
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7bb41152
    • Arnaldo Carvalho de Melo's avatar
      perf events: Account PERF_RECORD_LOST events in event__process · ef2bf6d0
      Arnaldo Carvalho de Melo authored
      Right now this function is only used by perf top, that uses PROT_READ
      only, i.e. overwrite mode, so no PERF_RECORD_LOST events are generated,
      but don't forget those events.
      
      The patch that moved this out of perf top was made so that this routine
      could be used by 'perf probe' in the uprobes patchset, so perhaps there
      they need to check for LOST events and warn the user, as will be done in
      the following patches that will switch 'perf top' to non overwrite mode
      (mmap with PROT_READ|PROT_WRITE).
      
      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: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ef2bf6d0
    • Arnaldo Carvalho de Melo's avatar
      perf record: No need to check for overwrites · dc82009a
      Arnaldo Carvalho de Melo authored
      As we open the mmap with (PROT_READ | PROT_WRITE), signalling the kernel
      with perf_mmap__write_tail() when consuming data, so the kernel will not
      overwrite.
      Suggested-by: default avatarPeter Zijlstra <peterz@infradead.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: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      dc82009a
  3. 28 Jan, 2011 4 commits
    • Han Pingtian's avatar
      perf test: Fix return values checking · 54489c18
      Han Pingtian authored
      Fixing some cut'n'paste mistakes.
      
      LKML-Reference: <20110124233900.GA3443@epc900.nay.redhat.com>
      Signed-off-by: default avatarHan Pingtian <phan@redhat.com>
      [ committer note: I had already removed the CPU_ALLOC calls ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      54489c18
    • Masami Hiramatsu's avatar
      perf probe: Add filters support for available functions · 3c42258c
      Masami Hiramatsu authored
      Add filters support for available function list.
      
      Default filter is "!_*" for filtering out local-purpose symbols.
      
      e.g.:
       # perf probe --filter="add*" -F
      add_disk
      add_disk_randomness
      add_input_randomness
      add_interrupt_randomness
      add_memory
      add_page_to_unevictable_list
      add_page_wait_queue
      ...
      
      Cc: 2nddept-manager@sdl.hitachi.co.jp
      Cc: Chase Douglas <chase.douglas@canonical.com>
      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: <20110120141545.25915.85930.stgit@ltc236.sdl.hitachi.co.jp>
      Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3c42258c
    • Masami Hiramatsu's avatar
      perf probe: Add variable filter support · bd09d7b5
      Masami Hiramatsu authored
      Add filters support for available variable list.
      
      Default filter is "!__k???tab_*&!__crc_*" for filtering out
      automatically generated symbols.
      
      The format of filter rule is "[!]GLOBPATTERN", so you can use wild
      cards. If the filter rule starts with '!', matched variables are filter
      out.
      
      e.g.:
       # perf probe -V schedule --externs --filter=cpu*
      Available variables at schedule
              @<schedule+0>
                      cpumask_var_t   cpu_callout_mask
                      cpumask_var_t   cpu_core_map
                      cpumask_var_t   cpu_isolated_map
                      cpumask_var_t   cpu_sibling_map
                      int     cpu_number
                      long unsigned int*      cpu_bit_bitmap
      		...
      
      Cc: 2nddept-manager@sdl.hitachi.co.jp
      Cc: Chase Douglas <chase.douglas@canonical.com>
      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: <20110120141539.25915.43401.stgit@ltc236.sdl.hitachi.co.jp>
      Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      [ committer note: Removed the elf.h include as it was fixed up in e80711ca]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bd09d7b5
    • Masami Hiramatsu's avatar
      perf tools: Add strfilter for general purpose string filter · 68baa431
      Masami Hiramatsu authored
      Add strfilter for general purpose string filter.
      
      Every filter rules are descrived by glob matching pattern and '!' prefix
      which means Logical NOT.
      
      A strfilter consists of those filter rules connected with '&' and '|'.
      
      A set of rules can be folded by using '(' and ')'.
      
      It also accepts spaces around rules and those operators.
      
      Format:
      <rule> ::= <glob-exp> | "!" <rule> | <rule> <op> <rule> | "(" <rule> ")"
      <op> ::= "&" | "|"
      
      e.g.:
      
       "(add* | del*) & *timer" filter rules pass strings which start with add
       or del and end with timer.
      
      This will be used by perf probe --filter.
      
      Changes in V2:
       - Fix to check result of strdup() and strfilter__alloc().
       - Encapsulate and simplify interfaces as like regex(3).
      
      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: <20110120141530.25915.12673.stgit@ltc236.sdl.hitachi.co.jp>
      Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      68baa431
  4. 27 Jan, 2011 2 commits
  5. 24 Jan, 2011 8 commits
    • Arnaldo Carvalho de Melo's avatar
      perf evsel: Introduce perf_evsel__{in,ex}it · ef1d1af2
      Arnaldo Carvalho de Melo authored
      Out of the {con,des}structor, as in interpreted language bindings we will
      need to go back from the wrapper object to the real thing. In that case
      using container_of will save us to have an extra pointer in the perf_evsel
      struct.
      
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ef1d1af2
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Move event__parse_sample to evsel.c · d0dd74e8
      Arnaldo Carvalho de Melo authored
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d0dd74e8
    • Arnaldo Carvalho de Melo's avatar
      perf threads: Move thread_map to separate file · fd78260b
      Arnaldo Carvalho de Melo authored
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fd78260b
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Pass the struct opt to the wildcard parsing routine · 17ea1b70
      Arnaldo Carvalho de Melo authored
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      17ea1b70
    • Franck Bui-Huu's avatar
      perf record: auto detect when stdout is a pipe · d7065adb
      Franck Bui-Huu authored
      This patch gives the ability to 'perf record' to detect when its stdout
      has been redirected to a pipe. There's now no more need to add '-o -'
      switch in this case.
      
      However '-o <path>' option has always precedence, that is if specified
      and stdout has been connected via a pipe then the output will go into
      the specified output.
      
      LKML-Reference: <m3ipxo966i.fsf@gmail.com>
      Signed-off-by: default avatarFranck Bui-Huu <fbuihuu@gmail.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d7065adb
    • Masami Hiramatsu's avatar
      perf probe: Add --funcs to show available functions in symtab · e80711ca
      Masami Hiramatsu authored
      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: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      [ committer note: Add missing elf.h for STB_GLOBAL that broke a RHEL4 build ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e80711ca
    • Masami Hiramatsu's avatar
      perf probe: Enable to put probe inline function call site · 5069ed86
      Masami Hiramatsu authored
      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: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5069ed86
    • Masami Hiramatsu's avatar
      perf probe: Introduce lines walker interface · 4cc9cec6
      Masami Hiramatsu authored
      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: default avatarMasami 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4cc9cec6
  6. 22 Jan, 2011 18 commits
    • Arnaldo Carvalho de Melo's avatar
      perf top: Add native_safe_halt to skip symbols · b0e8572f
      Arnaldo Carvalho de Melo authored
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b0e8572f
    • Frederic Weisbecker's avatar
      perf callchain: Don't give arbitrary gender to callchain tree nodes · 529363b7
      Frederic Weisbecker authored
      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: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      529363b7
    • Frederic Weisbecker's avatar
      perf callchain: Rename register_callchain_param into callchain_register_param · 16537f13
      Frederic Weisbecker authored
      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: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      16537f13
    • Frederic Weisbecker's avatar
      perf callchain: Rename cumul_hits into callchain_cumul_hits · f08c3154
      Frederic Weisbecker authored
      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: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f08c3154
    • Frederic Weisbecker's avatar
      perf callchain: Feed callchains into a cursor · 1b3a0e95
      Frederic Weisbecker authored
      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: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1b3a0e95
    • Arnaldo Carvalho de Melo's avatar
      perf test: Add test for the evlist mmap routines · de5fa3a8
      Arnaldo Carvalho de Melo authored
      This test will generate random numbers of calls to some getpid syscalls,
      then establish an mmap for a group of events that are created to monitor
      these syscalls.
      
      It will receive the events, using mmap, use its PERF_SAMPLE_ID generated
      sample.id field to map back to its respective perf_evsel instance.
      
      Then it checks if the number of syscalls reported as perf events by the
      kernel corresponds to the number of syscalls made.
      
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      de5fa3a8
    • Arnaldo Carvalho de Melo's avatar
      perf evlist: Steal mmap reading routine from 'perf top' · 04391deb
      Arnaldo Carvalho de Melo authored
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      04391deb
    • Han Pingtian's avatar
      perf test: check if cpu_map__new() return NULL · 98d77b78
      Han Pingtian authored
      It looks like we should check if cpus is NULL after
      
      	cpus = cpu_map__new(NULL);
      
      in test__open_syscall_event_on_all_cpus().
      
      LKML-Reference: <20110114230050.GA7011@localhost>
      Signed-off-by: default avatarHan Pingtian <phan@redhat.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      98d77b78
    • Arnaldo Carvalho de Melo's avatar
      perf test: Check counts on all cpus in test__open_syscall_event_on_all_cpus · d2af9687
      Arnaldo Carvalho de Melo authored
      We were bailing out after the first count mismatch, do it in all to see
      if only some CPUs are not getting the expected number of 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d2af9687
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Add missing cpu_map__delete() · 915fce20
      Arnaldo Carvalho de Melo authored
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      915fce20
    • Arnaldo Carvalho de Melo's avatar
      perf record: Use perf_evlist__mmap · 0a27d7f9
      Arnaldo Carvalho de Melo authored
      There is more stuff that can go to the perf_ev{sel,list} layer, like
      detecting if sample_id_all is available, etc, but lets try using this in
      'perf test' first.
      
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0a27d7f9
    • Arnaldo Carvalho de Melo's avatar
      perf evlist: Move the mmap array from perf_evsel · 70db7533
      Arnaldo Carvalho de Melo authored
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      70db7533
    • Arnaldo Carvalho de Melo's avatar
      perf record: Move perf_mmap__write_tail to perf.h · 115d2d89
      Arnaldo Carvalho de Melo authored
      Close to perf_mmap__read_head() and the perf_mmap struct definition.
      This is useful for any recorder, and we will need it in 'perf test'.
      
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      115d2d89
    • Arnaldo Carvalho de Melo's avatar
      perf record: Use struct perf_mmap and helpers · 744bd8aa
      Arnaldo Carvalho de Melo authored
      Paving the way to using perf_evsel->mmap, do this to reduce the patch
      noise in the next ones.
      
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      744bd8aa
    • Arnaldo Carvalho de Melo's avatar
      perf evsel: Introduce mmap support · 70082dd9
      Arnaldo Carvalho de Melo authored
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      70082dd9
    • Arnaldo Carvalho de Melo's avatar
      perf record: Use perf_evsel__open · dd7927f4
      Arnaldo Carvalho de Melo authored
      Now its time to factor out the mmap handling bits into the perf_evsel
      class.
      
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      dd7927f4
    • Arnaldo Carvalho de Melo's avatar
      perf top: Use perf_evsel__open · 72cb7013
      Arnaldo Carvalho de Melo authored
      Now that it handles group_fd and inherit we can use it, sharing it with
      stat.
      
      Next step: 'perf record' should use, then move the mmap_array out of
      ->priv and into perf_evsel, with top and record sharing this, and at the
      same time, write a 'perf test' stress test.
      
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      72cb7013
    • Arnaldo Carvalho de Melo's avatar
      perf evsel: Allow specifying if the inherit bit should be set · 9d04f178
      Arnaldo Carvalho de Melo authored
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9d04f178