1. 19 2月, 2018 1 次提交
  2. 17 2月, 2018 33 次提交
  3. 16 2月, 2018 6 次提交
    • Y
      perf stat: Add support to print counts after a period of time · f1f8ad52
      yuzhoujian 提交于
      Introduce a new option to print counts after N milliseconds and update
      'perf stat' documentation accordingly.
      
      Show below is the output of the new option for perf stat.
      
        $ perf stat --time 2000 -e cycles -a
        Performance counter stats for 'system wide':
      
              157,260,423      cycles
      
              2.003060766 seconds time elapsed
      
      We can print the count deltas after N milliseconds with this new
      introduced option. This option is not supported with "-I" option.
      
      In addition, according to Kangliang's patch(19afd104), the
      monitoring overhead for system-wide core event could be very high if the
      interval-print parameter was below 100ms, and the limitation value is
      10ms.
      
      So the same warning will be displayed when the time is set between 10ms
      to 100ms, and the minimal time is limited to 10ms. Users can make a
      decision according to their spcific cases.
      
      Committer notes:
      
      This actually stops the workload after the specified time, then prints
      the counts.
      
      So I renamed the option to --timeout and updated the documentation to
      state that it will not just print the counts after the specified time,
      but will really stop the 'perf stat' session and print the counts.
      
      The rename from 'time' to 'timeout' also fixes the build in systems
      where 'time' is used by glibc and can't be used as a name of a variable,
      such as centos:5 and centos:6.
      
      Changes since v3:
      - none.
      
      Changes since v2:
      - modify the time check in __run_perf_stat func to keep some consistency
        with the workload case.
      - add the warning when the time is set between 10ms to 100ms.
      - add the pr_err when the time is set below 10ms.
      
      Changes since v1:
      - none.
      Signed-off-by: Nyuzhoujian <yuzhoujian@didichuxing.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1517217923-8302-3-git-send-email-ufo19890607@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f1f8ad52
    • Y
      perf stat: Add support to print counts for fixed times · db06a269
      yuzhoujian 提交于
      Introduce a new option to print counts for fixed number of times and
      update 'perf stat' documentation accordingly.
      
      Show below is the output of the new option for perf stat.
      
        $ perf stat -I 1000 --interval-count 2 -e cycles -a
        #           time             counts unit events
                 1.002827089         93,884,870      cycles
                 2.004231506         56,573,446      cycles
      
      We can just print the counts for several times with this newly
      introduced option. The usage of it is a little like 'vmstat', and it
      should be used together with "-I" option.
      
        $ vmstat -n 1 2
        procs ---------memory-------------- --swap- ----io-- -system-- ------cpu---
         r  b swpd   free   buff   cache    si   so  bi   bo  in   cs us sy id wa st
         0  0    0 78270544 547484 51732076  0   0   0   20    1    1  1  0 99  0 0
         0  0    0 78270512 547484 51732080  0   0   0   16  477 1555  0  0 100 0 0
      
      Changes since v3:
      - merge interval_count check and times check to one line.
      - fix the wrong indent in stat.h
      - use stat_config.times instead of 'times' in cmd_stat function.
      
      Changes since v2:
      - none.
      
      Changes since v1:
      - change the name of the new option "times-print" to "interval-count".
      - keep the new option interval specifically.
      Signed-off-by: Nyuzhoujian <yuzhoujian@didichuxing.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: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1517217923-8302-2-git-send-email-ufo19890607@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      db06a269
    • J
      perf report: Add support to display group output for non group events · ad52b8cb
      Jiri Olsa 提交于
      Add support to display group output for if non grouped events are
      detected and user forces --group option. Now for non-group events
      recorded like:
      
        $ perf record -e 'cycles,instructions' ls
      
      you can still get group output by using --group option
      in report:
      
        $ perf report --group --stdio
        ...
        #         Overhead  Command  Shared Object     Symbol
        # ................  .......  ................  ......................
        #
            17.67%   0.00%  ls       libc-2.25.so      [.] _IO_do_write@@GLIB
            15.59%  25.94%  ls       ls                [.] calculate_columns
            15.41%  31.35%  ls       libc-2.25.so      [.] __strcoll_l
        ...
      
      Committer note:
      
      We should improve on this by making sure that the first line states that
      this is not a group, but since the user doesn't have to force group view
      when really using grouped events (e.g. '{cycles,instructions}'), the
      user better know what is being done...
      Requested-by: NStephane Eranian <eranian@google.com>
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: NStephane Eranian <eranian@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20180209092734.GB20449@kravaSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ad52b8cb
    • J
      perf report: Ask for ordered events for --tasks option · 8614ada0
      Jiri Olsa 提交于
      If we have the time in, keep the events in time order.
      
      Committer notes:
      
      Trying to be more verbose, what actual effect this will have in this particular
      case?
      
      Before and after this patch shows the artifacts:
      
        --- /tmp/before 2018-02-06 15:40:29.536411625 -0300
        +++ /tmp/after  2018-02-06 15:40:51.963403599 -0300
        @@ -5,34 +5,34 @@
               2540     2540     1818 |   gnome-terminal-
               3489     3489     2540 |    bash
              32433    32433     3489 |     perf
        -     32434    32434    32433 |      perf
        +     32434    32434    32433 |      make
              32441    32441    32434 |       make
              32514    32514    32441 |        make
                511      511    32514 |         sh
        -       512      512      511 |          sh
        +       512      512      511 |          install
      <SNIP>
      
      We don't have 'perf' calling 'perf' calling 'make', etc, the second
      'perf' actually is 'make', i.e.  there was reordering of the relevant
      PERF_RECORD_COMM and PERF_RECORD_FORK records.
      
      Ditto for sh/install later on.
      
      Look for FORK and COMM meta events, for those tids:
      
        # perf report -D | egrep 'PERF_RECORD_(FORK|COMM)' | egrep '3243[34]'
        0 14774650990679 0x1a3cd8 [0x38]: PERF_RECORD_FORK(32433:32433):(3489:3489)
        1 14774652080381 0x1d6568 [0x30]: PERF_RECORD_COMM exec: perf:32433/32433
        1 14774742473340 0x1dbb48 [0x38]: PERF_RECORD_FORK(32434:32434):(32433:32433)
        0 14774752005779 0x1a4af8 [0x30]: PERF_RECORD_COMM exec: make:32434/32434
        0 14774753997960 0x1a5578 [0x38]: PERF_RECORD_FORK(32435:32435):(32434:32434)
        0 14774756070782 0x1a5618 [0x38]: PERF_RECORD_FORK(32438:32438):(32434:32434)
        0 14774757772939 0x1a5680 [0x38]: PERF_RECORD_FORK(32440:32440):(32434:32434)
        0 14774758230600 0x1a56e8 [0x38]: PERF_RECORD_FORK(32441:32441):(32434:32434)
        #
      
      First column is the cpu, second is the timestamp.
      
      So they are on different CPUs, thus ring buffers, and when we don't use
      the ordered_events class, we end up mixing that up, use it to take
      advantage of the PERF_RECORD_FINISHED_ROUND meta events to go on
      ordering the events using the PERF_SAMPLE_TIME present in the
      PERF_RECORD_{FORK,COMM,EXIT,SAMPLE,etc} records in the ring buffer.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20180206181813.10943-2-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8614ada0
    • J
      perf tools: Fix comment for sort__* compare functions · a7402c94
      Jiri Olsa 提交于
      In commit 2f15bd8c ("perf tools: Fix "Command" sort_entry's cmp and
      collapse function") we switched from pointer to string comparison.
      
      But failed to remove related comments. Removing them and adding another
      one to warn before pointer comparison in here.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20180206181813.10943-18-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a7402c94
    • J
      perf tests: Fix dwarf unwind for stripped binaries · fdf7c49c
      Jiri Olsa 提交于
      When we strip the perf binary, dwarf unwind test stop
      to work. The reason is that strip will remove static
      function symbols, which we need to check for unwind.
      
      This change will keep this test working in cases where
      the global symbols are put into dynamic symbol table,
      which is the case on x86. It still won't work on powerpc.
      
      Making those 5 local functions global, and adding
      'test_dwarf_unwind__' to their names.
      
      Committer testing:
      
      Before:
      
        # perf test dwarf
        58: DWARF unwind                               : Ok
        # strip ~/bin/perf
        # perf test dwarf
        58: DWARF unwind                               : FAILED!
        # perf test -v dwarf
        58: DWARF unwind                               :
        --- start ---
        test child forked, pid 6590
        unwind: thread map already set, dso=/home/acme/bin/perf
        <SNIP>
        unwind: access_mem addr 0x7ffce6c48098 val 48563f, offset 1144
        unwind: test__dwarf_unwind:ip = 0x4a54e5 (0xa54e5)
        got: test__dwarf_unwind 0xa54e5, expecting test__dwarf_unwind
        unwind: '':ip = 0x4a50bb (0xa50bb)
        failed: got unresolved address 0xa50bb
        unwind failed
        test child finished with -1
        ---- end ----
        DWARF unwind: FAILED!
        #
      
      After:
      
        # perf test dwarf
        58: DWARF unwind                               : Ok
        # strip ~/bin/perf
        # perf test dwarf
        58: DWARF unwind                               : Ok
        #
        # perf test -v dwarf
        58: DWARF unwind                               :
        --- start ---
        test child forked, pid 7219
        unwind: thread map already set, dso=/home/acme/bin/perf
        <SNIP>
        unwind: access_mem addr 0x7fff007da2c8 val 48575f, offset 1144
        unwind: test__arch_unwind_sample:ip = 0x589044 (0x189044)
        got: test__arch_unwind_sample 0x189044, expecting test__arch_unwind_sample
        unwind: test_dwarf_unwind__thread:ip = 0x4a52f7 (0xa52f7)
        got: test_dwarf_unwind__thread 0xa52f7, expecting test_dwarf_unwind__thread
        unwind: test_dwarf_unwind__compare:ip = 0x4a5468 (0xa5468)
        got: test_dwarf_unwind__compare 0xa5468, expecting test_dwarf_unwind__compare
        unwind: bsearch:ip = 0x7f6608ae94d8 (0x394d8)
        got: bsearch 0x394d8, expecting bsearch
        unwind: test_dwarf_unwind__krava_3:ip = 0x4a54d1 (0xa54d1)
        got: test_dwarf_unwind__krava_3 0xa54d1, expecting test_dwarf_unwind__krava_3
        unwind: test_dwarf_unwind__krava_2:ip = 0x4a550b (0xa550b)
        got: test_dwarf_unwind__krava_2 0xa550b, expecting test_dwarf_unwind__krava_2
        unwind: test_dwarf_unwind__krava_1:ip = 0x4a554b (0xa554b)
        got: test_dwarf_unwind__krava_1 0xa554b, expecting test_dwarf_unwind__krava_1
        unwind: test__dwarf_unwind:ip = 0x4a5605 (0xa5605)
        got: test__dwarf_unwind 0xa5605, expecting test__dwarf_unwind
        test child finished with 0
        ---- end ----
        DWARF unwind: Ok
        #
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20180206181813.10943-17-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      fdf7c49c