1. 09 4月, 2009 1 次提交
    • P
      perf_counter: some simple userspace profiling · de9ac07b
      Peter Zijlstra 提交于
      # perf-record make -j4 kernel/
       # perf-report | tail -15
      
        0.39              cc1 [kernel] lock_acquired
        0.42              cc1 [kernel] lock_acquire
        0.51              cc1 [ user ] /lib64/libc-2.8.90.so: _int_free
        0.51               as [kernel] clear_page_c
        0.53              cc1 [ user ] /lib64/libc-2.8.90.so: memcpy
        0.56              cc1 [ user ] /lib64/libc-2.8.90.so: _IO_vfprintf
        0.63              cc1 [kernel] lock_release
        0.67              cc1 [ user ] /lib64/libc-2.8.90.so: strlen
        0.68              cc1 [kernel] debug_smp_processor_id
        1.38              cc1 [ user ] /lib64/libc-2.8.90.so: _int_malloc
        1.55              cc1 [ user ] /lib64/libc-2.8.90.so: memset
        1.77              cc1 [kernel] __lock_acquire
        1.88              cc1 [kernel] clear_page_c
        3.61               as [ user ] /usr/bin/as: <unknown>
       59.16              cc1 [ user ] /usr/libexec/gcc/x86_64-redhat-linux/4.3.2/cc1: <unknown>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
      LKML-Reference: <20090408130409.220518450@chello.nl>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      de9ac07b
  2. 06 4月, 2009 3 次提交
    • P
      perf_counter tools: remove glib dependency and fix bugs in kerneltop.c · cbe46555
      Paul Mackerras 提交于
      The glib dependency in kerneltop.c is only for a little bit of list
      manipulation, and I find it inconvenient.  This adds a 'next' field to
      struct source_line, which lets us link them together into a list.  The
      code to do the linking ourselves turns out to be no longer or more
      difficult than using glib.
      
      This also fixes a few other problems:
      
      - We need to #include <limits.h> to get PATH_MAX on powerpc.
      
      - We need to #include <linux/types.h> rather than have our own
        definitions of __u64 and __s64; on powerpc the installed headers
        define them to be unsigned long and long respectively, and if we
        have our own, different definition here that causes a compile error.
      
      - This takes out the x86 setting of errno from -ret in
        sys_perf_counter_open.  My experiments on x86 indicate that the
        glibc syscall() does this for us already.
      
      - We had two CPU migration counters in the default set, which seems
        unnecessary; I changed one of them to a context switch counter.
      
      - In perfstat mode we were printing CPU cycles and instructions as
        milliseconds, and the cpu clock and task clock counters as events.
        This fixes that.
      
      - In perfstat mode we were still printing a blank line after the first
        counter, which was a holdover from when a task clock counter was
        automatically included as the first counter.  This removes the blank
        line.
      
      - On a test machine here, parse_symbols() and parse_vmlinux() were
        taking long enough (almost 0.5 seconds) for the mmap buffer to
        overflow before we got to the first mmap_read() call, so this moves
        them before we open all the counters.
      
      - The error message if sys_perf_counter_open fails needs to use errno,
        not -fd[i][counter].
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Acked-by: NMike Galbraith <efault@gmx.de>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Orig-LKML-Reference: <18888.29986.340328.540512@cargo.ozlabs.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      cbe46555
    • I
      perf_counter tools: tidy up in-kernel dependencies · 383c5f8c
      Ingo Molnar 提交于
      Remove now unified perfstat.c and perf_counter.h, and link to the
      in-kernel perf_counter.h.
      
      Cc: Wu Fengguang <fengguang.wu@intel.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Orig-LKML-Reference: <20090323172417.677932499@chello.nl>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      383c5f8c
    • I
      perf_counter: add sample user-space to Documentation/perf_counter/ · e0143bad
      Ingo Molnar 提交于
      Initial version of kerneltop.c and perfstat.c.
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      e0143bad