1. 08 10月, 2011 1 次提交
    • S
      perf tools: Make perf.data more self-descriptive (v8) · fbe96f29
      Stephane Eranian 提交于
      The goal of this patch is to include more information about the host
      environment into the perf.data so it is more self-descriptive. Overtime,
      profiles are captured on various machines and it becomes hard to track
      what was recorded, on what machine and when.
      
      This patch provides a way to solve this by extending the perf.data file
      with basic information about the host machine. To add those extensions,
      we leverage the feature bits capabilities of the perf.data format.  The
      change is backward compatible with existing perf.data files.
      
      We define the following useful new extensions:
       - HEADER_HOSTNAME: the hostname
       - HEADER_OSRELEASE: the kernel release number
       - HEADER_ARCH: the hw architecture
       - HEADER_CPUDESC: generic CPU description
       - HEADER_NRCPUS: number of online/avail cpus
       - HEADER_CMDLINE: perf command line
       - HEADER_VERSION: perf version
       - HEADER_TOPOLOGY: cpu topology
       - HEADER_EVENT_DESC: full event description (attrs)
       - HEADER_CPUID: easy-to-parse low level CPU identication
      
      The small granularity for the entries is to make it easier to extend
      without breaking backward compatiblity. Many entries are provided as
      ASCII strings.
      
      Perf report/script have been modified to print the basic information as
      easy-to-parse ASCII strings. Extended information about CPU and NUMA
      topology may be requested with the -I option.
      
      Thanks to David Ahern for reviewing and testing the many versions of
      this patch.
      
       $ perf report --stdio
       # ========
       # captured on : Mon Sep 26 15:22:14 2011
       # hostname : quad
       # os release : 3.1.0-rc4-tip
       # perf version : 3.1.0-rc4
       # arch : x86_64
       # nrcpus online : 4
       # nrcpus avail : 4
       # cpudesc : Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz
       # cpuid : GenuineIntel,6,15,11
       # total memory : 8105360 kB
       # cmdline : /home/eranian/perfmon/official/tip/build/tools/perf/perf record date
       # event : name = cycles, type = 0, config = 0x0, config1 = 0x0, config2 = 0x0, excl_usr = 0, excl_kern = 0, id = { 29, 30, 31,
       # HEADER_CPU_TOPOLOGY info available, use -I to display
       # HEADER_NUMA_TOPOLOGY info available, use -I to display
       # ========
       #
       ...
      
       $ perf report --stdio -I
       # ========
       # captured on : Mon Sep 26 15:22:14 2011
       # hostname : quad
       # os release : 3.1.0-rc4-tip
       # perf version : 3.1.0-rc4
       # arch : x86_64
       # nrcpus online : 4
       # nrcpus avail : 4
       # cpudesc : Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz
       # cpuid : GenuineIntel,6,15,11
       # total memory : 8105360 kB
       # cmdline : /home/eranian/perfmon/official/tip/build/tools/perf/perf record date
       # event : name = cycles, type = 0, config = 0x0, config1 = 0x0, config2 = 0x0, excl_usr = 0, excl_kern = 0, id = { 29, 30, 31,
       # sibling cores   : 0-3
       # sibling threads : 0
       # sibling threads : 1
       # sibling threads : 2
       # sibling threads : 3
       # node0 meminfo  : total = 8320608 kB, free = 7571024 kB
       # node0 cpu list : 0-3
       # ========
       #
       ...
      Reviewed-by: NDavid Ahern <dsahern@gmail.com>
      Tested-by: NDavid Ahern <dsahern@gmail.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <robert.richter@amd.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Link: http://lkml.kernel.org/r/20110930134040.GA5575@quadSigned-off-by: NStephane Eranian <eranian@google.com>
      [ committer notes: Use --show-info in the tools as was in the docs, rename
        perf_header_fprintf_info to perf_file_section__fprintf_info, fixup
        conflict with f69b64f7 "perf: Support setting the disassembler style" ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      fbe96f29
  2. 05 7月, 2011 1 次提交
    • A
      perf report/annotate/script: Add option to specify a CPU range · 5d67be97
      Anton Blanchard 提交于
      Add an option to perf report/annotate/script to specify which
      CPUs to operate on. This enables us to take a single system wide
      profile and analyse each CPU (or group of CPUs) in isolation.
      
      This was useful when profiling a multiprocess workload where the
      bottleneck was on one CPU but this was hidden in the overall
      profile. Per process and per thread breakdowns didn't help
      because multiple processes were running on each CPU and no
      single process consumed an entire CPU.
      
      The patch converts the list of CPUs returned by cpu_map__new
      into a bitmap for fast lookup. I wanted to use -C to be
      consistent with perf top/record/stat, but unfortunately perf
      report already uses -C <comms>.
      
       v2: Incorporate suggestions from David Ahern:
      	- Added -c to perf script
      	- Check that SAMPLE_CPU is set when -c is used
      	- Update documentation
      
       v3: Create perf_session__cpu_bitmap()
      Signed-off-by: NAnton Blanchard <anton@samba.org>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Link: http://lkml.kernel.org/r/20110704215750.11647eb9@krytenSigned-off-by: NIngo Molnar <mingo@elte.hu>
      5d67be97
  3. 03 6月, 2011 3 次提交
  4. 26 5月, 2011 1 次提交
  5. 20 4月, 2011 1 次提交
  6. 19 4月, 2011 1 次提交
  7. 31 3月, 2011 1 次提交
    • D
      perf script: If type not given fields apply to all event types · 2c9e45f7
      David Ahern 提交于
      Allow:
        perf script -f <fields>
      
      to be equivalent to:
        perf script -f trace:<fields> -f sw:<fields> -f hw:<fields>
      
      i.e., the specified fields apply to all event types if the type string
      is not given.
      
      The field (-f) arguments are processed in the order received. A later
      usage can reset a prior request. e.g.,
      
        -f trace: -f comm,tid,time,sym
      
      The first -f suppresses trace events (field list is ""), but then the second
      invocation sets the fields to comm,tid,time,sym. In this case a warning is
      given to the user:
      
        "Overriding previous field request for all events."
      
      Alternativey, consider the order:
      
        -f comm,tid,time,sym -f trace:
      
      The first -f sets the fields for all events and the second -f suppresses trace
      events. The user is given a warning message about the override, and the result
      of the above is that only S/W and H/W events are displayed with the given
      fields.
      
      For the 'wildcard' option if a user selected field is invalid for an event
      type, a message is displayed to the user that the option is ignored for that
      type. For example:
      
        perf script -f comm,tid,trace 2>&1 | less
        'trace' not valid for hardware events. Ignoring.
        'trace' not valid for software events. Ignoring.
      
      Alternatively, if the type is given an invalid field is specified it is an
      error. For example:
      
          perf script -v -f sw:comm,tid,trace 2>&1 | less
          'trace' not valid for software events.
      
      At this point usage is displayed, and perf-script exits.
      
      Finally, a user may not set fields to none for all event types.
      i.e., -f "" is not allowed.
      
      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: linux-kernel@vger.kernel.org
      LPU-Reference: <1300377801-27246-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>
      2c9e45f7
  8. 24 3月, 2011 1 次提交
    • 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
  9. 15 3月, 2011 5 次提交
    • 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 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
  10. 30 1月, 2011 2 次提交
  11. 23 1月, 2011 1 次提交
    • A
      perf tools: Fix 64 bit integer format strings · 9486aa38
      Arnaldo Carvalho de Melo 提交于
      Using %L[uxd] has issues in some architectures, like on ppc64.  Fix it
      by making our 64 bit integers typedefs of stdint.h types and using
      PRI[ux]64 like, for instance, git does.
      
      Reported by Denis Kirjanov that provided a patch for one case, I went
      and changed all cases.
      Reported-by: NDenis Kirjanov <dkirjanov@kernel.org>
      Tested-by: NDenis Kirjanov <dkirjanov@kernel.org>
      LKML-Reference: <20110120093246.GA8031@hera.kernel.org>
      Cc: Denis Kirjanov <dkirjanov@kernel.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Pingtian Han <phan@redhat.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9486aa38
  12. 06 1月, 2011 2 次提交
    • 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
  13. 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
  14. 22 12月, 2010 1 次提交
    • I
      perf session: Fallback to unordered processing if no sample_id_all · 21ef97f0
      Ian Munsie 提交于
      If we are running the new perf on an old kernel without support for
      sample_id_all, we should fall back to the old unordered processing of
      events. If we didn't than we would *always* process events without
      timestamps out of order, whether or not we hit a reordering race. In
      other words, instead of there being a chance of not attributing samples
      correctly, we would guarantee that samples would not be attributed.
      
      While processing all events without timestamps before events with
      timestamps may seem like an intuitive solution, it falls down as
      PERF_RECORD_EXIT events would also be processed before any samples.
      Even with a workaround for that case, samples before/after an exec would
      not be attributed correctly.
      
      This patch allows commands to indicate whether they need to fall back to
      unordered processing, so that commands that do not care about timestamps
      on every event will not be affected. If we do fallback, this will print
      out a warning if report -D was invoked.
      
      This patch adds the test in perf_session__new so that we only need to
      test once per session. Commands that do not use an event_ops (such as
      record and top) can simply pass NULL in it's place.
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      LKML-Reference: <1291951882-sup-6069@au1.ibm.com>
      Signed-off-by: NIan Munsie <imunsie@au1.ibm.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      21ef97f0
  15. 06 12月, 2010 1 次提交
    • S
      perf script: Fix compiler warning in builtin_script.c:is_top_script() · 965bb6be
      Stephane Eranian 提交于
      Fix annoying compiler warning in the is_top_script() function.
      
      The issue was that a const char * was cast into a char * to call
      ends_with(). We fix the users of ends_with() instead. Some are passing a
      char *, but it is okay to cast the return value of ends_with() to char *
      (because we understand what ends_with() does).
      
      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: <4cf92096.17edd80a.1540.5d60@mx.google.com>
      Signed-off-by: NStephane Eranian <eranian@google.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      965bb6be
  16. 05 12月, 2010 1 次提交
    • A
      perf session: Parse sample earlier · 640c03ce
      Arnaldo Carvalho de Melo 提交于
      At perf_session__process_event, so that we reduce the number of lines in eache
      tool sample processing routine that now receives a sample_data pointer already
      parsed.
      
      This will also be useful in the next patch, where we'll allow sample the
      identity fields in MMAP, FORK, EXIT, etc, when it will be possible to see (cpu,
      timestamp) just after before every event.
      
      Also validate callchains in perf_session__process_event, i.e. as early as
      possible, and keep a counter of the number of events discarded due to invalid
      callchains, warning the user about it if it happens.
      
      There is an assumption that was kept that all events have the same sample_type,
      that will be dealt with in the future, when this preexisting limitation will be
      removed.
      Tested-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NIan Munsie <imunsie@au1.ibm.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Ian Munsie <imunsie@au1.ibm.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: <1291318772-30880-4-git-send-email-acme@infradead.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      640c03ce
  17. 17 11月, 2010 1 次提交
  18. 10 11月, 2010 4 次提交
    • T
      perf trace: update usage · 7e55055e
      Tom Zanussi 提交于
      Update usage to reflect the different perf trace variants.
      Signed-off-by: NTom Zanussi <tom.zanussi@linux.intel.com>
      Acked-by: NArnaldo Carvalho de Melo <acme@ghostprotocols.net>
      7e55055e
    • T
      perf trace: live-mode command-line cleanup · b5b87312
      Tom Zanussi 提交于
      This patch attempts to make the perf trace command-line for live-mode
      commands more user-friendly and consistent with other perf commands.
      
      The main change it makes is to allow <commands> to be run as part of
      perf trace live-mode commands, as other perf commands do, instead of
      the system-wide traces they're currently hard-coded to by the shell
      scripts.
      
      With this patch, the following live-mode trace now works as expected:
      
       $ perf trace rw-by-pid ls -al
      
      The previous system-wide behavior for this command would still be
      available by explicitly specifying -a:
      
       $ perf trace rw-by-pid -a ls -al
      
      and if no <command> is specified, the output is also system-wide:
      
       $ perf trace rw-by-pid
      
      Because live-mode requires both record and report steps to be invoked,
      it isn't always possible to know which args to send to the report and
      which to send to the record steps - mainly this is the case for report
      scripts with optional args - in those cases it would be necessary to
      use separate 'perf trace record' and 'perf trace report' steps.
      
      For example:
      
       $ perf trace syscall-counts ls
      
      Here we can't decide whether ls should be passed as a param to the
      syscall-counts script or whether we should invoke ls as a <command>.
      In these cases, we just say that we'll ignore optional script params
      and always interpret the extra arguments as a <command>.
      
      If the user instead wants the other interpretation, that can be
      accomplished by using separate record and report commands explicitly:
      
       $ perf trace record syscall-counts
       $ perf trace report syscall-counts ls
      
      So the rules that this patch implements, which seem to make the most
      intuitive sense for live-mode commands:
      
      - for commands with optional args and commands with no args, no args
        are sent to the report script, all are sent to the record step
      
      - for 'top' commands i.e. that end with 'top', <commands> can't be
        used - all extra args are send to the report script as params
      
      - for commands with required args, the n required args are taken to be
        the first n args after the script name and sent to the report
        script, and the rest are sent to the record step
      Signed-off-by: NTom Zanussi <tom.zanussi@linux.intel.com>
      Acked-by: NArnaldo Carvalho de Melo <acme@ghostprotocols.net>
      b5b87312
    • T
      perf trace record: handle commands correctly · 34c86ea9
      Tom Zanussi 提交于
      Because the perf-trace shell scripts hard-coded the use of the
      perf-record system-wide param, a perf trace record session was always
      system wide, even if it was given a command.
      
      If given a command, perf trace record now only records the events for
      the command, as users expect.
      
      If no command is given, or if the '-a' option is used, the recorded
      events are system-wide, as before.
      
      root@tropicana:~# perf trace record syscall-counts ls -al
      root@tropicana:~# perf trace
                    ls-23152 [000] 39984.890387: sys_enter: NR 12 (0, 0, 0, 0, 0, 0)
                    ls-23152 [000] 39984.890404: sys_enter: NR 9 (0, 0, 0, 0, 0, 0)
      
      root@tropicana:~# perf trace record syscall-counts -a ls -al
      root@tropicana:~# perf trace
          npviewer.bin-22297 [000] 39831.102709: sys_enter: NR 168 (0, 0, 0, 0, 0, 0)
                    ls-23111 [000] 39831.107679: sys_enter: NR 59 (0, 0, 0, 0, 0, 0)
      Signed-off-by: NTom Zanussi <tom.zanussi@linux.intel.com>
      Acked-by: NArnaldo Carvalho de Melo <acme@ghostprotocols.net>
      34c86ea9
    • T
      perf trace scripting: fix some small memory leaks and missing error checks · e8719adf
      Tom Zanussi 提交于
      Free the other two fields of script_desc which somehow got overlooked,
      free malloc'ed args in case exec fails, and add missing checks for
      failed mallocs.
      Signed-off-by: NTom Zanussi <tom.zanussi@linux.intel.com>
      Acked-by: NArnaldo Carvalho de Melo <acme@ghostprotocols.net>
      e8719adf
  19. 27 10月, 2010 1 次提交
  20. 24 10月, 2010 2 次提交
  21. 06 8月, 2010 1 次提交
    • A
      perf trace: Clean up #includes · b7eead86
      Andrea Gelmini 提交于
      Removed duplicated #includes util/trace-event.h and
      util/exec_cmd.h.
      Grouped and sorted all the #includes.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      LKML-Reference: <1281016299-23958-14-git-send-email-andrea.gelmini@gelma.net>
      Signed-off-by: NAndrea Gelmini <andrea.gelmini@gelma.net>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b7eead86
  22. 25 6月, 2010 2 次提交
    • F
      perf: Report lost events in perf trace debug mode · ffabd99e
      Frederic Weisbecker 提交于
      Account and report lost events in perf trace debugging mode,
      useful to check the reliability of the traces.
      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>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      ffabd99e
    • F
      perf: Don't print traces when debugging ordering · 6fcf7ddb
      Frederic Weisbecker 提交于
      Errors due to ordering bugs are easily lost in the middle
      of traces.
      
      When we are in this mode, don't print the traces so that
      we don't miss the debugging messages.
      But display a comforting message if we didn't encounter any
      ordering problem.
      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>
      6fcf7ddb
  23. 15 5月, 2010 1 次提交
    • A
      perf hist: Clarify events_stats fields usage · cee75ac7
      Arnaldo Carvalho de Melo 提交于
      The events_stats.total field is too generic, rename it to .total_period,
      and also add a comment explaining that it is the sum of all the .period
      fields in samples, that is needed because we use auto-freq to avoid
      sampling artifacts.
      
      Ditto for events_stats.lost, that is the sum of all lost_event.lost
      fields, i.e. the number of events the kernel dropped.
      
      Looking at the users, builtin-sched.c can make use of these fields and
      stop doing it again.
      
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cee75ac7
  24. 11 5月, 2010 2 次提交
    • T
      perf/trace/scripting: don't show script start/stop messages by default · 3824a4e8
      Tom Zanussi 提交于
      Only print the script start/stop messages in verbose mode - users
      normally don't care and it just clutters up the output.
      
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      LKML-Reference: <1273466820-9330-7-git-send-email-tzanussi@gmail.com>
      Signed-off-by: NTom Zanussi <tzanussi@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3824a4e8
    • A
      perf hist: Introduce hists class and move lots of methods to it · 1c02c4d2
      Arnaldo Carvalho de Melo 提交于
      In cbbc79a5 we introduced support for multiple events by introducing a
      new "event_stat_id" struct and then made several perf_session methods
      receive a point to it instead of a pointer to perf_session, and kept the
      event_stats and hists rb_tree in perf_session.
      
      While working on the new newt based browser, I realised that it would be
      better to introduce a new class, "hists" (short for "histograms"),
      renaming the "event_stat_id" struct and the perf_session methods that
      were really "hists" methods, as they manipulate only struct hists
      members, not touching anything in the other perf_session members.
      
      Other optimizations, such as calculating the maximum lenght of a symbol
      name present in an hists instance will be possible as we add them,
      avoiding a re-traversal just for finding that information.
      
      The rationale for the name "hists" to replace "event_stat_id" is that we
      may have multiple sets of hists for the same event_stat id, as, for
      instance, the 'perf diff' tool has, so event stat id is not what
      characterizes what this struct and the functions that manipulate it do.
      
      Cc: Eric B Munson <ebmunson@us.ibm.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1c02c4d2
  25. 03 5月, 2010 1 次提交
    • T
      perf: add perf-inject builtin · 454c407e
      Tom Zanussi 提交于
      Currently, perf 'live mode' writes build-ids at the end of the
      session, which isn't actually useful for processing live mode events.
      
      What would be better would be to have the build-ids sent before any of
      the samples that reference them, which can be done by processing the
      event stream and retrieving the build-ids on the first hit.  Doing
      that in perf-record itself, however, is off-limits.
      
      This patch introduces perf-inject, which does the same job while
      leaving perf-record untouched.  Normal mode perf still records the
      build-ids at the end of the session as it should, but for live mode,
      perf-inject can be injected in between the record and report steps
      e.g.:
      
      perf record -o - ./hackbench 10 | perf inject -v -b | perf report -v -i -
      
      perf-inject reads a perf-record event stream and repipes it to stdout.
      At any point the processing code can inject other events into the
      event stream - in this case build-ids (-b option) are read and
      injected as needed into the event stream.
      
      Build-ids are just the first user of perf-inject - potentially
      anything that needs userspace processing to augment the trace stream
      with additional information could make use of this facility.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1272696080-16435-3-git-send-email-tzanussi@gmail.com>
      Signed-off-by: NTom Zanussi <tzanussi@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      454c407e
  26. 24 4月, 2010 1 次提交