1. 10 2月, 2017 1 次提交
    • A
      perf tests: Avoid possible truncation with dirent->d_name + snprintf · 2e2bbc03
      Arnaldo Carvalho de Melo 提交于
      Addressing a few cases spotted by a new warning in gcc 7:
      
        tests/parse-events.c: In function 'test_pmu_events':
        tests/parse-events.c:1790:39: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 90 [-Werror=format-truncation=]
           snprintf(name, MAX_NAME, "cpu/event=%s/u", ent->d_name);
                                             ^~
        In file included from /usr/include/stdio.h:939:0,
                         from /git/linux/tools/perf/util/map.h:9,
                         from /git/linux/tools/perf/util/symbol.h:7,
                         from /git/linux/tools/perf/util/evsel.h:10,
                         from tests/parse-events.c:3:
        /usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 13 and 268 bytes into a destination of size 100
           return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                __bos (__s), __fmt, __va_arg_pack ());
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        tests/parse-events.c:1798:29: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 100 [-Werror=format-truncation=]
           snprintf(name, MAX_NAME, "%s:u,cpu/event=%s/u", ent->d_name, ent->d_name);
      
      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>
      Fixes: 945aea22 ("perf tests: Move test objects into 'tests' directory")
      Link: http://lkml.kernel.org/n/tip-ty4q2p8zp1dp3mskvubxskm5@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2e2bbc03
  2. 23 6月, 2016 1 次提交
  3. 06 6月, 2016 1 次提交
  4. 20 2月, 2016 2 次提交
    • W
      perf tools: Enable config and setting names for legacy cache events · 43d0b978
      Wang Nan 提交于
      This patch allows setting config terms for legacy cache events.
      For example:
      
        # perf stat -e L1-icache-misses/name=valA/ -e branches/name=valB/ ls
        ...
         Performance counter stats for 'ls':
      
                    11299      valA
                   451605      valB
      
              0.000779091 seconds time elapsed
      
        # perf record -e cache-misses/name=inh/ -e cache-misses/name=noinh,no-inherit/ bash
        # ls
        # exit
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.023 MB perf.data (131 samples) ]
        # perf report --stdio | grep -B 1 'Event count'
        # Samples: 105  of event 'inh'
        # Event count (approx.): 109118
        --
        # Samples: 26  of event 'noinh'
        # Event count (approx.): 48302
      
      A test case is introduced to test this feature.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Cody P Schafer <dev@codyps.com>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Jeremie Galarneau <jeremie.galarneau@efficios.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kirill Smelkov <kirr@nexedi.com>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1455882283-79592-14-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      43d0b978
    • W
      perf tools: Enable config raw and numeric events · 10bf358a
      Wang Nan 提交于
      This patch allows setting config terms for raw and numeric events.
      For example:
      
        # perf stat -e cycles/name=cyc/ ls
        ...
        1821108      cyc
        ...
      
        # perf stat -e r6530160/name=event/ ls
        ...
        1103195      event
        ...
      
        # perf record -e cycles -e 4:0x6530160/name=evtx,call-graph=fp/ -a sleep 1
        ...
        # perf report --stdio
        ...
        # Samples: 124  of event 'cycles'
        46.61%     0.00%  swapper        [kernel.vmlinux]            [k] cpu_startup_entry
        41.26%     0.00%  swapper        [kernel.vmlinux]            [k] start_secondary
        ...
        # Samples: 91  of event 'evtx'
        ...
        93.76%     0.00%  swapper      [kernel.vmlinux]            [k] cpu_startup_entry
                |
                ---cpu_startup_entry
                   |
                   |--66.63%--call_cpuidle
                   |          cpuidle_enter
                   |          |
        ...
      
      3 test cases are introduced to test config terms for symbol, raw and
      numeric events.
      
      Committer note:
      
      Further testing shows that we can retrieve the event name using 'perf
      evlist -v' and looking at the 'config' perf_event_attr field, i.e.:
      
        # perf record -e cycles -e 4:0x6530160/name=evtx,call-graph=fp/ -a sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 1.724 MB perf.data (2076 samples) ]
        # perf evlist
        cycles
        evtx
        # perf evlist -v
        cycles: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|CPU|PERIOD|IDENTIFIER, read_format: ID, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1
      evtx: type: 4, size: 112, config: 0x6530160, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|CALLCHAIN|CPU|PERIOD|IDENTIFIER, read_format: ID, disabled: 1, inherit: 1, freq: 1, sample_id_all: 1, exclude_guest: 1
        #
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Cody P Schafer <dev@codyps.com>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Jeremie Galarneau <jeremie.galarneau@efficios.com>
      Cc: Kirill Smelkov <kirr@nexedi.com>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1455882283-79592-13-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      10bf358a
  5. 13 2月, 2016 1 次提交
  6. 20 11月, 2015 1 次提交
    • A
      perf tests: Pass the subtest index to each test routine · 721a1f53
      Arnaldo Carvalho de Melo 提交于
      Some tests have sub-tests we want to run, so allow passing this.
      
      Wang tried to avoid having to touch all tests, but then, having the
      test.func in an anonymous union makes the build fail on older compilers,
      like the one in RHEL6, where:
      
        test a = {
      	.func = foo,
        };
      
      fails.
      
      To fix it leave the func pointer in the main structure and pass the subtest
      index to all tests, end result function is the same, but we have just one
      function pointer, not two, with and without the subtest index as an argument.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-5genj0ficwdmelpoqlds0u4y@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      721a1f53
  7. 20 10月, 2015 1 次提交
  8. 06 10月, 2015 1 次提交
  9. 14 9月, 2015 2 次提交
  10. 13 8月, 2015 1 次提交
  11. 30 7月, 2015 1 次提交
    • J
      perf tools: Force period term to overload global settings · ee4c7588
      Jiri Olsa 提交于
      Currently the command line option settings beats the per event period
      settings:
      
      With no global settings, we get per-event configuration:
      
        $ perf record -e 'cpu/instructions,period=20000/' sleep 1
        $ perf evlist -v
        ... { sample_period, sample_freq }: 20000 ...
      
      With 'c' option period setup, we get 'c' option value:
        $ perf record -e 'cpu/instructions,period=20000/' -c 1000 sleep 1
        $ perf evlist -v
        ... { sample_period, sample_freq }: 1000 ...
      
      This patch makes the per-event settings overload the global 'c' option
      setup:
      
        $ perf record -e 'cpu/instructions,period=20000/' -c 1000 sleep 1
        $ perf evlist -v
        ... { sample_period, sample_freq }: 20000 ...
      
      I think the making the per-event settings to overload any other config
      makes more sense than current state. However it breaks the current
      'period' term handling, which might cause some noise.. so let's see ;-).
      
      Also fixing parse event tests with the new behaviour.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/1438162936-59698-3-git-send-email-kan.liang@intel.comSigned-off-by: NKan Liang <kan.liang@intel.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ee4c7588
  12. 29 5月, 2015 1 次提交
  13. 29 4月, 2015 1 次提交
    • J
      perf tools: Add parse_events_error interface · b39b8393
      Jiri Olsa 提交于
      Adding support to return error information from parse_events function.
      Following struct will be populated by parse_events function on return:
      
        struct parse_events_error {
          int   idx;
          char *str;
          char *help;
        };
      
      where 'idx' is the position in the string where the parsing failed,
      'str' contains dynamically allocated error string describing the error
      and 'help' is optional help string.
      
      The change contains reporting function, which currently does not display
      anything. The code changes to supply error data for specific event types
      are coming in next patches. However this is what the expected output is:
      
        $ sudo perf record -e 'sched:krava' ls
        event syntax error: 'sched:krava'
                             \___ unknown tracepoint
        ...
      
        $ perf record -e 'cpu/even=0x1/' ls
        event syntax error: 'cpu/even=0x1/'
                                 \___ unknown term
      
        valid terms: pc,any,inv,edge,cmask,event,in_tx,ldlat,umask,in_tx_cp,offcore_rsp,config,config1,config2,name,period,branch_type
        ...
      
        $ perf record -e cycles,cache-mises ls
        event syntax error: '..es,cache-mises'
                                       \___ parser error
        ...
      
      The output functions cut the beginning of the event string so the error
      starts up to 10th character and cut the end of the string of it crosses
      the terminal width.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1429729824-13932-2-git-send-email-jolsa@kernel.org
      [ Renamed 'error' variables to 'err', not to clash with util.h error() ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b39b8393
  14. 08 4月, 2015 1 次提交
  15. 11 2月, 2015 1 次提交
  16. 22 1月, 2015 1 次提交
  17. 03 12月, 2014 1 次提交
  18. 16 10月, 2014 1 次提交
    • K
      perf test: Add test case for pmu event new style format · ffe59788
      Kan Liang 提交于
      Add test case in automated tests suite. It checks not only the two types
      of pmu event stytle formats "pmu_event_name" and "cpu/pmu_event_name/",
      but also the different formats mixtures which are more likely to trigger
      parse issue.
      
      The patch set including this one has been tested by the perf automated
      test:
      
         ./perf test parse -v"
      
      On haswell, ivybridge and Romley platform.
      
      The patch set also has been tested on haswell by the following script.
      
      Note: please make sure that your test system support TSX and
      L1-dcache-loads events. Otherwise, you may want to change the events to
      other pmu events.
      
        [lk@localhost ~]$ cat perf_style_test.sh
        # hardware events + kernel pmu event with different style
        perf stat -x, -e cycles,mem-stores,tx-start sleep 2
        perf stat -x, -e cpu-cycles,cycles-ct,cycles-t sleep 2
        perf stat -x, -e cycles,cpu/cycles-ct/,cpu/cycles-t/ sleep 2
        perf stat -x, -e instructions,cpu/tx-start/ sleep 2
        perf stat -x, -e '{cycles,tx-start}' sleep 2
        perf stat -x, -e '{cycles,cpu/tx-start/}' sleep 2
      
        # HW Cache event + kernel pmu event with different style
        perf stat -x, -e L1-dcache-loads,cpu/mem-stores/,tx-start sleep 2
        perf stat -x, -e L1-dcache-loads,mem-stores,cpu/tx-start/ sleep 2
        perf stat -x, -e '{L1-dcache-loads,mem-stores}' sleep 2
        perf stat -x, -e '{L1-dcache-loads,cpu/tx-start/}' sleep 2
      
        # Raw event + kernel pmu event with different style:
        perf stat -x, -e cpu/event=0xc0,umask=0x00/,mem-loads,cpu/mem-stores/ sleep 2
        perf stat -x, -e cpu/event=0xc0,umask=0x00/,tx-start,cpu/el-start/ sleep 2
        perf stat -x, -e '{cpu/event=0xc0,umask=0x00/,tx-start}' sleep 2
      Signed-off-by: NKan Liang <kan.liang@intel.com>
      Acked-by: NJiri Olsa <jolsa@redhat.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/1412694532-23391-5-git-send-email-kan.liang@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ffe59788
  19. 17 7月, 2014 1 次提交
  20. 29 4月, 2014 2 次提交
  21. 18 2月, 2014 1 次提交
    • B
      perf tools: Move fs.* to lib/api/fs/ · cd0cfad7
      Borislav Petkov 提交于
      Move to generic library and kill magic.h as it is needed only in fs.h.
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <rric@kernel.org>
      Cc: Stanislav Fomichev <stfomichev@yandex-team.ru>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Link: http://lkml.kernel.org/r/1386605664-24041-3-git-send-email-bp@alien8.deSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cd0cfad7
  22. 13 1月, 2014 2 次提交
  23. 17 12月, 2013 1 次提交
    • B
      tools/: Convert to new topic libraries · 553873e1
      Borislav Petkov 提交于
      Move debugfs.* to api/fs/. We have a common tools/lib/api/ place where
      the Makefile lives and then we place the headers in subdirs.
      
      For example, all the fs-related stuff goes to tools/lib/api/fs/ from
      which we get libapikfs.a (acme got almost the naming he wanted :-)) and
      we link it into the tools which need it - in this case perf and
      tools/vm/page-types.
      
      acme:
      
      "Looking at the implementation, I think some tools can even link
      directly to the .o files, avoiding the .a file altogether.
      
      But that is just an optimization/finer granularity tools/lib/
      cherrypicking that toolers can make use of."
      
      Fixup documentation cleaning target while at it.
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Acked-by: NIngo Molnar <mingo@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <rric@kernel.org>
      Cc: Stanislav Fomichev <stfomichev@yandex-team.ru>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Link: http://lkml.kernel.org/r/1386605664-24041-2-git-send-email-bp@alien8.deSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      553873e1
  24. 15 11月, 2013 1 次提交
  25. 06 11月, 2013 2 次提交
  26. 08 8月, 2013 2 次提交
  27. 13 7月, 2013 2 次提交
  28. 12 4月, 2013 1 次提交
  29. 16 3月, 2013 2 次提交
  30. 07 2月, 2013 1 次提交
  31. 01 2月, 2013 1 次提交
  32. 25 1月, 2013 1 次提交