1. 08 4月, 2015 2 次提交
    • P
      perf tools: Merge all perf_event_attr print functions · 2c5e8c52
      Peter Zijlstra 提交于
      Currently there's 3 (that I found) different and incomplete
      implementations of printing perf_event_attr.
      
      This is quite silly. Merge the lot.
      
      While this patch does not retain the exact form all printing that I
      found is debug output and thus it should not be critical.
      
      Also, I cannot find a single print_event_desc() caller.
      
      Pre:
      
       $ perf record -vv -e cycles -- sleep 1
       ------------------------------------------------------------
       perf_event_attr:
        type                0
        size                104
        config              0
        sample_period       4000
        sample_freq         4000
        sample_type         0x107
        read_format         0
        disabled            1    inherit             1
        pinned              0    exclusive           0
        exclude_user        0    exclude_kernel      0
        exclude_hv          0    exclude_idle        0
        mmap                1    comm                1
        mmap2               1    comm_exec           1
        freq                1    inherit_stat        0
        enable_on_exec      1    task                1
        watermark           0    precise_ip          0
        mmap_data           0    sample_id_all       1
        exclude_host        0    exclude_guest       1
        excl.callchain_kern 0    excl.callchain_user 0
        wakeup_events       0
        wakeup_watermark    0
        bp_type             0
        bp_addr             0
        config1             0
        bp_len              0
        config2             0
        branch_sample_type  0
        sample_regs_user    0
        sample_stack_user   0
        sample_regs_intr    0
       ------------------------------------------------------------
      
       $ perf evlist  -vv
       cycles: sample_freq=4000, size: 104, sample_type: IP|TID|TIME|PERIOD,
       disabled: 1, inherit: 1, mmap: 1, mmap2: 1, comm: 1, comm_exec: 1,
       freq: 1, enable_on_exec: 1, task: 1, sample_id_all: 1, exclude_guest: 1
      
       Post:
      
       $ ./perf record -vv -e cycles -- sleep 1
       ------------------------------------------------------------
       perf_event_attr:
        size                             112
        { sample_period, sample_freq }   4000
        sample_type                      IP|TID|TIME|PERIOD
        disabled                         1
        inherit                          1
        mmap                             1
        comm                             1
        freq                             1
        enable_on_exec                   1
        task                             1
        sample_id_all                    1
        exclude_guest                    1
        mmap2                            1
        comm_exec                        1
      ------------------------------------------------------------
      
       $ ./perf evlist  -vv
       cycles: size: 112, { sample_period, sample_freq }: 4000, sample_type:
       IP|TID|TIME|PERIOD, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq:
       1, enable_on_exec: 1, task: 1, sample_id_all: 1, exclude_guest: 1,
       mmap2: 1, comm_exec: 1
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: NIngo Molnar <mingo@kernel.org>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20150407091150.644238729@infradead.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2c5e8c52
    • P
      perf record: Add clockid parameter · 814c8c38
      Peter Zijlstra 提交于
      Teach perf-record about the new perf_event_attr::{use_clockid, clockid}
      fields. Add a simple parameter to set the clock (if any) to be used for
      the events to be recorded into the data file.
      
      Since we store the entire perf_event_attr in the EVENT_DESC section we
      also already store the used clockid in the data file.
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Yunlong Song <yunlong.song@huawei.com>
      Link: http://lkml.kernel.org/r/20150407154851.GR23123@twins.programming.kicks-ass.net
      [ Conditionally define CLOCK_BOOTTIME, at least rhel6 doesn't have it - dsahern
        Ditto for CLOCK_MONOTONIC_RAW, sles11sp2 doesn't have it - yunlong.song ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      814c8c38
  2. 26 3月, 2015 1 次提交
    • D
      perf timechart: Fix SIBGUS error on sparc64 · e94eedab
      David Ahern 提交于
      perf timechart -T on sparc64 is terminating due to SIGBUS. Backtrace:
      
      Program received signal SIGBUS, Bus error.
      0x0000000000173d7c in perf_evsel__intval (evsel=<value optimized out>, sample=0x7feffffda28, name=0x289b28 "prev_state")
          at util/evsel.c:1918
      1918	util/evsel.c: No such file or directory.
      	in util/evsel.c
      Missing separate debuginfos, use: debuginfo-install audit-libs-2.3.7-1.0.1.el6.sparc64 bzip2-libs-1.0.5-7.el6_0.sparc64 elfutils-libelf-0.155-2.0.3.el6.sparc64 elfutils-libs-0.155-2.0.3.el6.sparc64 glibc-2.12-1.132.0.8.el6_5.sparc64 numactl-2.0.7-8.el6.sparc64 python-libs-2.6.6-52.0.2.el6.sparc64 slang-2.2.1-1.el6.sparc64 xz-libs-4.999.9-0.3.beta.20091007git.el6.sparc64 zlib-1.2.3-29.el6.sparc64
      (gdb) bt
      0  0x0000000000173d7c in perf_evsel__intval (evsel=<value optimized out>, sample=0x7feffffda28,
          name=0x289b28 "prev_state") at util/evsel.c:1918
      1  0x0000000000123b94 in process_sample_sched_switch (tchart=0x7feffffe040, evsel=0x4ca850, sample=0x7feffffda28,
          backtrace=0xc39010 "") at builtin-timechart.c:627
      2  0x0000000000122828 in process_sample_event (tool=0x7feffffe040, event=<value optimized out>, sample=0x7feffffda28,
          evsel=0x4ca850, machine=0x4c9c88) at builtin-timechart.c:569
      
      Another extended load on unaligned pointer. As before fix by copying to
      a temporary variable using memcpy.
      Signed-off-by: NDavid Ahern <david.ahern@oracle.com>
      Link: http://lkml.kernel.org/r/1427228049-51893-1-git-send-email-david.ahern@oracle.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e94eedab
  3. 25 2月, 2015 1 次提交
  4. 19 2月, 2015 1 次提交
    • K
      perf tools: Enable LBR call stack support · aad2b21c
      Kan Liang 提交于
      Currently, there are two call chain recording options, fp and dwarf.
      
      Haswell has a new feature that utilizes the existing LBR facility to
      record call chains. Kernel side LBR support code provides this as a
      third option to record call chains. This patch enables the lbr call
      stack support on the tooling side.
      
      LBR call stack has some limitations:
      
       - It reuses current LBR facility, so LBR call stack and branch record
         can not be enabled at the same time.
      
       - It is only available for user-space callchains.
      
      However, it also offers some advantages:
      
       - LBR call stack can work on user apps which don't have frame-pointers
         or dwarf debug info compiled. It is a good alternative when nothing
         else works.
      Tested-by: NJiri Olsa <jolsa@kernel.org>
      Signed-off-by: NKan Liang <kan.liang@intel.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Anshuman Khandual <khandual@linux.vnet.ibm.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Cody P Schafer <cody@linux.vnet.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Jacob Shin <jacob.w.shin@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Masanari Iida <standby24x7@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Rodrigo Campos <rodrigo@sdfg.com.ar>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/1420482185-29830-2-git-send-email-kan.liang@intel.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      aad2b21c
  5. 30 1月, 2015 1 次提交
    • N
      perf evsel: Set attr.task bit for a tracking event · 62e503b7
      Namhyung Kim 提交于
      The perf_event_attr.task bit is to track task (fork and exit) events but
      it missed to be set by perf_evsel__config().  While it was not a problem
      in practice since setting other bits (comm/mmap) ended up being in same
      result, it'd be good to set it explicitly anyway.
      
      The attr->task is to track task related events (fork/exit) only but
      other meta events like comm and mmap[2] also needs the task events.  So
      setting attr->comm and/or attr->mmap causes the kernel emits the task
      events anyway.  So the attr->task is only meaningful when other bits are
      off but I'd like to set it for completeness.
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1422518843-25818-6-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      62e503b7
  6. 28 1月, 2015 1 次提交
    • V
      perf evsel: Don't rely on malloc working for sz 0 · 8d9cbd8f
      Vineet Gupta 提交于
      When running perf on ARC (uClibc based userspace), ran into this issue
         ------------->8----------------
      	[ARCLinux]$ ./perf record ls
      	bin             etc             perf            sys
      	debug           init            perf.data       tmp
      	[ perf record: Woken up 1 times to write data ]
      	[ perf record: Captured and wrote 0.001 MB perf.data (~24 samples) ]
      
      	[ARCLinux]$ ./perf report
      	incompatible file format (rerun with -v to learn more)
         ------------->8----------------
      
      The problem happens in the following call stack when zalloc is called
      with size zero
      
      glibc default / uClibc with MALLOC_GLIBC_COMPAT are OK, but not if that
      config option is not enabled.
      
        cmd_report
           perf_session__new
      	perf_session__open
      	    perf_session__read_header
      		read_attr(fd, header, &f_attr)
      		nr_ids = f_attr.ids.size / sizeof(u64); <-- 0
      		perf_evsel__alloc_id(vsel, 1, nr_ids)
      			zalloc(ncpus * nthreads * sizeof(u64)) <-- 0
      
      header.c: read_attr()
      
      (gdb) p *f_attr
      $17 = {
        attr = {
          type = 0,
          size = 96,
          config = 0,
          {
            sample_period = 4000,
            sample_freq = 4000
          },
      ...
        ids = {
          offset = 104,
          size = 0      <------
        }
      }
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      Suggested-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1421156604-30603-5-git-send-email-vgupta@synopsys.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8d9cbd8f
  7. 02 12月, 2014 1 次提交
  8. 25 11月, 2014 3 次提交
  9. 19 11月, 2014 1 次提交
  10. 16 11月, 2014 1 次提交
  11. 07 11月, 2014 1 次提交
  12. 17 10月, 2014 2 次提交
  13. 15 10月, 2014 4 次提交
    • A
      perf evsel: Make some exit routines static · 8885846f
      Arnaldo Carvalho de Melo 提交于
      Since they are automatically called by other methods used by tools.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jean Pihet <jean.pihet@linaro.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-ne3g4any7q6ty5d6yv8t1wws@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8885846f
    • A
      perf tools: Remove hists from evsel · a635fc51
      Arnaldo Carvalho de Melo 提交于
      Now tools that deals want to have an hists per evsel need to call
      hists__init() before creating any evsels, which can be as early as when
      parsing the command line, so do it before calling parse_options().
      
      The current tools using hists/hist_entries are report, top and annotate,
      change them to request per evsel hists.
      
      This is in preparation for making evsels usable by 3rd party tools, that
      not necessarily live in perf's source code repository.
      Acked-by: NBorislav Petkov <bp@suse.de>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jean Pihet <jean.pihet@linaro.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-usjx2la743f10ippj7p1b20x@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a635fc51
    • A
      perf callchain: Move the callchain_param extern to callchain.h · 8f651eae
      Arnaldo Carvalho de Melo 提交于
      It was lost in hist.h, move it to where it belongs, callchain.h, as
      there are places that gets hist.h by means of evsel.h, and since evsel.h
      is being untangled from hist.h...
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jean Pihet <jean.pihet@linaro.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-0rg7ji1jnbm6q6gj35j37jby@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8f651eae
    • A
      perf evsel: Subclassing · ce8ccff5
      Arnaldo Carvalho de Melo 提交于
      Provide a method to be called at tool start to config the perf_evsel
      instance size, together with optional constructor and destructor.
      
      This will be used so that perf_evsel doesn't always include a struct
      hists, tools that works with hists/hist_entries, like report, top and
      annotate, will, at start, tell the evsel class the size they need per
      instance.
      
      v2: Don't use exit as a name of a member of function parameter, as this
          breaks the build on at least fedora14 and rhel6.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jean Pihet <jean.pihet@linaro.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-7t8cay0ieryox4gqosie85ek@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ce8ccff5
  14. 26 9月, 2014 1 次提交
  15. 15 8月, 2014 1 次提交
  16. 14 8月, 2014 2 次提交
  17. 12 8月, 2014 2 次提交
    • J
      perf tools: Show better error message in case we fail to open counters due to EBUSY error · 63914aca
      Jiri Olsa 提交于
      Showing better error message in case we fail to open counters due to the
      EBUSY error. If we detect oprofile daemon process running, we now
      display following message for EBUSY error:
      
        $ perf record ls
        Error:
        The PMU counters are busy/taken by another profiler.
        We found oprofile daemon running, please stop it and try again.
      
      In case oprofiled was not detected the current error message stays:
      
        $ perf record ls
        Error:
        The sys_perf_event_open() syscall returned with 16 (Device or resource busy) for event (cycles).
        /bin/dmesg may provide additional information.
        No CONFIG_PERF_EVENTS=y kernel support configured?
      
      Also changing PERF_FLAG_FD_CLOEXEC detection code not to display error
      in case of EBUSY error, as it currently does:
      
        $ perf record ls
        Error:
        perf_event_open(..., PERF_FLAG_FD_CLOEXEC) failed with unexpected error 16 (Device or resource busy)
        perf_event_open(..., 0) failed unexpectedly with error 16 (Device or resource busy)
        The PMU counters are busy/taken by another profiler.
        We found oprofile daemon running, please stop it and try again.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: William Cohen <wcohen@redhat.com>
      Cc: Yann Droneaud <ydroneaud@opteya.com>
      Link: http://lkml.kernel.org/r/1406908014-8312-1-git-send-email-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      63914aca
    • A
      perf record: Honour --no-time command line option · 8affc2b8
      Andi Kleen 提交于
      Time stamps are always implicitely enabled for record currently.  The
      old --time/-T option is a nop.
      
      Allow the user to disable timestamps by using --no-time, honouring the
      existing option.
      
      The defaults are unchanged.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1406789104-25863-10-git-send-email-zheng.z.yan@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8affc2b8
  18. 18 7月, 2014 1 次提交
  19. 17 7月, 2014 3 次提交
  20. 12 6月, 2014 1 次提交
    • N
      perf record: Fix to honor user freq/interval properly · 17314e23
      Namhyung Kim 提交于
      When configuring event perf checked a wrong condition that user
      specified both of freq (-F) and period (-c) or the event has no
      default value.  This worked because most of events don't have default
      value and only tracepoint events have default of 1 (and it's not
      desirable to change it for those events).
      
      However, Andi's downloadable event patch changes the situation so it
      cannot change the value for those events.  Fix it by allowing override
      the default value if user gives one of the options.
      
        $ perf record -a -e uops_retired.all -F 4000 sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.325 MB perf.data (~14185 samples) ]
      
        $ perf evlist -F
        cpu/uops_retired.all/: sample_freq=4000
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Link: http://lkml.kernel.org/r/1402292617-26278-1-git-send-email-namhyung@kernel.orgSigned-off-by: NJiri Olsa <jolsa@kernel.org>
      17314e23
  21. 09 6月, 2014 1 次提交
  22. 19 3月, 2014 1 次提交
  23. 11 3月, 2014 1 次提交
  24. 18 2月, 2014 3 次提交
  25. 21 1月, 2014 1 次提交
  26. 15 1月, 2014 1 次提交
  27. 13 1月, 2014 1 次提交