1. 11 1月, 2011 4 次提交
    • A
      perf evsel: Fix order of event list deletion · bd3bfe9e
      Arnaldo Carvalho de Melo 提交于
      We need to defer calling perf_evsel_list__delete() till after atexit
      registered routines, because we need to traverse the events being
      recorded at that time at least on 'perf record'.
      
      This fixes the problem reported by Thomas Renninger where cmd_record
      called by cmd_timechart would not write the tracing data to the perf.data
      file header because the evsel_list at atexit (control+C on 'perf timechart
      record') time would be empty, being already deleted by run_builtin(),
      and thus 'perf timechart' when trying to process such perf.data file would
      die with:
      
      "no trace data in the file"
      
      Problem introduced in 70d544d0.
      Reported-by: NThomas Renninger <trenn@suse.de>
      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 Renninger <trenn@suse.de>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      bd3bfe9e
    • 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 55b44629.
      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
    • J
      perf sched: Use PTHREAD_STACK_MIN to avoid pthread_attr_setstacksize() fail · 12f7e036
      Jiri Pirko 提交于
      on ppc64:
      /usr/include/bits/local_lim.h:#define PTHREAD_STACK_MIN	131072
      
      therefore following set of commands:
      
      gives:
      perf.2.6.37test: builtin-sched.c:493: create_tasks: Assertion `!(err)' failed.
      
      So make sure we do not set stack size lower than PTHREAD_STACK_MIN.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      LKML-Reference: <20110110160417.GB2685@psychotron.brq.redhat.com>
      Signed-off-by: NJiri Pirko <jpirko@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      12f7e036
  2. 10 1月, 2011 3 次提交
    • A
      perf tools: Emit clearer message for sys_perf_event_open ENOENT return · aa7bc7ef
      Arnaldo Carvalho de Melo 提交于
      Improve sys_perf_event_open ENOENT return handling in top and record, just
      like 5a3446bc does for stat.
      
      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: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      aa7bc7ef
    • D
      perf stat: better error message for unsupported events · 5a3446bc
      David Ahern 提交于
      For unsupported events (e.g., H/W events when running in a VM)
      perf stat currently fails with the error message:
      
            Error: open_counter returned with 2 (No such file or directory).
          /bin/dmesg may provide additional information.
      
            Fatal: Not all events could be opened.
      
      dmesg is of no help and it is not clear as to why it fails to
      open the counter. This patch changes the error message to
      
            Error: cache-misses event is not supported.
            Fatal: Not all events could be opened.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: a.p.zijlstra@chello.nl
      LPU-Reference: <1294597272-17335-1-git-send-email-daahern@cisco.com>
      Signed-off-by: NDavid Ahern <daahern@cisco.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5a3446bc
    • A
      perf sched: Fix allocation result check · e462dc55
      Arnaldo Carvalho de Melo 提交于
      Bug introduced in ce47dc56.
      Reported-by: NMike Galbraith <efault@gmx.de>
      Cc: Chris Samuel <chris@csamuel.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: NArnaldo Carvalho de Melo <acme@redhat.com>
      e462dc55
  3. 07 1月, 2011 3 次提交
    • 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
    • F
      perf tools: Build with frame pointer · 6b01f2c4
      Frederic Weisbecker 提交于
      It seems that some gcc versions build by default with frame pointers
      and some others omit them.
      
      Just build the tools with frame pointers as the callchains can be an
      important part of the perf workflow.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <1294325513-14276-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>
      6b01f2c4
    • 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
  4. 06 1月, 2011 5 次提交
    • A
      perf script: Make some lists static · eccdfe2d
      Arnaldo Carvalho de Melo 提交于
      Not accessed outside builtin-script, so make them static.
      
      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>
      eccdfe2d
    • A
      perf script: Use the default lost event handler · 6d8afb56
      Arnaldo Carvalho de Melo 提交于
      That already does what was being done here. The warning is now unconditionally
      given by __perf_session__process_pipe_events, just like for non pipe processing.
      
      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>
      6d8afb56
    • 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
    • A
      perf test: Clarify some error reports in the open syscall test · 454a3bbe
      Arnaldo Carvalho de Melo 提交于
      Rebooted my devel machine, first thing I ran was perf test, that expects
      debugfs to be mounted, test fails. Be more clear about it.
      
      Also add missing newlines and add more informative message when
      sys_perf_event_open fails.
      
      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>
      454a3bbe
  5. 04 1月, 2011 12 次提交
    • 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 test: Add test for counting open syscalls · d854861c
      Arnaldo Carvalho de Melo 提交于
      To test the use of the perf_evsel class on something other than
      the tools from where we refactored code to create it.
      
      It calls open() N times and then checks if the event created to
      monitor it returns N events.
      
      [acme@felicio linux]$ perf test
       1: vmlinux symtab matches kallsyms: Ok
       2: detect open syscall event: Ok
      [acme@felicio linux]$
      
      It does.
      
      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: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d854861c
    • 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
    • A
      perf evsel: Adopt MATCH_EVENT macro from 'stat' · daec78a0
      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>
      daec78a0
    • A
      perf tools: Introduce event selectors · 69aad6f1
      Arnaldo Carvalho de Melo 提交于
      Out of ad-hoc code and global arrays with hard coded sizes.
      
      This is the first step on having a library that will be first
      used on regression tests in the 'perf test' tool.
      
      [acme@felicio linux]$ size /tmp/perf.before
         text	   data	    bss	    dec	    hex	filename
      1273776	  97384	5104416	6475576	 62cf38	/tmp/perf.before
      [acme@felicio linux]$ size /tmp/perf.new
         text	   data	    bss	    dec	    hex	filename
      1275422	  97416	1392416	2765254	 2a31c6	/tmp/perf.new
      
      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>
      69aad6f1
  6. 03 1月, 2011 1 次提交
    • F
      perf: Fix callchain hit bad cast on ascii display · d425de54
      Frederic Weisbecker 提交于
      ipchain__fprintf_graph() casts the number of hits in a branch as an
      int, which means we lose its highests bits.
      
      This results in meaningless number of callchain hits in perf.data
      that have a high number of hits recorded, typically those that have
      callchain branches hits appearing more than INT_MAX. This happens
      easily as those are pondered by the event period.
      Reported-by: NNick Piggin <npiggin@kernel.dk>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      d425de54
  7. 28 12月, 2010 1 次提交
    • F
      perf probe: Fix short file name probe location reporting · 32ae2ade
      Franck Bui-Huu 提交于
      After adding probes, perf-probe(1) reports the probes locations which include
      filenames for certain cases.
      
      But for short file names (whose length < 32), perf-probe didn't display the
      name correctly. It actually skipped the first character.
      
      Here's an example where 'icmp.c' was screwed:
      
         $ perf probe -n -a "icmp.c;sk=*"
         Add new events:
           probe:icmp_push_reply (on @cmp.c)
           probe:icmp_reply     (on @cmp.c)
           probe:icmp_reply_1   (on @cmp.c)
           probe:icmp_send      (on @cmp.c)
           probe:icmp_send_1    (on @cmp.c)
           probe:icmp_error     (on @cmp.c)
           probe:icmp_error_1   (on @cmp.c)
           probe:icmp_error_2   (on @cmp.c)
           probe:icmp_error_3   (on @cmp.c)
      
      This patch fixes this bug in synthesize_perf_probe_point().
      Acked-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      LKML-Reference: <m31v588r9k.fsf@gmail.com>
      Signed-off-by: NFranck Bui-Huu <fbuihuu@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      32ae2ade
  8. 26 12月, 2010 1 次提交
    • A
      perf script: Fix event ordering settings to work with older kernels · ce0ac9e1
      Arnaldo Carvalho de Melo 提交于
      If we don't use .ordering_requires_timestamps we'll end up trying to order
      events with no timestamps when running on older kernels.
      
      Problem introduced in eac23d1c.
      
      After the last three fixes, perf scripting is back working, tested with
      new perf userspace on old and new (with sample_id_all) kernels.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ian Munsie <imunsie@au1.ibm.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>
      Cc: Torok Edwin <edwintorok@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ce0ac9e1
  9. 25 12月, 2010 2 次提交
    • A
      perf record: Fix use of sample_id_all userspace with !sample_id_all kernels · a43d3f08
      Arnaldo Carvalho de Melo 提交于
      Check if parse_single_tracepoint_event has already asked for PERF_SAMPLE_TIME.
      
      This is kludgy but short term fix for problems introduced by eac23d1c that
      broke 'perf script' by having different sample_types when using multiple
      tracepoint events when we use a perf binary that tries to use sample_id_all on
      an older kernel.
      
      We need to move counter creation to perf_session, support different
      sample_types, etc.
      
      Ongoing work on the perf test infrastructure needs this so that we can create
      counters to monitor threads generating specific events, etc.
      
      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>
      Cc: Torok Edwin <edwintorok@gmail.com>
      Cc: Ian Munsie <imunsie@au1.ibm.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a43d3f08
    • A
      perf script: Finish the rename from trace to script · 765532c8
      Arnaldo Carvalho de Melo 提交于
      The scripts have calls to 'perf trace' that need to be converted to 'perf script', do it.
      
      This problem was introduced in 133dc4c3.
      Reported-by: NTorok Edwin <edwintorok@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>
      Cc: Torok Edwin <edwintorok@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      765532c8
  10. 23 12月, 2010 3 次提交
    • F
      perf probe: Fix wrong warning in __show_one_line() if read(1) errors happen · 32b2b6ec
      Franck Bui-Huu 提交于
      This was introduced by commit fde52dbd.
      
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      LKML-Reference: <m3y67hsr0m.fsf@gmail.com>
      Signed-off-by: NFranck Bui-Huu <fbuihuu@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      32b2b6ec
    • A
      perf test: Look forward for symbol aliases · d3678758
      Arnaldo Carvalho de Melo 提交于
      Not just before, fixing these false positives:
      
      [acme@mica linux]$ perf test -v 1
       1: vmlinux symtab matches kallsyms:
      --- start ---
      Looking at the vmlinux_path (6 entries long)
      Using //lib/modules/2.6.37-rc5-00180-ge06b6bf/build/vmlinux for symbols
      0xffffffff81058dc0: diff name v: sys_vm86old k: sys_ni_syscall
      0xffffffff81058dc0: diff name v: sys_vm86 k: sys_ni_syscall
      0xffffffff81058dc0: diff name v: sys_subpage_prot k: sys_ni_syscall
      0xffffffff810b5f7c: diff name v: probe_kernel_write k: __probe_kernel_write
      0xffffffff810b5fe5: diff name v: probe_kernel_read k: __probe_kernel_read
      0xffffffff811bc380: diff name v: __memset k: memset
      0xffffffff81384a98: diff name v: __sched_text_start k: sleep_on_common
      0xffffffff81386750: diff name v: __sched_text_end k: _raw_spin_trylock
      0xffffffff8138cee8: diff name v: __irqentry_text_start k: do_IRQ
      0xffffffff8138f079: diff name v: __start_notes k: _etext
      0xffffffff8138f079: diff name v: __stop_notes k: _etext
      ---- end ----
      vmlinux symtab matches kallsyms: FAILED!
      
      [acme@mica linux]$
      
      Some are weak functions, others are just markers, etc. They get in the rb tree
      with the same addr, so we need to look around to find the symbol with the same
      name.
      
      We were looking just at the previous entries with the same addr, look forward
      too.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Han Pingtian <phan@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d3678758
    • A
      perf symbols: Improve kallsyms symbol end addr calculation · 3b01a413
      Arnaldo Carvalho de Melo 提交于
      For kallsyms we don't have the symbol address end, so we do an extra pass and
      set the symbol end addr as being the start of the next minus one.
      
      But this was being done just after we filtered the symbols of a
      particular type (functions, variables), so the symbol end was sometimes
      after what it really is.
      
      Fixing up symbol end also was falling apart when we have symbol aliases,
      then the end address of all but the last alias was being set to be
      before its start.
      
      Fix it up by checking for symbol aliases and making the kallsyms__parse
      routine use the next symbol, whatever its type, as the limit for the
      previous symbol, passing that end address to the callback.
      
      This was detected by the 'perf test' synthetic paranoid regression
      tests, fix it up so that even that case doesn't mislead us.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3b01a413
  11. 22 12月, 2010 5 次提交