24 Dec, 2011

1 commit

  • Now that we automatically point users at it, let's provide them some
    guidance so that they hopefully don't just get mysterious EINVAL's
    from the kernel.

    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1324301972-22740-4-git-send-email-nelhage@nelhage.com
    Signed-off-by: Nelson Elhage
    [ committer note: Made it work after 50a682c ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Nelson Elhage
     

16 Feb, 2011

1 commit

  • This patch adds the ability to filter monitoring based on container groups
    (cgroups) for both perf stat and perf record. It is possible to monitor
    multiple cgroup in parallel. There is one cgroup per event. The cgroups to
    monitor are passed via a new -G option followed by a comma separated list of
    cgroup names.

    The cgroup filesystem has to be mounted. Given a cgroup name, the perf tool
    finds the corresponding directory in the cgroup filesystem and opens it. It
    then passes that file descriptor to the kernel.

    Example:

    $ perf stat -B -a -e cycles:u,cycles:u,cycles:u -G test1,,test2 -- sleep 1
    Performance counter stats for 'sleep 1':

    2,368,667,414 cycles test1
    2,369,661,459 cycles
    cycles test2

    1.001856890 seconds time elapsed

    Signed-off-by: Stephane Eranian
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Stephane Eranian
     

13 Jan, 2011

1 commit

  • Sometimes there is a need to use perf in "live-log" mode. The problem
    is, for seldom events, actual info output is largely delayed because
    perf-record reads sample data in whole pages.

    So for such scenarious, add flag for perf-record to go in "nodelay"
    mode. To track e.g. what's going on in icmp_rcv while ping is running
    Use it with something like this:

    (1) $ perf probe -L icmp_rcv | grep -U8 '^ *43\>'
    goto error;
    }
    38 if (!pskb_pull(skb, sizeof(*icmph)))
    goto error;
    icmph = icmp_hdr(skb);

    43 ICMPMSGIN_INC_STATS_BH(net, icmph->type);
    /*
    * 18 is the highest 'known' ICMP type. Anything else is a mystery
    *
    * RFC 1122: 3.2.2 Unknown ICMP messages types MUST be silently
    * discarded.
    */
    50 if (icmph->type > NR_ICMP_TYPES)
    goto error;

    $ perf probe icmp_rcv:43 'type=icmph->type'

    (2) $ cat trace-icmp.py
    [...]
    def trace_begin():
    print "in trace_begin"

    def trace_end():
    print "in trace_end"

    def probe__icmp_rcv(event_name, context, common_cpu,
    common_secs, common_nsecs, common_pid, common_comm,
    __probe_ip, type):
    print_header(event_name, common_cpu, common_secs, common_nsecs,
    common_pid, common_comm)

    print "__probe_ip=%u, type=%u\n" % \
    (__probe_ip, type),
    [...]

    (3) $ perf record -a -D -e probe:icmp_rcv -o - | \
    perf script -i - -s trace-icmp.py

    Thanks to Peter Zijlstra for pointing how to do it.

    Cc: Arnaldo Carvalho de Melo
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar , Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Kirill Smelkov
    Signed-off-by: Arnaldo Carvalho de Melo

    Kirill Smelkov
     

05 Dec, 2010

1 commit

  • So that we can use -T == --timestamp, asking for PERF_SAMPLE_TIME:

    $ perf record -aT
    $ perf report -D | grep PERF_RECORD_

    3 5951915425 0x47530 [0x58]: PERF_RECORD_SAMPLE(IP, 1): 16811/16811: 0xffffffff8138c1a2 period: 215979 cpu:3
    3 5952026879 0x47588 [0x90]: PERF_RECORD_SAMPLE(IP, 1): 16811/16811: 0xffffffff810cb480 period: 215979 cpu:3
    3 5952059959 0x47618 [0x38]: PERF_RECORD_FORK(6853:6853):(16811:16811)
    3 5952138878 0x47650 [0x78]: PERF_RECORD_SAMPLE(IP, 1): 16811/16811: 0xffffffff811bac35 period: 431478 cpu:3
    3 5952375068 0x476c8 [0x30]: PERF_RECORD_COMM: find:6853
    3 5952395923 0x476f8 [0x50]: PERF_RECORD_MMAP 6853/6853: [0x400000(0x25000) @ 0]: /usr/bin/find
    3 5952413756 0x47748 [0xa0]: PERF_RECORD_SAMPLE(IP, 1): 6853/6853: 0xffffffff810d080f period: 859332 cpu:3
    3 5952419837 0x477e8 [0x58]: PERF_RECORD_MMAP 6853/6853: [0x3f44600000(0x21d000) @ 0]: /lib64/ld-2.5.so
    3 5952437929 0x47840 [0x48]: PERF_RECORD_MMAP 6853/6853: [0x7fff7e1c9000(0x1000) @ 0x7fff7e1c9000]: [vdso]
    3 5952570127 0x47888 [0x58]: PERF_RECORD_MMAP 6853/6853: [0x3f46200000(0x218000) @ 0]: /lib64/libselinux.so.1
    3 5952623637 0x478e0 [0x58]: PERF_RECORD_MMAP 6853/6853: [0x3f44a00000(0x356000) @ 0]: /lib64/libc-2.5.so
    3 5952675720 0x47938 [0x58]: PERF_RECORD_MMAP 6853/6853: [0x3f44e00000(0x204000) @ 0]: /lib64/libdl-2.5.so
    3 5952710080 0x47990 [0x58]: PERF_RECORD_MMAP 6853/6853: [0x3f45a00000(0x246000) @ 0]: /lib64/libsepol.so.1
    3 5952847802 0x479e8 [0x58]: PERF_RECORD_SAMPLE(IP, 1): 6853/6853: 0xffffffff813897f0 period: 1142536 cpu:3

    First column is the cpu and the second the timestamp.

    That way we can investigate problems in the event stream.

    If the new perf binary is run on an older kernel, it will disable this feature
    automatically.

    Tested-by: Thomas Gleixner
    Reviewed-by: Thomas Gleixner
    Acked-by: Ian Munsie
    Acked-by: Thomas Gleixner
    Cc: Frédéric Weisbecker
    Cc: Ian Munsie
    Cc: Mike Galbraith
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Stephane Eranian
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

02 Dec, 2010

1 commit


27 Oct, 2010

1 commit


17 Jun, 2010

1 commit

  • There are situations where there is enough information in the perf.data
    to process the samples. Updating the buildid cache may add unecessary
    overhead in terms of disk space and time (copying large elf images).

    A persistent option to do this already exists via the perfconfig file,
    simply do:

    [buildid]
    dir = /dev/null

    This patch provides a way to suppress builid cache updates on a per-run
    basis. It addds a new option, -N, to perf record. Buildids are still
    generated in the perf.data file.

    Cc: David S. Miller
    Cc: Frédéric Weisbecker
    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Stephane Eranian
    Signed-off-by: Arnaldo Carvalho de Melo

    Stephane Eranian
     

05 Jun, 2010

1 commit

  • This patch adds a -C option to stat, record, top to designate a list of CPUs to
    monitor. CPUs can be specified as a comma-separated list or ranges, no space
    allowed.

    Examples:
    $ perf record -a -C0-1,4-7 sleep 1
    $ perf top -C0-4
    $ perf stat -a -C1,2,3,4 sleep 1

    With perf record in per-thread mode with inherit mode on, samples are collected
    only when the thread runs on the designated CPUs.

    The -C option does not turn on system-wide mode automatically.

    Cc: David S. Miller
    Cc: Frédéric Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Stephane Eranian
    Signed-off-by: Arnaldo Carvalho de Melo

    Stephane Eranian
     

14 May, 2010

1 commit

  • By default, event inheritance across fork and pthread_create was on but the -i
    option of stat and record, which enabled inheritance, led to believe it was off
    by default.

    This patch fixes this logic by inverting the meaning of the -i option. By
    default inheritance is on whether you attach to a process (-p), a thread (-t)
    or start a process. If you pass -i, then you turn off inheritance. Turning off
    inheritance if you don't need it, helps limit perf resource usage as well.

    The patch also fixes perf stat -t xxxx and perf record -t xxxx which did not
    start the counters.

    Acked-by: Frederic Weisbecker
    Cc: David S. Miller
    Cc: Frédéric Weisbecker
    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Stephane Eranian
    Signed-off-by: Arnaldo Carvalho de Melo

    Stephane Eranian
     

15 Apr, 2010

2 commits

  • Trace events are mostly used for tracing rather than simple
    counting. Don't bother anymore with adding -R when using them,
    just record raw samples of trace events every time.

    Signed-off-by: Frederic Weisbecker
    Cc: Arnaldo Carvalho de Melo
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Ingo Molnar
    Cc: Thomas Gleixner

    Frederic Weisbecker
     
  • Force the overwriting mode by default if append mode is not explicit.
    Adding -f every time one uses perf on a daily basis quickly becomes a
    burden.

    Keep the -f among the options though to avoid breaking some random
    users scripts.

    Signed-off-by: Frederic Weisbecker
    Cc: Arnaldo Carvalho de Melo
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Ingo Molnar
    Cc: Thomas Gleixner

    Frederic Weisbecker
     

24 Nov, 2009

1 commit

  • Add the breakpoint events support with this new sysnopsis:

    mem:addr[:access]

    Where addr is a raw addr value in the kernel and access can be
    either [r][w][x]

    Example to profile tasklist_lock:

    $ grep tasklist_lock /proc/kallsyms
    ffffffff8189c000 D tasklist_lock

    $ perf record -e mem:0xffffffff8189c000:rw -a -f -c 1
    $ perf report

    # Samples: 62
    #
    # Overhead Command Shared Object Symbol
    # ........ ............... ............. ......
    #
    29.03% swapper [kernel] [k] _raw_read_trylock
    29.03% swapper [kernel] [k] _raw_read_unlock
    19.35% init [kernel] [k] _raw_read_trylock
    19.35% init [kernel] [k] _raw_read_unlock
    1.61% events/0 [kernel] [k] _raw_read_trylock
    1.61% events/0 [kernel] [k] _raw_read_unlock

    Coming soon:

    - Support for symbols in the event definition.

    - Default period to 1 for breakpoint events because these are
    not high frequency events. The same thing is needed for trace
    events.

    Signed-off-by: Frederic Weisbecker
    Cc: Peter Zijlstra
    Cc: Arnaldo Carvalho de Melo
    Cc: Paul Mackerras
    Cc: Prasad
    LKML-Reference:
    Signed-off-by: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Arnaldo Carvalho de Melo
    Cc: Paul Mackerras
    Cc: Prasad

    Frederic Weisbecker
     

31 Aug, 2009

1 commit


05 Aug, 2009

1 commit


07 Jun, 2009

1 commit