1. 30 3月, 2011 1 次提交
    • A
      perf tools: Fixup exit path when not able to open events · c286c419
      Arnaldo Carvalho de Melo 提交于
      We have to deal with the TUI mode in perf top, so that we don't end up
      with a garbled screen when, say, a non root user on a machine with a
      paranoid setting (the default) tries to use 'perf top'.
      
      Introduce a ui__warning_paranoid() routine shared by top and record that
      tells the user the valid values for /proc/sys/kernel/perf_event_paranoid.
      
      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>
      c286c419
  2. 29 3月, 2011 1 次提交
    • A
      perf symbols: Fix vsyscall symbol lookup · 6c6804fb
      Andrew Lutomirski 提交于
      Perf can't currently trace into the vsyscall page.  It looks like it was
      meant to work.
      
      Tested on 2.6.38 and today's -git.
      
      The bug is easy to reproduce.  Compile this:
      
      int main()
      {
      	int i;
      	struct timespec t;
      	for(i = 0; i < 10000000; i++)
      		clock_gettime(CLOCK_MONOTONIC, &t);
      	return 0;
      }
      
      and run it through perf record; perf report.  The top entry shows
      "[unknown]" and you can't zoom in.
      
      It looks like there are two issues.  The first is a that a test for user
      mode executing in kernel space is backwards.  (That's the first hunk
      below).  The second (I think) is that something's wrong with the code
      that generates lots of little struct dso objects for different sections
      -- when it runs on vmlinux it results in bogus long_name values which
      cause objdump to fail.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LPU-Reference: <AANLkTikxSw5+wJZUWNz++nL7mgivCh_Zf=2Kq6=f9Ce_@mail.gmail.com>
      Signed-off-by: NAndy Lutomirski <luto@mit.edu>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      6c6804fb
  3. 24 3月, 2011 3 次提交
    • A
      perf symbols: Look at .dynsym again if .symtab not found · 60e4b10c
      Arnaldo Carvalho de Melo 提交于
      The original intent of the code was to repeat the search with
      want_symtab = 0. But as the code stands now, we never hit the "default"
      case of the switch statement. Which means we never repeat the search.
      Tested-by: NSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Reported-by: NArun Sharma <asharma@fb.com>
      Reported-by: NSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Dave Martin <dave.martin@linaro.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>
      60e4b10c
    • A
      perf build-id: Add quirk to deal with perf.data file format breakage · b2511481
      Arnaldo Carvalho de Melo 提交于
      The a1645ce1 changeset:
      
      "perf: 'perf kvm' tool for monitoring guest performance from host"
      
      Added a field to struct build_id_event that broke the file format.
      
      Since the kernel build-id is the first entry, process the table using
      the old format if the well known '[kernel.kallsyms]' string for the
      kernel build-id has the first 4 characters chopped off (where the pid_t
      sits).
      Reported-by: NHan Pingtian <phan@redhat.com>
      Cc: Avi Kivity <avi@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>
      Cc: Zhang Yanmin <yanmin_zhang@linux.intel.com>
      Cc: stable@kernel.org
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b2511481
    • A
      perf session: Pass evsel in event_ops->sample() · 9e69c210
      Arnaldo Carvalho de Melo 提交于
      Resolving the sample->id to an evsel since the most advanced tools,
      report and annotate, and the others will too when they evolve to
      properly support multi-event perf.data files.
      
      Good also because it does an extra validation, checking that the ID is
      valid when present. When that is not the case, the overhead is just a
      branch + function call (perf_evlist__id2evsel).
      
      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>
      9e69c210
  4. 23 3月, 2011 1 次提交
    • A
      perf top: Fix uninitialized 'counter' variable · ce2d17ca
      Akihiro Nagai 提交于
      builtin-top.c has an uninitialized variable.
      gcc(version 4.5.1) warns about it and it results in build failure:
      
       builtin-top.c: In function 'display_thread':
       builtin-top.c:518:9: error: 'counter' may be used uninitialized
      
      This situation can indeed trigger, if the getline() call in
      prompt_integer() fails.
      Signed-off-by: NAkihiro Nagai <akihiro.nagai.hw@hitachi.com>
      Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      LKML-Reference: <20110323072939.11638.50173.stgit@localhost6.localdomain6>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ce2d17ca
  5. 16 3月, 2011 3 次提交
    • M
      perf lock: Fix sorting by wait_min · 9df03abe
      Marcin Slusarz 提交于
      If lock was uncontended, wait_time_min == ULLONG_MAX, so we need to
      handle this case differently to show high wait times first
      Acked-by: NHitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
      Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <20110222174715.GC9687@joi.lan>
      Signed-off-by: NMarcin Slusarz <marcin.slusarz@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9df03abe
    • J
      perf tools: Version incorrect with some versions of grep · 58d406ed
      Josh Hunt 提交于
      Some versions of grep don't treat '\s' properly. When building perf on such
      systems and using a kernel tarball the perf version is unable to be determined
      from the main kernel Makefile and the user is left with a version of '..'.
      Replacing the use of '\s' with '[[:space:]]', which should work in all grep
      versions, gives a usable version number.
      Reported-by: NTapan Dhimant <tdhimant@akamai.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Tapan Dhimant <tdhimant@akamai.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: stable@kernel.org
      LKML-Reference: <1300241800-30281-1-git-send-email-johunt@akamai.com>
      Signed-off-by: NJosh Hunt <johunt@akamai.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      58d406ed
    • I
      perf probe: Clean up probe_point_lazy_walker() return value · 5e814dd5
      Ingo Molnar 提交于
      Newer compilers (gcc 4.6) complains about:
      
              return ret < 0 ?: 0;
      
      For the following reason:
      
        util/probe-finder.c: In function ‘probe_point_lazy_walker’:
        util/probe-finder.c:1331:18: error: the omitted middle operand in ?: will always be ‘true’, suggest explicit middle operand [-Werror=parentheses]
      
      And indeed the return value is a somewhat obscure (but correct) value
      of 'true', so return 'ret' instead - this is cleaner and unconfuses
      GCC as well.
      
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      5e814dd5
  6. 15 3月, 2011 8 次提交
    • A
      perf evlist: New command to list the names of events present in a perf.data file · 43adec95
      Arnaldo Carvalho de Melo 提交于
      [root@emilia ~]# perf record -a -e sched:* -e timer:timer* sleep 5
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.172 MB perf.data (~7530 samples) ]
      [root@emilia ~]# perf evlist
      sched:sched_kthread_stop
      sched:sched_kthread_stop_ret
      sched:sched_wakeup
      sched:sched_wakeup_new
      sched:sched_switch
      sched:sched_migrate_task
      sched:sched_process_free
      sched:sched_process_exit
      sched:sched_wait_task
      sched:sched_process_wait
      sched:sched_process_fork
      sched:sched_stat_wait
      sched:sched_stat_sleep
      sched:sched_stat_iowait
      sched:sched_stat_runtime
      sched:sched_pi_setprio
      timer:timer_init
      timer:timer_start
      timer:timer_expire_entry
      timer:timer_expire_exit
      timer:timer_cancel
      [root@emilia ~]#
      
      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>
      43adec95
    • D
      perf script: Add support for H/W and S/W events · 1424dc96
      David Ahern 提交于
      Custom fields set for each type by prepending field argument with type.
      For file with multiple event types (e.g., trace and S/W) display of an
      event type suppressed by setting output fields to "".
      
      e.g.,
      perf record -ga -e sched:sched_switch -e cpu-clock -c 10000000 -R -- sleep 1
      perf script
      
      openssl 11496 [000]  9711.807107: cpu-clock-msecs:
              ffffffff810c22dc arch_local_irq_restore ([kernel.kallsyms])
              ffffffff810c518c __alloc_pages_nodemask ([kernel.kallsyms])
              ffffffff810297b2 pte_alloc_one ([kernel.kallsyms])
              ffffffff810d8b98 __pte_alloc ([kernel.kallsyms])
              ffffffff810daf07 handle_mm_fault ([kernel.kallsyms])
              ffffffff8138763a do_page_fault ([kernel.kallsyms])
              ffffffff81384a65 page_fault ([kernel.kallsyms])
                  7f6130507d70 asn1_check_tlen (/lib64/libcrypto.so.1.0.0c)
                             0  ()
      
               openssl 11496 [000]  9711.808042: sched_switch: prev_comm=openssl ...
           kworker/0:0     4 [000]  9711.808067: sched_switch: prev_comm=kworker/...
               swapper     0 [001]  9711.808090: sched_switch: prev_comm=kworker/...
                  sshd 11451 [001]  9711.808185: sched_switch: prev_comm=sshd pre...
      swapper     0 [001]  9711.816155: cpu-clock-msecs:
              ffffffff81023609 native_safe_halt ([kernel.kallsyms])
              ffffffff8100132a cpu_idle ([kernel.kallsyms])
              ffffffff8137cf9b start_secondary ([kernel.kallsyms])
      
      openssl 11496 [000]  9711.817104: cpu-clock-msecs:
                  7f61304ad723 AES_cbc_encrypt (/lib64/libcrypto.so.1.0.0c)
                  7fff3402f950  ()
              12f0debc9a785634  ()
      
      swapper     0 [001]  9711.826155: cpu-clock-msecs:
              ffffffff81023609 native_safe_halt ([kernel.kallsyms])
              ffffffff8100132a cpu_idle ([kernel.kallsyms])
              ffffffff8137cf9b start_secondary ([kernel.kallsyms])
      
      To suppress trace events within the file and use default output for S/W events:
      perf script -f trace:
      
      or to suppress S/W events and do default display for trace events:
      perf script -f sw:
      
      Custom field selections:
      perf script -f sw:comm,tid,time -f trace:time,trace
      
               openssl 11496  9711.797162:
               swapper     0  9711.807071:
               openssl 11496  9711.807107:
       9711.808042: prev_comm=openssl prev_pid=11496 prev_prio=120 prev_state=R ...
       9711.808067: prev_comm=kworker/0:0 prev_pid=4 prev_prio=120 prev_state=S ...
       9711.808090: prev_comm=kworker/0:0 prev_pid=0 prev_prio=120 prev_state=R ...
       9711.808185: prev_comm=sshd prev_pid=11451 prev_prio=120 prev_state=S ==>...
               swapper     0  9711.816155:
               openssl 11496  9711.817104:
               swapper     0  9711.826155:
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      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: Thomas Gleixner <tglx@linutronix.de>
      LKML-Reference: <1299734608-5223-7-git-send-email-daahern@cisco.com>
      Signed-off-by: NDavid Ahern <daahern@cisco.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1424dc96
    • D
      perf script: Add support for dumping symbols · c0230b2b
      David Ahern 提交于
      Add option to dump symbols found in events.
      
      e.g., perf script -f comm,pid,tid,time,trace,sym
      
      swapper     0/0       537.037184: prev_comm=swapper prev_pid=0 prev_prio=120...
              ffffffff81030350 perf_trace_sched_switch ([kernel.kallsyms])
              ffffffff81382ac5 schedule ([kernel.kallsyms])
              ffffffff8100134a cpu_idle ([kernel.kallsyms])
              ffffffff81370b39 rest_init ([kernel.kallsyms])
              ffffffff81696c23 start_kernel ([kernel.kallsyms].init.text)
              ffffffff816962af x86_64_start_reservations ([kernel.kallsyms].init.text)
              ffffffff816963b9 x86_64_start_kernel ([kernel.kallsyms].init.text)
      
      sshd  1675/1675    537.037309: prev_comm=sshd prev_pid=1675 prev_prio=120...
              ffffffff81030350 perf_trace_sched_switch ([kernel.kallsyms])
              ffffffff81382ac5 schedule ([kernel.kallsyms])
              ffffffff813837aa schedule_hrtimeout_range_clock ([kernel.kallsyms])
              ffffffff81383886 schedule_hrtimeout_range ([kernel.kallsyms])
              ffffffff8110c4f9 poll_schedule_timeout ([kernel.kallsyms])
              ffffffff8110cd20 do_select ([kernel.kallsyms])
              ffffffff8110ced8 core_sys_select ([kernel.kallsyms])
              ffffffff8110d00d sys_select ([kernel.kallsyms])
              ffffffff81002bc2 system_call ([kernel.kallsyms])
                  7f1647e56e93 __GI_select (/lib64/libc-2.12.90.so)
      
      netstat  1692/1692    537.038664: prev_comm=netstat prev_pid=1692 prev_prio=...
              ffffffff81030350 perf_trace_sched_switch ([kernel.kallsyms])
              ffffffff81382ac5 schedule ([kernel.kallsyms])
              ffffffff81002c3a sysret_careful ([kernel.kallsyms])
                  7f7a6cd1b210 __GI___libc_read (/lib64/libc-2.12.90.so)
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      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: Thomas Gleixner <tglx@linutronix.de>
      LKML-Reference: <1299734608-5223-6-git-send-email-daahern@cisco.com>
      Signed-off-by: NDavid Ahern <daahern@cisco.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c0230b2b
    • D
      perf script: Support custom field selection for output · 745f43e3
      David Ahern 提交于
      Allow a user to select which fields to print to stdout for event data.
      Options include comm (command name), tid (thread id), pid (process id),
      time (perf timestamp), cpu, event (for event name), and trace (for
      trace data).
      
      Default is set to maintain compatibility with current output; this
      feature does alter output format slightly -- no '-' between command
      and pid/tid.
      
      Thanks to Frederic Weisbecker for detailed suggestions on this approach.
      
      Examples (output compressed)
      
      1. trace, default format
      
      perf record -ga -e sched:sched_switch
      perf script
      
      swapper    0 [000] 537.037184: sched_switch: prev_comm=swapper prev_pid=0...
         sshd 1675 [000] 537.037309: sched_switch: prev_comm=sshd prev_pid=1675...
      netstat 1692 [001] 537.038664: sched_switch: prev_comm=netstat prev_pid=1692...
      
      2. trace, custom format
      
      perf record -ga -e sched:sched_switch
      perf script -f comm,pid,time,trace     <--- omitting cpu and event name
      
      swapper    0 537.037184: prev_comm=swapper prev_pid=0 prev_prio=120 ...
         sshd 1675 537.037309: prev_comm=sshd prev_pid=1675 prev_prio=120 ...
      netstat 1692 537.038664: prev_comm=netstat prev_pid=1692 prev_prio=120 ...
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      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: Thomas Gleixner <tglx@linutronix.de>
      LKML-Reference: <1299734608-5223-5-git-send-email-daahern@cisco.com>
      Signed-off-by: NDavid Ahern <daahern@cisco.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      745f43e3
    • D
      perf script: Move printing of 'common' data from print_event and rename · c70c94b4
      David Ahern 提交于
      This change does impact output: latency data is trace specific and is
      now printed after the common data - comm, tid, cpu, time and event name.
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      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: Thomas Gleixner <tglx@linutronix.de>
      LKML-Reference: <1299734608-5223-4-git-send-email-daahern@cisco.com>
      Signed-off-by: NDavid Ahern <daahern@cisco.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c70c94b4
    • D
      perf tracing: Remove print_graph_cpu and print_graph_proc from trace-event-parse · 2ee7a49f
      David Ahern 提交于
      Next patch moves printing of 'common' data into perf-script which
      removes the need for these functions.
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      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: Thomas Gleixner <tglx@linutronix.de>
      LKML-Reference: <1299734608-5223-3-git-send-email-daahern@cisco.com>
      Signed-off-by: NDavid Ahern <daahern@cisco.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2ee7a49f
    • D
      perf script: Change process_event prototype · be6d842a
      David Ahern 提交于
      Prepare for handling of samples for any event type.
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      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: Thomas Gleixner <tglx@linutronix.de>
      LKML-Reference: <1299734608-5223-2-git-send-email-daahern@cisco.com>
      Signed-off-by: NDavid Ahern <daahern@cisco.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      be6d842a
    • F
      perf stat: Provide support for filters · cfd748ae
      Frederic Weisbecker 提交于
      Now the --filter option is usable with perf stat too.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <1300117230-8404-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cfd748ae
  7. 12 3月, 2011 4 次提交
    • A
      perf symbol: Move sym_entry->skip to symbol->ignore · 171b3be9
      Arnaldo Carvalho de Melo 提交于
      While going thru each of the sym_entry fields looking to reduce it to
      the set of entries needed when in an active symbols list, 'skip' should
      really be in symbol, as we set it when loading the symtab.
      
      And the space used by the basic symbol allocation remains the same as
      we had 5 bytes of padding.
      
      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>
      171b3be9
    • A
      perf symbols: Rename dso->origin to dso->symtab_type · 878b439d
      Arnaldo Carvalho de Melo 提交于
      And the DSO__ORIG_ enum to SYMTAB__, to clarify that this is about from
      where the symtab was obtained.
      
      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>
      878b439d
    • A
      perf top: Remove redundant syme->origin field · 8b8ba4a9
      Arnaldo Carvalho de Melo 提交于
      We can get it from syme->map->dso->kernel (that should be renamed to
      origin, but leave this for another patch).
      
      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>
      8b8ba4a9
    • A
      perf top: Remove redundant perf_top->sym_counter · ec52d976
      Arnaldo Carvalho de Melo 提交于
      We can get that counter index from perf_top->sym_evsel->idx instead.
      
      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>
      ec52d976
  8. 10 3月, 2011 5 次提交
    • A
      perf header: Stop using 'self' · 1c0b04d1
      Arnaldo Carvalho de Melo 提交于
      Stop using this python/OOP convention, doesn't really helps. Will do
      more from time to time till we get it cleaned up in all of tools/perf.
      Suggested-by: NThomas Gleixner <tglx@linutronix.de>
      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: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1c0b04d1
    • A
      perf session: Use evlist/evsel for managing perf.data attributes · a91e5431
      Arnaldo Carvalho de Melo 提交于
      So that we can reuse things like the id to attr lookup routine
      (perf_evlist__id2evsel) that uses a hash table instead of the linear
      lookup done in the older perf_header_attr routines, etc.
      
      Also to make evsels/evlist more pervasive an API, simplyfing using the
      emerging perf lib.
      
      cc: Arun Sharma <arun@sharma-home.net>
      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>
      a91e5431
    • J
      perf top: Don't let events to eat up whole header line · 65472503
      Jiri Olsa 提交于
      Passing multiple events might force out information about pid/tid/cpu.
      Attached patch leaves 30 characters for this info at the expense of the
      events' names.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Han Pingtian <phan@redhat.com>
      LKML-Reference: <1299528821-17521-3-git-send-email-jolsa@redhat.com>
      Signed-off-by: NJiri Olsa <jolsa@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      65472503
    • J
      perf top: Fix events overflow in top command · b9a46bba
      Jiri Olsa 提交于
      The snprintf function returns number of printed characters even if it
      cross the size parameter. So passing enough events via '-e' parameter
      will cause segmentation fault.
      
      It's reproduced by following command:
      
      perf top -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}'`
      
      Attached patch is adding SNPRINTF macro that provides the overflow check
      and returns actuall number of printed characters.
      Reported-by: NHan Pingtian <phan@redhat.com>
      Cc: Han Pingtian <phan@redhat.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <1299528821-17521-2-git-send-email-jolsa@redhat.com>
      Signed-off-by: NJiri Olsa <jolsa@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b9a46bba
    • L
      perf symbols: Avoid resolving [kernel.kallsyms] to real path for buildid cache · 7ee235ef
      Lin Ming 提交于
      kallsyms has a virtual file name [kernel.kallsyms].  Currently, it can't
      be added to buildid cache successfully because the code
      (build_id_cache__add_s) tries to resolve [kernel.kallsyms] to a real
      absolute pathname and that fails.
      
      Fixes it by not resolving it and just use the name [kernel.kallsyms].
      So dir ~/.debug/[kernel.kallsyms] is created.
      
      Original bug report at:
      https://lkml.org/lkml/2011/3/1/524Tested-by: NHan Pingtian <phan@redhat.com>
      Cc: Han Pingtian <phan@redhat.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <1299165837-27817-1-git-send-email-ming.m.lin@intel.com>
      Signed-off-by: NLin Ming <ming.m.lin@intel.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7ee235ef
  9. 07 3月, 2011 4 次提交
    • A
      perf report tui: Improve multi event session support · 7f0030b2
      Arnaldo Carvalho de Melo 提交于
      When multiple events were used in 'perf record', allow the user to
      choose which one is wanted before showing the per event histograms.
      
      Annotations will be performed on the chosen event.
      
      Allow going back and forth from event to event quickly using just the
      arrow keys and enter.
      
      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: William Cohen <wcohen@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7f0030b2
    • A
      perf tools: Improve support for sessions with multiple events · e248de33
      Arnaldo Carvalho de Melo 提交于
      By creating an perf_evlist out of the attributes in the perf.data file
      header, so that we can use evlists and evsels when reading recorded
      sessions in addition to when we record sessions.
      
      More work is needed to allow tools to allow the user to select which
      events are wanted when browsing sessions, be it just one or a subset of
      them, aggregated or showed at the same time but with different
      indications on the UI to allow seeing workloads thru different views at
      the same time.
      
      But the overall goal/trend is to more uniformly use evsels and evlists.
      
      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>
      e248de33
    • A
      perf evlist: Split perf_evlist__id_hash · 3d3b5e95
      Arnaldo Carvalho de Melo 提交于
      The previous situation was to receive an fd from where to read the event
      ID.
      
      Spin off a routine for when we have the ID handy, not having to read it
      from some fd.
      
      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>
      3d3b5e95
    • A
      perf hists browser: Handle browsing empty hists tree · 60098917
      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>
      60098917
  10. 06 3月, 2011 2 次提交
    • A
      perf hists: Remove needless global col lenght calcs · d7603d51
      Arnaldo Carvalho de Melo 提交于
      To support multiple events we need to do these calcs per 'struct hists'
      instance, and it turns out we already do that at:
      
      	__hists__add_entry
      		hists__inc_nr_entries
      			hists__calc_col_len
      
      for all the unfiltered hist_entry instances we stash in the rb tree, so
      trow away the dead code.
      
      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>
      d7603d51
    • A
      perf report tui: Fix multi event switching · a03f35ce
      Arnaldo Carvalho de Melo 提交于
      TAB/UNTAB were not hotkeys, so didn't exit hists__browse back to
      hists__tui_browse_tree, allowing just the first event to be browsed.
      Reported-by: NWilliam Cohen <wcohen@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>
      Cc: William Cohen <wcohen@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a03f35ce
  11. 04 3月, 2011 2 次提交
    • F
      perf: Fix undefined PyVarObject_HEAD_INIT in python 2.5 · cfff2d90
      Frederic Weisbecker 提交于
      PyVarObject_HEAD_INIT is undefined in python 2.5, resulting
      in a build crash:
      
      	util/python.c:81: attention : déclaration implicite de la fonction « «PyVarObject_HEAD_INIT» »
      	util/python.c:82: erreur: request for member «tp_name» in something not a structure or union
      	util/python.c:117: erreur: request for member «tp_name» in something not a structure or union
      	util/python.c:146: erreur: request for member «tp_name» in something not a structure or union
      	util/python.c:177: erreur: request for member «tp_name» in something not a structure or union
      	util/python.c:290: erreur: request for member «tp_name» in something not a structure or union
      	util/python.c:359: erreur: request for member «tp_name» in something not a structure or union
      	util/python.c:532: erreur: request for member «tp_name» in something not a structure or union
      	util/python.c:761: erreur: request for member «tp_name» in something not a structure or union
      	error: command 'gcc' failed with exit status 1
      	make: *** [python/perf.so] Erreur 1
      
      We can fix that by defining PyVarObject_HEAD_INIT as a wrapper on
      PyObject_HEAD_INIT, thanks to a trick found on biopython:
      https://github.com/biopython/biopython/commit/d4eaf57946c7b4c32eca8d18821edf32f83e300dSigned-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      cfff2d90
    • F
      perf: Fix missing strndup declaration · ff9ae1ba
      Frederic Weisbecker 提交于
      <ctype.h> is included first without _GNU_SOURCE, so it ends up
      including <string.h> without declaring strndup(). And further
      <string.h> declarations, even with _GNU_SOURCE defined, are
      of course without effect.
      
      Therefore:
      
      	util/strfilter.c: Dans la fonction «strfilter_node__new» :
      	util/strfilter.c:134: attention : déclaration implicite de la fonction « «strndup» »
      	util/strfilter.c:134: attention : incompatible implicit declaration of built-in function «strndup»
      	make: *** [util/strfilter.o] Erreur 1
      
      Just don't include ctype.h as it doesn't appear to be necessary
      anyway.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      ff9ae1ba
  12. 02 3月, 2011 1 次提交
    • F
      perf: Set filters before mmaping events · 0a102479
      Frederic Weisbecker 提交于
      We currently set the filters after we mmap the events, this is a
      race that let undesired events record themselves in the buffer before
      we had the time to set the filters.
      
      So set the filters before they can be recorded. That also librarizes
      the filters setting so that filtering can be done more easily
      from other tools than perf record later.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      0a102479
  13. 01 3月, 2011 5 次提交
    • A
      perf top tui: Wait till the first sample to refresh the screen. · 5807806a
      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>
      5807806a
    • A
      perf top: Fix reporting of invalid --vmlinux · 374cfe56
      Arnaldo Carvalho de Melo 提交于
      Using ui__warning, that will, in --tui, show a window with the message,
      waiting for the user to press Ok.
      
      Also run exit_browser() to let newt do its final cleaning of the screen.
      
      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>
      374cfe56
    • A
      perf tui: Make ui__warning modal · a1ceb741
      Arnaldo Carvalho de Melo 提交于
      By taking the ui__lock so that no other screen updates take place while
      waiting for the user.
      
      That was happening when handling an invalid --vmlinux parameter in 'perf
      top --tui', with the screen refresh routine repainting the screen and
      removing the warning window.
      
      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>
      a1ceb741
    • A
      perf top browser: Handle empty active symbols list · 3166fc8f
      Arnaldo Carvalho de Melo 提交于
      Fixing a SEGV. An empty list could happen when not being able to resolve
      symbols, for instance when --vmlinux invalid-file is used.
      
      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>
      3166fc8f
    • A
      perf symbols: Fix vmlinux path when not using --symfs · a639dc64
      Arnaldo Carvalho de Melo 提交于
      The ec5761ea cset introduced the symfs feature with a bug for loading vmlinux
      files that ended up causing this failure:
      
      [root@emilia v2.6.38-rc5+]# strace -e trace=open perf top --vmlinux ./vmlinux 2>&1 | tail -3
      open("/./vmlinux", O_RDONLY)            = -1 ENOENT (No such file or directory)
      ./vmlinux with build id b9266bf40e98dadb5d43a2f3e95d3c5d4aff46dc not found, continuing without symbols
      The ./vmlinux file can't be used
      [root@emilia v2.6.38-rc5+]#
      
      Remove the extra slash, just like is done in the DSO__ORIG_DSO handling in
      dso__load() and other parts of the ec5761ea cset.
      Reported-by: NIngo Molnar <mingo@elte.hu>
      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>
      a639dc64