1. 31 5月, 2012 2 次提交
    • N
      perf callchain: Make callchain cursors TLS · 47260645
      Namhyung Kim 提交于
      perf top -G has a race on callchain cursor between main thread and
      display thread. Since the callchain cursors are used locally make them
      thread-local data would solve the problem.
      Signed-off-by: NNamhyung Kim <namhyung.kim@lge.com>
      Reported-by: NSunjin Yang <fan4326@gmail.com>
      Suggested-by: NArnaldo Carvalho de Melo <acme@ghostprotocols.net>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Sunjin Yang <fan4326@gmail.com>
      Link: http://lkml.kernel.org/r/1338443007-24857-1-git-send-email-namhyung.kim@lge.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      47260645
    • D
      perf script: Fix regression in callchain dso name · 52deff71
      David Ahern 提交于
      $ perf script -i /tmp/perf.data
      ...
      gcc 13623 544315.062858: context-switches:
          ffffffff815f65c9 __schedule ([kernel.kallsyms])
          ffffffff81087cea __cond_resched ([kernel.kallsyms])
          ffffffff815f6b92 _cond_resched ([kernel.kallsyms])
          ffffffff815fb87a do_page_fault ([kernel.kallsyms])
          ffffffff815f8465 page_fault ([kernel.kallsyms])
              2b7a71ea0303 _dl_lookup_symbol_x ([kernel.kallsyms])
              2b7a71ea1eb5 _dl_relocate_object ([kernel.kallsyms])
              2b7a71e99b2e dl_main ([kernel.kallsyms])
              2b7a71eab7f4 _dl_sysdep_start ([kernel.kallsyms])
      
      All DSO's in a callchain are printed as [kernel.kallsyms].
      
      git bisect chased it to:
      
      547a92e0 is the first bad commit
      commit 547a92e0
      Author: Akihiro Nagai <akihiro.nagai.hw@hitachi.com>
      Date:   Mon Jan 30 13:42:57 2012 +0900
      
          perf script: Unify the expressions indicating "unknown"
      
          The perf script command uses various expressions to indicate "unknown".
      
          It is unfriendly for user scripts to parse it. So, this patch unifies
          the expressions to "[unknown]".
      
      Looks like a copy-paste in that the other references use al.map but this one
      should be node->map.
      
      With this patch you get:
      
      $ perf script -i /tmp/perf.data
      ...
      gcc 13623 544315.062858: context-switches:
          ffffffff815f65c9 __schedule ([kernel.kallsyms])
          ffffffff81087cea __cond_resched ([kernel.kallsyms])
          ffffffff815f6b92 _cond_resched ([kernel.kallsyms])
          ffffffff815fb87a do_page_fault ([kernel.kallsyms])
          ffffffff815f8465 page_fault ([kernel.kallsyms])
              2b7a71ea0303 _dl_lookup_symbol_x (/lib64/ld-2.14.90.so)
              2b7a71ea1eb5 _dl_relocate_object (/lib64/ld-2.14.90.so)
              2b7a71e99b2e dl_main (/lib64/ld-2.14.90.so)
              2b7a71eab7f4 _dl_sysdep_start (/lib64/ld-2.14.90.so)
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Cc: Akihiro Nagai <akihiro.nagai.hw@hitachi.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>
      Link: http://lkml.kernel.org/r/1338353906-60706-1-git-send-email-dsahern@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      52deff71
  2. 22 5月, 2012 2 次提交
    • S
      perf tools: Fix piped mode read code · 444d2866
      Stephane Eranian 提交于
      In __perf_session__process_pipe_events(), there was a risk we would read
      more than what a union perf_event struct can hold. this could happen in
      case, perf is reading a file which contains new record types it does not
      know about and which are larger than anything it knows about.
      
      In general, perf is supposed to skip records it does not understand, but
      in pipe mode, those have to be read and ignored.  The fixed size header
      contains the size of the record, but that size may be larger than union
      perf_event, yet it was used as the backing to the read in:
      
        union perf_event event;
        void *p;
      
        size = event->header.size;
      
        p = &event;
        p += sizeof(struct perf_event_header);
        if (size - sizeof(struct perf_event_header)) {
          err = readn(self->fd, p, size - sizeof(struct perf_event_header));
      
      We fix this by allocating a buffer based on the size reported in the
      header. We reuse the buffer as much as we can. We realloc in case it
      becomes too small. In the  common case, the performance impact is
      negligible.
      Signed-off-by: NStephane Eranian <eranian@google.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1337081295-10303-3-git-send-email-eranian@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      444d2866
    • J
      perf tools: Carry perf_event_attr bitfield throught different endians · e108c66e
      Jiri Olsa 提交于
      When the perf data file is read cross architectures, the
      perf_event__attr_swap function takes care about endianness of all the
      struct fields except the bitfield flags.
      
      The bitfield flags need to be transformed as well, since the bitfield
      binary storage differs for both endians.
      
      ABI says:
        Bit-fields are allocated from right to left (least to most significant)
        on little-endian implementations and from left to right (most to least
        significant) on big-endian implementations.
      
      The above seems to be byte specific, so we need to reverse each byte of
      the bitfield. 'Internet' also says this might be implementation specific
      and we probably need proper fix and carry perf_event_attr bitfield flags
      in separate data file FEAT_ section. Thought this seems to work for now.
      
      Note, running following to test perf endianity handling:
      test 1)
        - origin system:
          # perf record -a -- sleep 10 (any perf record will do)
          # perf report > report.origin
          # perf archive perf.data
      
        - copy the perf.data, report.origin and perf.data.tar.bz2
          to a target system and run:
          # tar xjvf perf.data.tar.bz2 -C ~/.debug
          # perf report > report.target
          # diff -u report.origin report.target
      
        - the diff should produce no output
          (besides some white space stuff and possibly different
           date/TZ output)
      
      test 2)
        - origin system:
          # perf record -ag -fo /tmp/perf.data -- sleep 1
        - mount origin system root to the target system on /mnt/origin
        - target system:
          # perf script --symfs /mnt/origin -I -i /mnt/origin/tmp/perf.data \
           --kallsyms /mnt/origin/proc/kallsyms
        - complete perf.data header is displayed
      Signed-off-by: NJiri Olsa <jolsa@redhat.com>
      Reviewed-by: NDavid Ahern <dsahern@gmail.com>
      Tested-by: NDavid Ahern <dsahern@gmail.com>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1337151548-2396-3-git-send-email-jolsa@redhat.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e108c66e
  3. 04 5月, 2012 1 次提交
  4. 12 4月, 2012 1 次提交
  5. 11 4月, 2012 1 次提交
  6. 23 3月, 2012 1 次提交
  7. 09 3月, 2012 3 次提交
  8. 14 2月, 2012 1 次提交
  9. 31 1月, 2012 2 次提交
  10. 04 1月, 2012 1 次提交
  11. 24 12月, 2011 2 次提交
  12. 28 11月, 2011 7 次提交
  13. 16 11月, 2011 1 次提交
  14. 02 11月, 2011 2 次提交
  15. 26 10月, 2011 1 次提交
  16. 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
  17. 21 7月, 2011 2 次提交
  18. 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
  19. 30 6月, 2011 1 次提交
    • S
      perf tools: Add inverted call graph report support. · d797fdc5
      Sam Liao 提交于
      Add "caller/callee" option to support inverted butterfly report,
      in the inverted report (with caller option), the call graph start
      from the callee's ancestor. Users can use such view to catch system's
      performance bottleneck from a sysprof like view. Using this option
      with specified sort order like pid gives us high level view of call
      graph statistics.
      
      Also add "-G" alias for inverted call graph.
      Signed-off-by: NSam Liao <phyomh@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: Stephane Eranian <eranian@google.com>
      Cc: David Ahern <dsahern@gmail.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      d797fdc5
  20. 03 6月, 2011 4 次提交
  21. 02 6月, 2011 1 次提交
    • A
      perf evlist: Don't die if sample_{id_all|type} is invalid · c2a70653
      Arnaldo Carvalho de Melo 提交于
      Fixes two more cases where the python binding would not load:
      
      . Not finding die(), which it shouldn't anyway, not good to just stop the
        world because some particular perf.data file is invalid, just propagate
        the error to the caller.
      
      . Not finding perf_sample_size: fix it by moving it from event.c to evsel,
        where it belongs, as most cases are moving to operate on an evsel object.o
      
      One of the fixed problems:
      
      [root@emilia ~]# python
      >>> import perf
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
      ImportError: /home/acme/git/build/perf/python/perf.so: undefined symbol: perf_sample_size
      >>>
      [root@emilia ~]#
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      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-1hkj7b2cvgbfnoizsekjb6c9@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c2a70653
  22. 23 5月, 2011 1 次提交
  23. 22 5月, 2011 1 次提交