1. 01 6月, 2017 1 次提交
    • J
      perf trace: Add mmap alias for s390 · 54265664
      Jiri Olsa 提交于
      The s390 architecture maps sys_mmap (nr 90) into sys_old_mmap.  For this
      reason perf trace can't find the proper syscall event to get args format
      from and displays it wrongly as 'continued'.
      
      To fix that fill the "alias" field with "old_mmap" for trace's mmap record
      to get the correct translation.
      
      Before:
           0.042 ( 0.011 ms): vest/43052 fstat(statbuf: 0x3ffff89fd90                ) = 0
           0.042 ( 0.028 ms): vest/43052  ... [continued]: mmap()) = 0x3fffd6e2000
           0.072 ( 0.025 ms): vest/43052 read(buf: 0x3fffd6e2000, count: 4096        ) = 6
      
      After:
           0.045 ( 0.011 ms): fstat(statbuf: 0x3ffff8a0930                           ) = 0
           0.057 ( 0.018 ms): mmap(arg: 0x3ffff8a0858                                ) = 0x3fffd14a000
           0.076 ( 0.025 ms): read(buf: 0x3fffd14a000, count: 4096                   ) = 6
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20170531113557.19175-1-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      54265664
  2. 26 4月, 2017 1 次提交
  3. 25 4月, 2017 1 次提交
  4. 21 4月, 2017 1 次提交
  5. 20 4月, 2017 7 次提交
  6. 01 4月, 2017 1 次提交
    • A
      perf trace: Beautify statx syscall 'flag' and 'mask' arguments · fd5cead2
      Arnaldo Carvalho de Melo 提交于
      To test it, build samples/statx/test_statx, which I did as:
      
        $ make headers_install
        $ cc -I ~/git/linux/usr/include samples/statx/test-statx.c -o /tmp/statx
      
      And then use perf trace on it:
      
        # perf trace -e statx /tmp/statx /etc/passwd
        statx(/etc/passwd) = 0
        results=7ff
          Size: 3496            Blocks: 8          IO Block: 4096    regular file
        Device: fd:00           Inode: 280156      Links: 1
        Access: (0644/-rw-r--r--)  Uid:     0   Gid:     0
        Access: 2017-03-29 16:01:01.650073438-0300
        Modify: 2017-03-10 16:25:14.156479354-0300
        Change: 2017-03-10 16:25:14.171479328-0300
           0.000 ( 0.007 ms): statx/30648 statx(dfd: CWD, filename: 0x7ef503f4, flags: SYMLINK_NOFOLLOW, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7fff7ef4eb10) = 0
        #
      
      Using the test-stat.c options to change the mask:
      
        # perf trace -e statx /tmp/statx -O /etc/passwd > /dev/null
           0.000 ( 0.008 ms): statx/30745 statx(dfd: CWD, filename: 0x3a0753f4, flags: SYMLINK_NOFOLLOW, mask: BTIME, buffer: 0x7ffd3a0735c0) = 0
        #
        # perf trace -e statx /tmp/statx -A /etc/passwd > /dev/null
           0.000 ( 0.010 ms): statx/30757 statx(dfd: CWD, filename: 0xa94e63f4, flags: SYMLINK_NOFOLLOW|NO_AUTOMOUNT, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7ffea94e49d0) = 0
        #
        # trace --no-inherit -e statx /tmp/statx -F /etc/passwd > /dev/null
           0.000 ( 0.011 ms): statx(dfd: CWD, filename: 0x3b02d3f3, flags: SYMLINK_NOFOLLOW|STATX_FORCE_SYNC, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7ffd3b02c850) = 0
        #
        # trace --no-inherit -e statx /tmp/statx -F -L /etc/passwd > /dev/null
           0.000 ( 0.008 ms): statx(dfd: CWD, filename: 0x15cff3f3, flags: STATX_FORCE_SYNC, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7fff15cfdda0) = 0
        #
        # trace --no-inherit -e statx /tmp/statx -D -O /etc/passwd > /dev/null
           0.000 ( 0.009 ms): statx(dfd: CWD, filename: 0xfa37f3f3, flags: SYMLINK_NOFOLLOW|STATX_DONT_SYNC, mask: BTIME, buffer: 0x7ffffa37da20) = 0
        #
      
      Adding a probe to get the filename collected as well:
      
        # perf probe 'vfs_getname=getname_flags:72 pathname=result->name:string'
        Added new event:
          probe:vfs_getname    (on getname_flags:72 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
      
        # trace --no-inherit -e statx /tmp/statx -D -O /etc/passwd > /dev/null
           0.169 ( 0.007 ms): statx(dfd: CWD, filename: /etc/passwd, flags: SYMLINK_NOFOLLOW|STATX_DONT_SYNC, mask: BTIME, buffer: 0x7ffda9bf50f0) = 0
        #
      
      Same technique could be used to collect and beautify the result put in
      the 'buffer' argument.
      
      Finally do a system wide 'perf trace' session looking for any use of statx,
      then run the test proggie with various flags:
      
        # trace -e statx
         16612.967 ( 0.028 ms): statx/4562 statx(dfd: CWD, filename: /tmp/statx, flags: SYMLINK_NOFOLLOW, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7ffef195d660) = 0
         33064.447 ( 0.011 ms): statx/4569 statx(dfd: CWD, filename: /tmp/statx, flags: SYMLINK_NOFOLLOW|STATX_FORCE_SYNC, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7ffc5484c790) = 0
         36050.891 ( 0.023 ms): statx/4576 statx(dfd: CWD, filename: /tmp/statx, flags: SYMLINK_NOFOLLOW, mask: BTIME, buffer: 0x7ffeb18b66e0) = 0
         38039.889 ( 0.023 ms): statx/4584 statx(dfd: CWD, filename: /tmp/statx, flags: SYMLINK_NOFOLLOW, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7fff1db0ea90) = 0
        ^C#
      
      This one also starts moving the beautifiers from files directly included
      in builtin-trace.c to separate objects + a beauty.h header with
      prototypes, so that we can add test cases in tools/perf/tests/ to fire
      syscalls with various arguments and then get them intercepted as
      syscalls:sys_enter_foo or raw_syscalls:sys_enter + sys_exit to then
      format and check that the formatted output is the one we expect.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-xvzw8eynffvez5czyzidhrno@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      fd5cead2
  7. 30 3月, 2017 1 次提交
    • A
      perf trace: Handle unpaired raw_syscalls:sys_exit event · fd2b2975
      Arnaldo Carvalho de Melo 提交于
      Which may happen when we start a tracing session and a thread is waiting
      for something like "poll" to return, in which case we better print "?"
      both for the syscall entry timestamp and for the duration.
      
      E.g.:
      
      Tracing existing mutt session:
      
        # perf trace -p `pidof mutt`
                ? (     ?   ): mutt/17135  ... [continued]: poll()) = 1
            0.027 ( 0.013 ms): mutt/17135 read(buf: 0x7ffcb3c42cef, count: 1) = 1
            0.047 ( 0.008 ms): mutt/17135 poll(ufds: 0x7ffcb3c42c50, nfds: 1, timeout_msecs: 1000) = 1
            0.059 ( 0.008 ms): mutt/17135 read(buf: 0x7ffcb3c42cef, count: 1) = 1
        <SNIP>
      
      Before it would print a large number because we'd do:
      
        ttrace->entry_time - trace->base_time
      
      And entry_time would be 0, while base_time would be the timestamp for
      the first event 'perf trace' reads, oops.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Claudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-wbcb93ofva2qdjd5ltn5eeqq@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      fd2b2975
  8. 27 3月, 2017 1 次提交
  9. 25 3月, 2017 3 次提交
  10. 14 3月, 2017 1 次提交
    • H
      perf tools: Add PERF_RECORD_NAMESPACES to include namespaces related info · f3b3614a
      Hari Bathini 提交于
      Introduce a new option to record PERF_RECORD_NAMESPACES events emitted
      by the kernel when fork, clone, setns or unshare are invoked. And update
      perf-record documentation with the new option to record namespace
      events.
      
      Committer notes:
      
      Combined it with a later patch to allow printing it via 'perf report -D'
      and be able to test the feature introduced in this patch. Had to move
      here also perf_ns__name(), that was introduced in another later patch.
      
      Also used PRIu64 and PRIx64 to fix the build in some enfironments wrt:
      
        util/event.c:1129:39: error: format '%lx' expects argument of type 'long unsigned int', but argument 6 has type 'long long unsigned int' [-Werror=format=]
           ret  += fprintf(fp, "%u/%s: %lu/0x%lx%s", idx
                                               ^
      Testing it:
      
        # perf record --namespaces -a
        ^C[ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 1.083 MB perf.data (423 samples) ]
        #
        # perf report -D
        <SNIP>
        3 2028902078892 0x115140 [0xa0]: PERF_RECORD_NAMESPACES 14783/14783 - nr_namespaces: 7
                      [0/net: 3/0xf0000081, 1/uts: 3/0xeffffffe, 2/ipc: 3/0xefffffff, 3/pid: 3/0xeffffffc,
                       4/user: 3/0xeffffffd, 5/mnt: 3/0xf0000000, 6/cgroup: 3/0xeffffffb]
      
        0x1151e0 [0x30]: event: 9
        .
        . ... raw event: size 48 bytes
        .  0000:  09 00 00 00 02 00 30 00 c4 71 82 68 0c 7f 00 00  ......0..q.h....
        .  0010:  a9 39 00 00 a9 39 00 00 94 28 fe 63 d8 01 00 00  .9...9...(.c....
        .  0020:  03 00 00 00 00 00 00 00 ce c4 02 00 00 00 00 00  ................
        <SNIP>
              NAMESPACES events:          1
        <SNIP>
        #
      Signed-off-by: NHari Bathini <hbathini@linux.vnet.ibm.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@fb.com>
      Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
      Cc: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Eric Biederman <ebiederm@xmission.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sargun Dhillon <sargun@sargun.me>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Link: http://lkml.kernel.org/r/148891930386.25309.18412039920746995488.stgit@hbathini.in.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f3b3614a
  11. 20 2月, 2017 1 次提交
  12. 12 1月, 2017 1 次提交
    • A
      perf trace: Allow specifying list of syscalls and events in -e/--expr/--event · 017037ff
      Arnaldo Carvalho de Melo 提交于
      Makes it easier to specify both events and syscalls (to be formatter
      strace-like), i.e. previously one would have to do:
      
        # perf trace -e nanosleep --event sched:sched_switch usleep 1
      
      Now it is possible to do:
      
        # perf trace -e nanosleep,sched:sched_switch usleep 1
           0.000 ( 0.021 ms): usleep/17962 nanosleep(rqtp: 0x7ffdedd61ec0) ...
           0.021 (         ): sched:sched_switch:usleep:17962 [120] S ==> swapper/1:0 [120])
           0.000 ( 0.066 ms): usleep/17962  ... [continued]: nanosleep()) = 0
        #
      
      The old style --expr and using both -e and --event continues to work.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-ieg6bakub4657l9e6afn85r4@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      017037ff
  13. 26 11月, 2016 1 次提交
  14. 24 10月, 2016 3 次提交
  15. 29 9月, 2016 3 次提交
  16. 24 8月, 2016 1 次提交
  17. 13 7月, 2016 3 次提交
  18. 23 6月, 2016 3 次提交
  19. 24 5月, 2016 2 次提交
  20. 20 5月, 2016 4 次提交