1. 20 4月, 2017 5 次提交
  2. 13 4月, 2017 5 次提交
  3. 12 4月, 2017 13 次提交
  4. 11 4月, 2017 6 次提交
    • T
      perf pmu: Refactor wordwrap() with ltrim() · aa4beb10
      Taeung Song 提交于
      Signed-off-by: NTaeung Song <treeze.taeung@gmail.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1491575061-704-5-git-send-email-treeze.taeung@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      aa4beb10
    • T
      perf ui browser: Refactor the code to parse color configs with ltrim() · e21600fd
      Taeung Song 提交于
      When parsing {fore, back} ground color configs, use ltrim() instead of
      just while loop and isspace().
      Signed-off-by: NTaeung Song <treeze.taeung@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1491575061-704-4-git-send-email-treeze.taeung@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e21600fd
    • T
      perf stat: Refactor the code to strip csv output with ltrim() · b07c40df
      Taeung Song 提交于
      To strip csv output, use ltrim() instead of just while loop and
      isspace() at print_metric_{only}_csv().
      Signed-off-by: NTaeung Song <treeze.taeung@gmail.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1491575061-704-3-git-send-email-treeze.taeung@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b07c40df
    • J
      perf evsel: Return exact sub event which failed with EPERM for wildcards · 32ccb130
      Jin Yao 提交于
      The kernel has a special check for a specific irq_vectors trace event.
      
      TRACE_EVENT_PERF_PERM(irq_work_exit,
      	is_sampling_event(p_event) ? -EPERM : 0);
      
      The perf-record fails for this irq_vectors event when it is present,
      like when using a wildcard:
      
        root@skl:/tmp# perf record -a -e irq_vectors:* sleep 2
        Error:
        You may not have permission to collect system-wide stats.
      
        Consider tweaking /proc/sys/kernel/perf_event_paranoid,
        which controls use of the performance events system by
        unprivileged users (without CAP_SYS_ADMIN).
      
        The current value is 2:
      
          -1: Allow use of (almost) all events by all users
        >= 0: Disallow raw tracepoint access by users without CAP_IOC_LOCK
        >= 1: Disallow CPU event access by users without CAP_SYS_ADMIN
        >= 2: Disallow kernel profiling by users without CAP_SYS_ADMIN
      
        To make this setting permanent, edit /etc/sysctl.conf too, e.g.:
      
              kernel.perf_event_paranoid = -1
      
      This patch prints out the exact sub event that failed with EPERM for
      wildcards to help in understanding what went wrong when this event is
      present:
      
      After the patch:
      
        root@skl:/tmp# perf record -a -e irq_vectors:* sleep 2
        Error:
        No permission to enable irq_vectors:irq_work_exit event.
      
        You may not have permission to collect system-wide stats.
        ......
      
      Committer notes:
      
      So we have a lot of irq_vectors events:
      
        [root@jouet ~]# perf list irq_vectors:*
      
        List of pre-defined events (to be used in -e):
      
          irq_vectors:call_function_entry                    [Tracepoint event]
          irq_vectors:call_function_exit                     [Tracepoint event]
          irq_vectors:call_function_single_entry             [Tracepoint event]
          irq_vectors:call_function_single_exit              [Tracepoint event]
          irq_vectors:deferred_error_apic_entry              [Tracepoint event]
          irq_vectors:deferred_error_apic_exit               [Tracepoint event]
          irq_vectors:error_apic_entry                       [Tracepoint event]
          irq_vectors:error_apic_exit                        [Tracepoint event]
          irq_vectors:irq_work_entry                         [Tracepoint event]
          irq_vectors:irq_work_exit                          [Tracepoint event]
          irq_vectors:local_timer_entry                      [Tracepoint event]
          irq_vectors:local_timer_exit                       [Tracepoint event]
          irq_vectors:reschedule_entry                       [Tracepoint event]
          irq_vectors:reschedule_exit                        [Tracepoint event]
          irq_vectors:spurious_apic_entry                    [Tracepoint event]
          irq_vectors:spurious_apic_exit                     [Tracepoint event]
          irq_vectors:thermal_apic_entry                     [Tracepoint event]
          irq_vectors:thermal_apic_exit                      [Tracepoint event]
          irq_vectors:threshold_apic_entry                   [Tracepoint event]
          irq_vectors:threshold_apic_exit                    [Tracepoint event]
          irq_vectors:x86_platform_ipi_entry                 [Tracepoint event]
          irq_vectors:x86_platform_ipi_exit                  [Tracepoint event]
        #
      
      And some may be sampled:
      
        [root@jouet ~]# perf record -e irq_vectors:local* sleep 20s
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.020 MB perf.data (2 samples) ]
        [root@jouet ~]# perf report -D | egrep 'stats:|events:'
        Aggregated stats:
                   TOTAL events:        155
                    MMAP events:        144
                    COMM events:          2
                    EXIT events:          1
                  SAMPLE events:          2
                   MMAP2 events:          4
          FINISHED_ROUND events:          1
               TIME_CONV events:          1
        irq_vectors:local_timer_entry stats:
                   TOTAL events:          1
                  SAMPLE events:          1
        irq_vectors:local_timer_exit stats:
                   TOTAL events:          1
                  SAMPLE events:          1
        [root@jouet ~]#
      
      But, as shown in the tracepoint definition at the start of this message,
      some, like "irq_vectors:irq_work_exit", may not be sampled, just counted,
      i.e. if we try to sample, as when using 'perf record', we get an error:
      
        [root@jouet ~]# perf record -e irq_vectors:irq_work_exit
        Error:
        You may not have permission to collect system-wide stats.
      
        Consider tweaking /proc/sys/kernel/perf_event_paranoid,
      <SNIP>
      
      The error message is misleading, this patch will help in pointing out
      what is the event causing such an error, but the error message needs
      improvement, i.e. we need to figure out a way to check if a tracepoint
      is counting only, like this one, when all we can do is to count it with
      'perf stat', at most printing the delta using interval printing, as in:
      
         [root@jouet ~]# perf stat -I 5000 -e irq_vectors:irq_work_*
        #           time             counts unit events
             5.000168871                  0      irq_vectors:irq_work_entry
             5.000168871                  0      irq_vectors:irq_work_exit
            10.000676730                  0      irq_vectors:irq_work_entry
            10.000676730                  0      irq_vectors:irq_work_exit
            15.001122415                  0      irq_vectors:irq_work_entry
            15.001122415                  0      irq_vectors:irq_work_exit
            20.001298051                  0      irq_vectors:irq_work_entry
            20.001298051                  0      irq_vectors:irq_work_exit
            25.001485020                  1      irq_vectors:irq_work_entry
            25.001485020                  1      irq_vectors:irq_work_exit
            30.001658706                  0      irq_vectors:irq_work_entry
            30.001658706                  0      irq_vectors:irq_work_exit
        ^C    32.045711878                  0      irq_vectors:irq_work_entry
            32.045711878                  0      irq_vectors:irq_work_exit
      
        [root@jouet ~]#
      
      But at least, when we use a wildcard, this patch helps a bit.
      Signed-off-by: NYao Jin <yao.jin@linux.intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1491566932-503-1-git-send-email-yao.jin@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      32ccb130
    • A
      perf script: Use strtok_r() when parsing output field list · 49346e85
      Arnaldo Carvalho de Melo 提交于
      Just avoiding non-reentrant functions.
      
      Cc: David Ahern <dsahern@gmail.com>
      Link: http://lkml.kernel.org/n/tip-eqytykipd74epzl9aexvppcg@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      49346e85
    • A
      perf callchains: Switch from strtok() to strtok_r() when parsing options · dadafc31
      Arnaldo Carvalho de Melo 提交于
      Trying to keep everything reentrant.
      
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/n/tip-rdce0p2k9e1b4qnrb8ki9mtf@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      dadafc31
  5. 07 4月, 2017 1 次提交
  6. 05 4月, 2017 1 次提交
    • T
      perf annotate: Fix missing number of samples for source_line_samples · 99094a5e
      Taeung Song 提交于
      The option 'show-total-period' works fine without a option '-l'.  But if
      running 'perf annotate --stdio -l --show-total-period', you can see a
      problem showing only zero '0' for number of samples.
      
      Before:
          $ perf annotate --stdio -l --show-total-period
      ...
             0 :        400816:       push   %rbp
             0 :        400817:       mov    %rsp,%rbp
             0 :        40081a:       mov    %edi,-0x24(%rbp)
             0 :        40081d:       mov    %rsi,-0x30(%rbp)
             0 :        400821:       mov    -0x24(%rbp),%eax
             0 :        400824:       mov    -0x30(%rbp),%rdx
             0 :        400828:       mov    (%rdx),%esi
             0 :        40082a:       mov    $0x0,%edx
      ...
      
      The reason is it was missed to set number of samples of
      source_line_samples, so set it ordinarily.
      
      After:
          $ perf annotate --stdio -l --show-total-period
      ...
             3 :        400816:       push   %rbp
             4 :        400817:       mov    %rsp,%rbp
             0 :        40081a:       mov    %edi,-0x24(%rbp)
             0 :        40081d:       mov    %rsi,-0x30(%rbp)
             1 :        400821:       mov    -0x24(%rbp),%eax
             2 :        400824:       mov    -0x30(%rbp),%rdx
             0 :        400828:       mov    (%rdx),%esi
             1 :        40082a:       mov    $0x0,%edx
      ...
      Signed-off-by: NTaeung Song <treeze.taeung@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Martin Liska <mliska@suse.cz>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Fixes: 0c4a5bce ("perf annotate: Display total number of samples with --show-total-period")
      Link: http://lkml.kernel.org/r/1490703125-13643-1-git-send-email-treeze.taeung@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      99094a5e
  7. 04 4月, 2017 4 次提交
  8. 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
  9. 31 3月, 2017 4 次提交