17 Dec, 2014

1 commit

  • So that normal users can run 'trace', we were using a hardcoded 1024
    pages value that was more than the default /proc/sys/kernel/perf_event_mlock_kb
    setting.

    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-3banj3yh0sjz41obxtgiel3a@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

12 Dec, 2014

1 commit

  • If we ask for a mmap lenght than the max configured via the relevant
    sysctl, provide a better warning, instead of just expanding the EPERM
    returned:

    [acme@ssdandy ~]$ trace -m 256 -e nanosleep sleep 2
    Error: Operation not permitted.
    Hint: Check /proc/sys/kernel/perf_event_mlock_kb (516 kB) setting.
    Hint: Tried using 1028 kB.
    Hint: Try using a bigger -m/--mmap-pages value.

    [acme@ssdandy ~]$ trace -m 128 -e nanosleep sleep 2
    2001.280 (2000.403 ms): nanosleep(rqtp: 0x7fff89a8a7f0) = 0
    [acme@ssdandy ~]$

    An upcoming patch will autotune the request for non-root users when -m
    is not used.

    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-cdvxfz2gycetbkopm9sna1qp@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

29 Oct, 2014

1 commit

  • So stop passing both machine and thread to several thread methods,
    reducing function signature length.

    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jean Pihet
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-ckcy19dcp1jfkmdihdjcqdn1@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

16 Oct, 2014

1 commit

  • This is mechanical changes only for accounting access to thread->priv
    properly in the source level.

    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1412556363-26229-6-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

30 Sep, 2014

1 commit

  • Using 'perf trace' for mmap is truncating return values by stripping the
    top 32 bits, actually printing only the lower 32 bits.

    This was because the ret value was of an 'int' type and not a 'long'
    type.

    The Problem:

    991258501.244 ( 0.004 ms): mmap(len: 40001536, prot: READ|WRITE, flags: PRIVATE|ANONYMOUS, fd: -1) = 0x56691000
    991258501.257 ( 0.000 ms): minfault [_int_malloc+0x1038] => //anon@0x7fa056691008 //(d.)

    The first line shows an mmap, which succeeds and returns 0x56691000.

    However the next line shows a memory access to that virtual memory area,
    specifically to 0x7fa056691008. The upper 32 bit is lost due to the
    problem mentioned above, and thus mmap's return value didn't have the
    upper 0x7fa0.

    Tested on 3.17-rc5 from the linus's tree, and the HEAD of tip/master

    Signed-off-by: Chang Hyun Park
    Cc: H. Peter Anvin
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/1411736041-8017-1-git-send-email-heartinpiece@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Chang Hyun Park
     

26 Sep, 2014

3 commits

  • Because perf_session__new() can fail for more reasons than just ENOMEM,
    modify error code(ENOMEM or EINVAL) to -1.

    Signed-off-by: Taeung Song
    Acked-by: Jiri Olsa
    Acked-by: Namhyung Kim
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Link: http://lkml.kernel.org/r/1411522417-9917-1-git-send-email-treeze.taeung@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Taeung Song
     
  • So that we don't continue polling on vanished file descriptors, i.e.
    file descriptors for events monitoring threads that exited.

    I.e. the following 'trace' command now exits as expected, instead
    of staying in an eternal loop:

    $ sleep 5s &
    $ trace -p `pidof sleep`

    Reported-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-6qegv786zbf6i8us6t4rxug9@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Since we have access two evlist members in all these poll calls, provide
    a helper.

    This will also help to make the patch introducing the pollfd class more
    clear, as the evlist specific uses will be hiden away
    perf_evlist__poll().

    Acked-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: Corey Ashford
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Jean Pihet
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/n/tip-jr9d4aop4lvy9453qahbcgp0@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

16 Aug, 2014

1 commit

  • Use strerror_r instead of strerror in error message for thead-safety.

    Signed-off-by: Masami Hiramatsu
    Cc: Ingo Molnar
    Cc: Namhyung Kim
    Cc: Naohiro Aota
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20140814022241.3545.97543.stgit@kbuild-fedora.novalocal
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

14 Aug, 2014

3 commits

  • Currently vmlinux_path__init() only tries to find vmlinux file from
    current directory, /boot and some canonical directories with version
    number of the running kernel. This can be a problem when reporting old
    data recorded on a kernel version not running currently.

    We can use --symfs option for this but it's annoying for user to do it
    always. As we already have the info in the perf.data file, it can be
    changed to use it for the search automatically.

    Before:

    $ perf report
    ...
    # Samples: 4K of event 'cpu-clock'
    # Event count (approx.): 1067250000
    #
    # Overhead Command Shared Object Symbol
    # ........ .......... ................. ..............................
    71.87% swapper [kernel.kallsyms] [k] recover_probed_instruction

    After:

    # Overhead Command Shared Object Symbol
    # ........ .......... ................. ....................
    71.87% swapper [kernel.kallsyms] [k] native_safe_halt

    This requires to change signature of symbol__init() to receive struct
    perf_session_env *.

    Reported-by: Minchan Kim
    Signed-off-by: Namhyung Kim
    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Masami Hiramatsu
    Cc: Minchan Kim
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1407825645-24586-14-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • This is a preparation of fixing dso__load_kernel_sym(). It needs a
    session info before calling symbol__init().

    Signed-off-by: Namhyung Kim
    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Minchan Kim
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1407825645-24586-13-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • ~/devel/kernel/tools/perf(branch:master*) » sudo ./perf trace ~/mremap_test
    0.543 ( 0.003 ms): mprotect(start: 0x600000, len: 4096, prot: READ ) = 0
    0.550 ( 0.003 ms): mprotect(start: 0x7f441260d000, len: 4096, prot: READ) = 0
    0.561 ( 0.010 ms): munmap(addr: 0x7f44125e2000, len: 165572 ) = 0
    0.595 ( 0.012 ms): mmap(len: 12288, prot: READ|WRITE, flags: SHARED|ANONYMOUS|LOCKED, fd: -1) = 0x12608000
    0.603 ( 0.006 ms): mremap(addr: 0x7f4412608000, old_len: 4096, new_len: 4096, flags: MAYMOVE|FIXED, new_addr: 0x7f16da295000) = 0xda295000
    0.608 ( 0.003 ms): mremap(addr: 0x7f441260a000, old_len: 4096, new_len: 4096, flags: MAYMOVE|FIXED, new_addr: 0x7f16da297000) = 0xda297000
    0.612 ( 0.003 ms): mremap(addr: 0x7f4412609000, old_len: 4096, new_len: 4096, flags: MAYMOVE|FIXED, new_addr: 0x7f16da296000) = 0xda296000
    0.619 ( 0.000 ms): exit_group(

    Signed-off-by: Alex Snast
    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1407944560-26924-1-git-send-email-asnast@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Alex Snast
     

12 Aug, 2014

1 commit

  • The time ordering is generic for all kinds of events, so using generic
    name 'ordered_events' for ordered_samples bool in perf_tool struct.

    No functional change was intended.

    Signed-off-by: Jiri Olsa
    Acked-by: David Ahern
    Cc: Corey Ashford
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Jean Pihet
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/n/tip-07mrqzcuhsks9wfmxrzsvemz@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

24 Jul, 2014

1 commit

  • [acme@sandy linux]$ gcc --version
    gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
    Copyright (C) 2010 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    [acme@sandy linux]$ make O=/tmp/build/perf -C tools/perf install-bin

    CC /tmp/build/perf/builtin-trace.o
    builtin-trace.c: In function ‘perf_evlist__add_pgfault’:
    builtin-trace.c:1997: error: unknown field ‘sample_period’ specified in initializer
    make[1]: *** [/tmp/build/perf/builtin-trace.o] Error 1
    make: *** [install-bin] Error 2
    make: Leaving directory `/home/acme/git/linux/tools/perf'
    [acme@sandy linux]$ make O=/tmp/build/perf -C tools/perf install-bin
    make O=/tmp/build/perf -C tools/perf install-bin
    make: Entering directory `/home/acme/git/linux/tools/perf'

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-qt7h2g5fcf42qiw5hv7mgpjk@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

09 Jul, 2014

2 commits

  • CC /tmp/build/perf/builtin-trace.o
    builtin-trace.c: In function 'print_location':
    builtin-trace.c:1792:4: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'u64' [-Werror=format]
    builtin-trace.c:1794:3: error: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'u64' [-Werror=format]
    builtin-trace.c:1796:3: error: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'u64' [-Werror=format]
    cc1: all warnings being treated as errors
    make[1]: *** [/tmp/build/perf/builtin-trace.o] Error 1
    make[1]: *** Waiting for unfinished jobs....
    make: *** [install-bin] Error 2
    make: Leaving directory `/home/acme/git/linux/tools/perf'

    acme@linux-goap:~/git/linux> uname -a
    Linux linux-goap 3.7.10-1.16-desktop #1 SMP PREEMPT Fri May 31 20:21:23 UTC 2013 (97c14ba) i686 i686 i386 GNU/Linux

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stanislav Fomichev
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-843p3aqbw531eqiu2hah8o9p@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • 'perf trace' can show summary of events using -S option. This commit
    also reports number of major/minor pagefault events in this summary.

    $ perf trace -s --pf all -- sleep 1

    Summary of events:

    sleep (18604), 275 events, 99.6%, 197 minfaults, 0.000 msec

    syscall calls min avg max stddev
    (msec) (msec) (msec) (%)
    --------------- -------- --------- --------- --------- ------
    read 2 0.000 0.001 0.002 100.00%
    open 3 0.004 0.005 0.007 21.13%
    close 3 0.001 0.001 0.001 1.37%
    fstat 3 0.001 0.002 0.002 10.66%
    mmap 8 0.002 0.004 0.006 10.69%
    mprotect 4 0.003 0.005 0.008 24.68%
    munmap 1 0.005 0.005 0.005 0.00%
    brk 3 0.001 0.002 0.003 28.08%
    access 3 0.002 0.003 0.005 24.48%
    nanosleep 1 1000.747 1000.747 1000.747 0.00%
    execve 8 0.000 0.033 0.246 91.00%
    arch_prctl 1 0.001 0.001 0.001 0.00%

    Signed-off-by: Stanislav Fomichev
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1404842716-19190-1-git-send-email-stfomichev@yandex-team.ru
    Signed-off-by: Arnaldo Carvalho de Melo

    Stanislav Fomichev
     

27 Jun, 2014

4 commits

  • Currently, we may either trace syscalls or syscalls+pagefaults.

    We'd like to be able to trace *only* pagefaults and this commit
    implements this feature.

    Example:

    [root@zoo /]# echo 1 > /proc/sys/vm/drop_caches ; trace --no-syscalls -F -p `pidof xchat`
    0.000 ( 0.000 ms): xchat/4574 majfault [g_unichar_get_script+0x11] => /usr/lib64/libglib-2.0.so.0.3800.2@0xc403b (x.)
    0.202 ( 0.000 ms): xchat/4574 majfault [_cairo_hash_table_lookup+0x53] => 0x2280ff0 (?.)
    20.854 ( 0.000 ms): xchat/4574 majfault [gdk_cairo_set_source_pixbuf+0x110] => /usr/bin/xchat@0x6da1f (x.)
    1022.000 ( 0.000 ms): xchat/4574 majfault [__memcpy_sse2_unaligned+0x29] => 0x7ff5a8ca0400 (?.)
    ^C[root@zoo /]#

    Below we can see malloc calls, 'trace' reading symbol tables in libraries to
    resolve symbols, etc.

    [root@zoo /]# echo 1 > /proc/sys/vm/drop_caches ; trace --no-syscalls -F all --cpu 1 sleep 10
    0.000 ( 0.000 ms): chrome/26589 minfault [0x1b53129] => /tmp/perf-26589.map@0x33cbcbf7f000 (x.)
    96.477 ( 0.000 ms): libvirtd/947 minfault [copy_user_enhanced_fast_string+0x5] => 0x7f7685bba000 (?k)
    113.164 ( 0.000 ms): Xorg/1063 minfault [0x786da] => 0x7fce52882a3c (?.)
    7162.801 ( 0.000 ms): chrome/3747 minfault [0x8e1a89] => 0xfcaefed0008 (?.)

    7773.138 ( 0.000 ms): chrome/3886 minfault [0x8e1a89] => 0xfcb0ce28008 (?.)
    7992.022 ( 0.000 ms): chrome/26574 minfault [0x1b5a708] => 0x3de7b5fc5000 (?.)
    8108.949 ( 0.000 ms): qemu-system-x8/4537 majfault [_int_malloc+0xee] => 0x7faffc466d60 (?.)
    8108.975 ( 0.000 ms): qemu-system-x8/4537 minfault [_int_malloc+0x102] => 0x7faffc466d60 (?.)

    8148.174 ( 0.000 ms): qemu-system-x8/4537 minfault [_int_malloc+0x102] => 0x7faffc4eb500 (?.)
    8270.855 ( 0.000 ms): chrome/26245 minfault [do_bo_emit_reloc+0xdb] => 0x45d092bc004 (?.)
    8270.869 ( 0.000 ms): chrome/26245 minfault [do_bo_emit_reloc+0x108] => 0x45d09150000 (?.)
    no symbols found in /usr/lib64/libspice-server.so.1.9.0, maybe install a debug package?
    8273.831 ( 0.000 ms): trace/20198 majfault [__memcmp_sse4_1+0xbc6] => /usr/lib64/libspice-server.so.1.9.0@0xdf000 (d.)

    8275.121 ( 0.000 ms): trace/20198 minfault [dso__load+0x38] => 0x14fe756 (?.)
    no symbols found in /usr/lib64/libelf-0.158.so, maybe install a debug package?
    8275.142 ( 0.000 ms): trace/20198 minfault [__memcmp_sse4_1+0xbc6] => /usr/lib64/libelf-0.158.so@0x0 (d.)

    [root@zoo /]#

    Signed-off-by: Stanislav Fomichev
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1403799268-1367-6-git-send-email-stfomichev@yandex-team.ru
    Signed-off-by: Arnaldo Carvalho de Melo

    Stanislav Fomichev
     
  • Previous commit added live pagefault trace support, this one adds record
    and replay support.

    Example:

    [root@zoo /]# echo 1 > /proc/sys/vm/drop_caches ; trace -F all record -a sleep 10
    [ perf record: Woken up 0 times to write data ]
    [ perf record: Captured and wrote 1029.722 MB perf.data (~44989242 samples) ]

    [root@zoo /]# ls -la perf.data
    -rw-------. 1 root root 1083921722 Jun 26 17:44 perf.data

    [root@zoo /]# perf evlist
    raw_syscalls:sys_enter
    raw_syscalls:sys_exit
    major-faults
    minor-faults

    [root@zoo /]# trace -i perf.data | grep -v trace\/ | tail -15
    156.137 ( 0.000 ms): perl/18476 minfault [0xb4243] => 0x0 (?.)
    156.139 ( 0.000 ms): perl/18476 minfault [Perl_sv_clear+0x123] => 0x0 (?.)
    156.140 ( 0.000 ms): perl/18476 minfault [Perl_sv_clear+0xc4] => 0x0 (?.)
    156.144 ( 0.000 ms): perl/18476 minfault [_int_free+0xda] => 0x0 (?.)
    156.151 ( 0.000 ms): perl/18476 minfault [_int_free+0x1df] => 0x0 (?.)
    156.158 ( 0.000 ms): perl/18476 minfault [0xb4243] => 0x0 (?.)
    156.161 ( 0.000 ms): perl/18476 minfault [0xb4243] => 0x0 (?.)
    156.168 ( 0.000 ms): perl/18476 minfault [0xb4243] => 0x0 (?.)
    156.172 ( 0.000 ms): perl/18476 minfault [0xb4243] => 0x0 (?.)
    156.173 ( 0.000 ms): perl/18476 minfault [_int_free+0xda] => 0x0 (?.)
    156.183 ( 0.000 ms): perl/18476 minfault [Perl_hfree_next_entry+0xb4] => 0x0 (?.)
    156.197 ( 0.000 ms): perl/18476 minfault [_int_free+0x1df] => 0x0 (?.)
    156.216 ( 0.000 ms): perl/18476 minfault [Perl_sv_clear+0x123] => 0x0 (?.)
    156.221 ( 0.000 ms): perl/18476 minfault [Perl_sv_clear+0x123] => 0x0 (?.)
    [root@zoo /]#

    Signed-off-by: Stanislav Fomichev
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1403799268-1367-4-git-send-email-stfomichev@yandex-team.ru
    Signed-off-by: Arnaldo Carvalho de Melo

    Stanislav Fomichev
     
  • This patch adds optional pagefault tracing support to 'perf trace'.

    Using -F/--pf option user can specify whether he wants minor, major or
    all pagefault events to be traced. This patch adds only live mode,
    record and replace will come in a separate patch.

    Example output:

    1756272.905 ( 0.000 ms): curl/5937 majfault [0x7fa7261978b6] => /usr/lib/x86_64-linux-gnu/libkrb5.so.26.0.0@0x85288 (d.)
    1862866.036 ( 0.000 ms): wget/8460 majfault [__clear_user+0x3f] => 0x659cb4 (?k)

    Signed-off-by: Stanislav Fomichev
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1403799268-1367-3-git-send-email-stfomichev@yandex-team.ru
    Signed-off-by: Arnaldo Carvalho de Melo

    Stanislav Fomichev
     
  • It will be used by next pagefault tracing patches in the series.

    Signed-off-by: Stanislav Fomichev
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1403799268-1367-2-git-send-email-stfomichev@yandex-team.ru
    Signed-off-by: Arnaldo Carvalho de Melo

    Stanislav Fomichev
     

20 Jun, 2014

3 commits

  • No need to use two strcmp calls per syscall entry, do it just once, when
    reading the per syscall info.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-lymtxhz0mg3adyt5e2pssn8f@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • The thread->priv value is already obtained a few lines earlier from the
    thread__trace() call. Leftovers from before thread__trace().

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-96laa634vzfwlwxurevo40wp@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • There was a brown paper bag bug in the patch that introduced a reference
    implementation on using 'perf probe' made wannabe tracepoints that broke fd ->
    pathname resolution, fix it:

    [root@zoo ~]# perf probe 'vfs_getname=getname_flags:65 pathname=result->name:string'
    Added new event:
    probe:vfs_getname (on getname_flags:65 with pathname=result->name:string)

    You can now use it in all perf tools, such as:

    perf record -e probe:vfs_getname -aR sleep 1

    [root@zoo ~]

    Before:

    [acme@zoo linux]$ trace touch -e open,fstat /tmp/b
    1.159 ( 0.007 ms): open(filename: 0x7fd73f2fe088, flags: CLOEXEC ) = 3
    1.163 ( 0.002 ms): fstat(fd: 3, statbuf: 0x7fff1b25e610 ) = 0
    1.192 ( 0.009 ms): open(filename: 0x7fd73f4fedb8, flags: CLOEXEC ) = 3
    1.201 ( 0.002 ms): fstat(fd: 3, statbuf: 0x7fff1b25e660 ) = 0
    1.501 ( 0.013 ms): open(filename: 0x7fd73f0a1610, flags: CLOEXEC ) = 3
    1.505 ( 0.002 ms): fstat(fd: 3, statbuf: 0x7fd73f2ddb60 ) = 0
    1.581 ( 0.011 ms): open(filename: 0x7fff1b2603da, flags: CREAT|NOCTTY|NONBLOCK|WRONLY, mode: 438) = 3
    [acme@zoo linux]$

    After:

    [acme@zoo linux]$ trace touch -e open,fstat,dup2,mmap,close /tmp/b
    1.105 ( 0.004 ms): mmap(len: 4096, prot: READ|WRITE, flags: PRIVATE|ANONYMOUS, fd: -1 ) = 0x2fbf000
    1.136 ( 0.008 ms): open(filename: 0x7f8902dbc088, flags: CLOEXEC ) = 3
    1.140 ( 0.002 ms): fstat(fd: 3, statbuf: 0x7fff19889ef0 ) = 0
    1.146 ( 0.004 ms): mmap(len: 86079, prot: READ, flags: PRIVATE, fd: 3 ) = 0x2fa9000
    1.149 ( 0.001 ms): close(fd: 3 ) = 0
    1.170 ( 0.010 ms): open(filename: 0x7f8902fbcdb8, flags: CLOEXEC ) = 3
    1.178 ( 0.002 ms): fstat(fd: 3, statbuf: 0x7fff19889f40 ) = 0
    1.188 ( 0.006 ms): mmap(len: 3924576, prot: EXEC|READ, flags: PRIVATE|DENYWRITE, fd: 3) = 0x29e2000
    1.207 ( 0.007 ms): mmap(addr: 0x7f8902d96000, len: 24576, prot: READ|WRITE, flags: PRIVATE|DENYWRITE|FIXED, fd: 3, off: 1785856) = 0x2d96000
    1.217 ( 0.004 ms): mmap(addr: 0x7f8902d9c000, len: 16992, prot: READ|WRITE, flags: PRIVATE|ANONYMOUS|FIXED, fd: -1) = 0x2d9c000
    1.228 ( 0.002 ms): close(fd: 3 ) = 0
    1.243 ( 0.003 ms): mmap(len: 4096, prot: READ|WRITE, flags: PRIVATE|ANONYMOUS, fd: -1 ) = 0x2fa8000
    1.250 ( 0.003 ms): mmap(len: 8192, prot: READ|WRITE, flags: PRIVATE|ANONYMOUS, fd: -1 ) = 0x2fa6000
    1.452 ( 0.010 ms): open(filename: 0x7f8902b5f610, flags: CLOEXEC ) = 3
    1.455 ( 0.002 ms): fstat(fd: 3, statbuf: 0x7f8902d9bb60 ) = 0
    1.461 ( 0.004 ms): mmap(len: 106070960, prot: READ, flags: PRIVATE, fd: 3) = 0xfc4b9000
    1.469 ( 0.002 ms): close(fd: 3 ) = 0
    1.528 ( 0.010 ms): open(filename: 0x7fff1988c3da, flags: CREAT|NOCTTY|NONBLOCK|WRONLY, mode: 438) = 3
    1.532 ( 0.002 ms): dup2(oldfd: 3 ) = 0
    1.535 ( 0.001 ms): close(fd: 3 ) = 0
    1.544 ( 0.001 ms): close( ) = 0
    1.555 ( 0.001 ms): close(fd: 1 ) = 0
    1.558 ( 0.001 ms): close(fd: 2 ) = 0
    [acme@zoo linux]$

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-vcm22xpjxc3j4hbyuzjzf7ik@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

10 Mar, 2014

1 commit

  • SIGSTKFLT is not defined on alpha, mips or sparc.

    SIGEMT and SIGSWI are defined on some architectures and should be
    decoded here if so.

    Signed-off-by: Ben Hutchings
    Fixes: 8bad5b0abfdb ('perf trace: Beautify signal number arg in several syscalls')
    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/1391648441.3003.101.camel@deadeye.wl.decadent.org.uk
    Signed-off-by: Arnaldo Carvalho de Melo

    Ben Hutchings
     

14 Feb, 2014

1 commit

  • Supporting decoding the ioctl 'request' parameter needs more work to
    properly support more architectures, the current approach doesn't work
    on at least powerpc and sparc, as reported by Ben Hutchings in
    http://lkml.kernel.org/r/1391593985.3003.48.camel@deadeye.wl.decadent.org.uk .

    Work around that by making it to be ifdefed for the architectures known
    to work with the current, limited approach, i386 and x86_64 till better
    code is written.

    Reported-by: Ben Hutchings
    Acked-by: Ben Hutchings
    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: # 3.13 Fixes: 78645cf3ed32 ("perf trace: Initial beautifier for ioctl's 'cmd' arg")
    Link: http://lkml.kernel.org/n/tip-ss04k11insqlu329xh5g02q0@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

10 Feb, 2014

1 commit

  • glibc 2.17 is missing this on sparc, despite the fact that it's not
    architecture-specific.

    Signed-off-by: Ben Hutchings
    Fixes: 49af9e93adfa ('perf trace: Beautify eventfd2 'flags' arg')
    Cc:
    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/1391648435.3003.100.camel@deadeye.wl.decadent.org.uk
    Signed-off-by: Arnaldo Carvalho de Melo

    Ben Hutchings
     

15 Jan, 2014

1 commit

  • That is how the option summary describes it and so that we can free
    --delay to replace --initial-delay and then be consistent with stat's
    --delay equivalent option.

    Suggested-by: Ingo Molnar
    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-f8hd2010uhjl2zzb34hepbmi@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

13 Jan, 2014

5 commits

  • Initial struct stats:

    /* size: 368, cachelines: 6, members: 24 */
    /* sum members: 353, holes: 3, sum holes: 15 */
    /* last cacheline: 48 bytes */

    After reorg:

    [acme@ssdandy linux]$ pahole -C trace ~/bin/trace | tail -4
    /* size: 360, cachelines: 6, members: 24 */
    /* padding: 7 */
    /* last cacheline: 40 bytes */
    };
    [acme@ssdandy linux]$

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-6jimc80yu89qkx6zb8465s6t@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Removing further boilerplate after making sure perf_evlist__munmap can
    be called multiple times for the same evlist.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-o0luenuld4abupm4nmrgzm6f@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Since it is safe to call perf_evlist__close() multiple times, autoclose
    it and remove the calls to the close from existing tools, reducing the
    tooling boilerplate.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-2kq9v7p1rude1tqxa0aue2tk@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Instead of requiring tools to do an extra destructor call just before
    calling perf_evlist__delete.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-0jd2ptzyikxb5wp7inzz2ah2@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • So that we have the boilerplate in the preparation method, instead of
    open coded in tools wanting the reporting when the exec fails.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-purbdzcphdveskh7wwmnm4t7@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

28 Dec, 2013

1 commit

  • For the frequent idiom of:

    free(ptr);
    ptr = NULL;

    Make it expect a pointer to the pointer being freed, so that it becomes
    clear at first sight that the variable being freed is being modified.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-pfw02ezuab37kha18wlut7ir@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

20 Dec, 2013

1 commit

  • Reduce typing, functions use class__method convention, so unlikely to
    clash with other libraries.

    This actually was discussed in the "Link:" referenced message below.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/20131112113427.GA4053@ghostprotocols.net
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

05 Dec, 2013

3 commits

  • Getting a divide by 0 when events are processed from a file:

    perf trace -i perf.data -s
    ...
    dnsmasq (1684), 10 events, inf%, 0.000 msec

    The problem is that the event count is not incremented as events are
    processed. With this patch:

    perf trace -i perf.data -s
    ...
    dnsmasq (1684), 10 events, 8.9%, 0.000 msec

    Signed-off-by: David Ahern
    Link: http://lkml.kernel.org/r/1386211302-31303-4-git-send-email-dsahern@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    David Ahern
     
  • Older kernels (e.g., RHEL6) do system call tracing via
    syscalls:sys_{enter,exit} rather than raw_syscalls. Update perf-trace to
    detect lack of raw_syscalls support and try syscalls.

    Signed-off-by: David Ahern
    Link: http://lkml.kernel.org/r/1386211302-31303-2-git-send-email-dsahern@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    David Ahern
     
  • In order to get the proper plugins processing we need to use full
    trace-event interface when creating tracepoint events. So far we were
    using shortcut to get the parsed format.

    Moving current 'event_format__new' function into trace-event object as
    'trace_event__tp_format'.

    This function uses properly initialized global trace-event object,
    ensuring proper plugins processing.

    Signed-off-by: Jiri Olsa
    Cc: Corey Ashford
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1386076182-14484-11-git-send-email-jolsa@redhat.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

03 Dec, 2013

1 commit

  • Currently trace command supports '-m' option, but does not honours its
    value and keeps the default.

    Changing the perf_evlist__mmap function call to use the '-m' configured
    value.

    Signed-off-by: Jiri Olsa
    Acked-by: David Ahern
    Cc: Corey Ashford
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1385657842-8914-1-git-send-email-jolsa@redhat.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

28 Nov, 2013

1 commit

  • Thread summary line coloring looks ugly. It doesn't add much value so
    remove coloring completely.

    Signed-off-by: Pekka Enberg
    Acked-by: David Ahern
    Link: http://lkml.kernel.org/r/1384447410-1771-1-git-send-email-penberg@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Pekka Enberg
     

15 Nov, 2013

1 commit

  • Tweak the summary output as suggested by Ingo Molnar:

    [penberg@localhost ~]$ perf trace -a --duration 10000 --summary -- sleep 1
    ^C
    Summary of events:

    Xorg (817), 148 events, 0.0%, 0.000 msec

    syscall calls min avg max stddev
    (msec) (msec) (msec) (%)
    --------------- -------- --------- --------- --------- ------
    read 7 0.002 0.004 0.011 32.00%
    rt_sigprocmask 40 0.001 0.001 0.002 1.31%
    ioctl 6 0.002 0.003 0.005 19.45%
    writev 7 0.004 0.018 0.059 43.76%
    select 9 0.000 74.513 507.869 74.61%
    setitimer 4 0.001 0.002 0.002 10.08%

    Suggested-by: Ingo Molnar
    Signed-off-by: Pekka Enberg
    Acked-by: Ingo Molnar
    Cc: David Ahern
    Cc: Ingo Molnar
    Link: http://lkml.kernel.org/r/1384345308-24404-1-git-send-email-penberg@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Pekka Enberg