1. 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
  2. 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
  3. 27 3月, 2017 1 次提交
  4. 25 3月, 2017 3 次提交
  5. 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
  6. 20 2月, 2017 1 次提交
  7. 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
  8. 26 11月, 2016 1 次提交
  9. 24 10月, 2016 3 次提交
  10. 29 9月, 2016 3 次提交
  11. 24 8月, 2016 1 次提交
  12. 13 7月, 2016 3 次提交
  13. 23 6月, 2016 3 次提交
  14. 24 5月, 2016 2 次提交
  15. 20 5月, 2016 4 次提交
  16. 12 5月, 2016 1 次提交
  17. 11 5月, 2016 1 次提交
  18. 07 5月, 2016 3 次提交
  19. 06 5月, 2016 4 次提交
    • A
      perf trace: Do not print raw args list for syscalls with no args · 4c4d6e51
      Arnaldo Carvalho de Melo 提交于
      The test to check if the arg format had been read from the
      syscall:sys_enter_name/format file was looking at the list of non-commom
      fields, and if that is empty, it would think it had failed to read it,
      because it doesn't exist, for instance, for the clone() syscall.
      
      So instead before dumping the raw syscall args list check
      IS_ERR(sc->tp_format), if that is true, then an attempt was made to read
      the format file and failed, in which case dump the raw arg list values.
      
      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-ls7pmdqb2xy9339vdburwvnk@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4c4d6e51
    • A
      perf trace: Do not show the runtime_ms for a thread when not collecting it · 03548ebf
      Arnaldo Carvalho de Melo 提交于
      That field is only updated when we use the "sched:sched_stat_runtime"
      tracepoint, and that is only done so far when we use the '--stat' command line
      option, without it we get just zeros, confusing the users:
      
      Without this patch:
      
        # trace -a -s sleep 1
        <SNIP>
         qemu-system-x86 (9931), 468 events, 9.6%, 0.000 msec
      
           syscall     calls    total       min       avg       max      stddev
                                (msec)    (msec)    (msec)    (msec)        (%)
           ---------- ------ --------- --------- --------- ---------     ------
           ppoll          98   982.374     0.000    10.024    29.983     12.65%
           write          34     0.401     0.005     0.012     0.027      5.49%
           ioctl         102     0.347     0.002     0.003     0.007      3.08%
      
         firefox (10871), 1856 events, 38.2%, 0.000 msec
      
                                (msec)    (msec)    (msec)    (msec)        (%)
           ---------- ------ --------- --------- --------- ---------     ------
           poll          395   934.873     0.000     2.367    17.120     11.51%
           recvmsg       395     0.988     0.001     0.003     0.021      4.20%
           read          106     0.460     0.002     0.004     0.007      3.17%
           futex          24     0.108     0.001     0.004     0.010     10.05%
           mmap            2     0.041     0.016     0.021     0.026     23.92%
           write           6     0.027     0.004     0.004     0.005      2.52%
      
      After this patch that ', 0.000 msecs' gets suppressed when --stat is not
      in use.
      
      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-p7emqrsw7900tdkg43v9l1e1@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      03548ebf
    • A
      perf trace: Sort syscalls stats by msecs in --summary · b535d523
      Arnaldo Carvalho de Melo 提交于
        # trace -a -s sleep 1
        <SNIP>
         Xorg (1965), 788 events, 19.0%, 0.000 msec
      
           syscall            calls    total       min       avg       max      stddev
                                       (msec)    (msec)    (msec)    (msec)        (%)
           --------------- -------- --------- --------- --------- ---------     ------
           select                89   731.038     0.000     8.214   175.218     36.71%
           ioctl                 22     0.661     0.010     0.030     0.072     10.43%
           writev                42     0.253     0.002     0.006     0.011      5.94%
           recvmsg               60     0.185     0.001     0.003     0.009      5.90%
           setitimer             60     0.127     0.001     0.002     0.006      6.14%
           read                  52     0.102     0.001     0.002     0.005      8.55%
           rt_sigprocmask        45     0.092     0.001     0.002     0.023     23.65%
           poll                  12     0.021     0.001     0.002     0.003      7.21%
           epoll_wait            12     0.019     0.001     0.002     0.002      2.71%
      
         firefox (10871), 1080 events, 26.1%, 0.000 msec
      
           syscall            calls    total       min       avg       max      stddev
                                       (msec)    (msec)    (msec)    (msec)        (%)
           --------------- -------- --------- --------- --------- ---------     ------
           poll                 240   979.562     0.000     4.082    17.132     11.33%
           recvmsg              240     0.532     0.001     0.002     0.007      3.69%
           read                  60     0.303     0.003     0.005     0.029      8.50%
      Suggested-by: NMilian Wolff <milian.wolff@kdab.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.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-52kdkuyxihq0kvc0n2aalhay@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b535d523
    • A
      perf trace: Sort summary output by number of events · 96c14451
      Arnaldo Carvalho de Melo 提交于
        # trace -a -s sleep 1 |& grep events | tail
         gmain (1733), 34 events, 1.0%, 0.000 msec
         hexchat (9765), 46 events, 1.4%, 0.000 msec
         ssh (11109), 80 events, 2.4%, 0.000 msec
         sleep (32631), 81 events, 2.4%, 0.000 msec
         qemu-system-x86 (10021), 272 events, 8.2%, 0.000 msec
         Xorg (1965), 322 events, 9.7%, 0.000 msec
         SoftwareVsyncTh (10922), 366 events, 11.1%, 0.000 msec
         gnome-shell (2231), 446 events, 13.5%, 0.000 msec
         qemu-system-x86 (9931), 468 events, 14.1%, 0.000 msec
         firefox (10871), 1098 events, 33.2%, 0.000 msec
        [root@jouet ~]#
      Suggested-by: NMilian Wolff <milian.wolff@kdab.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.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-ye4cnprhfeiq32ar4lt60dqs@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      96c14451
  20. 28 4月, 2016 1 次提交
  21. 27 4月, 2016 1 次提交