1. 04 8月, 2021 1 次提交
    • J
      perf annotate: Re-add annotate_warned functionality · 3d8b9247
      James Clark 提交于
      Setting annotate_warned to true on errors was removed in
      commit ee51d851 ("perf annotate: Introduce strerror for handling
      symbol__disassemble() errors") which means when 'perf annotate
      --skip-missing' is used warnings are shown multiple times for the same
      DSO.
      
      Setting this again restores the original behavior of only one warning
      each.
      Signed-off-by: NJames Clark <james.clark@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lore.kernel.org/lkml/20210729155805.2830-3-james.clark@arm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3d8b9247
  2. 10 7月, 2021 1 次提交
  3. 07 7月, 2021 1 次提交
  4. 02 7月, 2021 1 次提交
  5. 29 4月, 2021 1 次提交
  6. 24 3月, 2021 1 次提交
  7. 07 3月, 2021 1 次提交
  8. 18 2月, 2021 1 次提交
  9. 01 12月, 2020 3 次提交
  10. 30 11月, 2020 2 次提交
  11. 03 11月, 2020 1 次提交
    • S
      perf hists browser: Increase size of 'buf' in perf_evsel__hists_browse() · 86449b12
      Song Liu 提交于
      Making perf with gcc-9.1.1 generates the following warning:
      
          CC       ui/browsers/hists.o
        ui/browsers/hists.c: In function 'perf_evsel__hists_browse':
        ui/browsers/hists.c:3078:61: error: '%d' directive output may be \
        truncated writing between 1 and 11 bytes into a region of size \
        between 2 and 12 [-Werror=format-truncation=]
      
         3078 |       "Max event group index to sort is %d (index from 0 to %d)",
              |                                                             ^~
        ui/browsers/hists.c:3078:7: note: directive argument in the range [-2147483648, 8]
         3078 |       "Max event group index to sort is %d (index from 0 to %d)",
              |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        In file included from /usr/include/stdio.h:937,
                         from ui/browsers/hists.c:5:
      
      IOW, the string in line 3078 might be too long for buf[] of 64 bytes.
      
      Fix this by increasing the size of buf[] to 128.
      
      Fixes: dbddf174  ("perf report/top TUI: Support hotkeys to let user select any event for sorting")
      Signed-off-by: NSong Liu <songliubraving@fb.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: stable@vger.kernel.org # v5.7+
      Link: http://lore.kernel.org/lkml/20201030235431.534417-1-songliubraving@fb.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      86449b12
  12. 01 9月, 2020 1 次提交
    • A
      perf top/report: Fix infinite loop in the TUI for grouped events · d4ccbacb
      Arnaldo Carvalho de Melo 提交于
      For a while we need to have a dummy event for doing things like
      receiving PERF_RECORD_COMM, PERF_RECORD_EXEC, etc for threads being
      created and dying while we synthesize the pre-existing ones at tool
      start.
      
      This 'dummy' event is needed for keeping track of thread lifetime events
      early in the session but are uninteresting otherwise, i.e. no need to
      have it in a initial events menu for the non-grouped case, i.e. for:
      
       # perf top -e cycles,instructions
      
      or even for plain:
      
       # perf top
      
      When 'cycles' and that 'dummy' event are in place.
      
      The code to remove that 'dummy' event ended up creating an endless loop
      for the grouped case, i.e.:
      
       # perf top -e '{cycles,instructions}'
      
      Fix it.
      
      Fixes: bee9ca1c ("perf report TUI: Remove needless 'dummy' event from menu")
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d4ccbacb
  13. 06 7月, 2020 2 次提交
  14. 23 6月, 2020 1 次提交
  15. 06 5月, 2020 3 次提交
  16. 03 4月, 2020 1 次提交
    • A
      perf report/top TUI: Fix title line formatting · 376c3c22
      Arnaldo Carvalho de Melo 提交于
      In d10ec006 ("perf hists browser: Allow passing an initial hotkey")
      the hist_entry__title() call was cut'n'pasted to a function where the
      'title' variable is a pointer, not an array, so the sizeof(title)
      continues syntactically valid but ends up reducing the real size of the
      buffer where to format the first line in the screen to 8 bytes, which
      makes the formatting at the title at each refresh to produce just the
      string "Samples ", duh, fix it by passing the size of the buffer.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Fixes: d10ec006 ("perf hists browser: Allow passing an initial hotkey")
      Link: http://lore.kernel.org/lkml/20200330154314.GB4576@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      376c3c22
  17. 24 3月, 2020 4 次提交
    • J
      perf report/top TUI: Support hotkeys to let user select any event for sorting · dbddf174
      Jin Yao 提交于
      When performing "perf report --group", it shows the event group information
      together. In previous patch, we have supported a new option "--group-sort-idx"
      to sort the output by the event at the index n in event group.
      
      It would be nice if we can use a hotkey in browser to select a event
      to sort.
      
      For example,
      
        # perf report --group
      
       Samples: 12K of events 'cpu/instructions,period=2000003/, cpu/cpu-cycles,period=200003/, ...
                              Overhead  Command    Shared Object            Symbol
        92.19%  98.68%   0.00%  93.30%  mgen       mgen                     [.] LOOP1
         3.12%   0.29%   0.00%   0.16%  gsd-color  libglib-2.0.so.0.5600.4  [.] 0x0000000000049515
         1.56%   0.03%   0.00%   0.04%  gsd-color  libglib-2.0.so.0.5600.4  [.] 0x00000000000494b7
         1.56%   0.01%   0.00%   0.00%  gsd-color  libglib-2.0.so.0.5600.4  [.] 0x00000000000494ce
         1.56%   0.00%   0.00%   0.00%  mgen       [kernel.kallsyms]        [k] task_tick_fair
         0.00%   0.15%   0.00%   0.04%  perf       [kernel.kallsyms]        [k] smp_call_function_single
         0.00%   0.13%   0.00%   6.08%  swapper    [kernel.kallsyms]        [k] intel_idle
         0.00%   0.03%   0.00%   0.00%  gsd-color  libglib-2.0.so.0.5600.4  [.] g_main_context_check
         0.00%   0.03%   0.00%   0.00%  swapper    [kernel.kallsyms]        [k] apic_timer_interrupt
         0.00%   0.03%   0.00%   0.00%  swapper    [kernel.kallsyms]        [k] check_preempt_curr
      
      When user press hotkey '3' (event index, starting from 0), it indicates
      to sort output by the forth event in group.
      
        Samples: 12K of events 'cpu/instructions,period=2000003/, cpu/cpu-cycles,period=200003/, ...
                              Overhead  Command    Shared Object            Symbol
        92.19%  98.68%   0.00%  93.30%  mgen       mgen                     [.] LOOP1
         0.00%   0.13%   0.00%   6.08%  swapper    [kernel.kallsyms]        [k] intel_idle
         3.12%   0.29%   0.00%   0.16%  gsd-color  libglib-2.0.so.0.5600.4  [.] 0x0000000000049515
         0.00%   0.00%   0.00%   0.06%  swapper    [kernel.kallsyms]        [k] hrtimer_start_range_ns
         1.56%   0.03%   0.00%   0.04%  gsd-color  libglib-2.0.so.0.5600.4  [.] 0x00000000000494b7
         0.00%   0.15%   0.00%   0.04%  perf       [kernel.kallsyms]        [k] smp_call_function_single
         0.00%   0.00%   0.00%   0.02%  mgen       [kernel.kallsyms]        [k] update_curr
         0.00%   0.00%   0.00%   0.02%  mgen       [kernel.kallsyms]        [k] apic_timer_interrupt
         0.00%   0.00%   0.00%   0.02%  mgen       [kernel.kallsyms]        [k] native_apic_msr_eoi_write
         0.00%   0.00%   0.00%   0.02%  mgen       [kernel.kallsyms]        [k] __update_load_avg_se
      
       v6:
       ---
       Jiri provided a good improvement to eliminate unneeded refresh.
       This improvement is added to v6.
      
       v2:
       ---
       1. Report warning at helpline when index is invalid.
       2. Report warning at helpline when it's not group event.
       3. Use "case '0' ... '9'" to refine the code
       4. Split K_RELOAD implementation to another patch.
      Signed-off-by: NJin Yao <yao.jin@linux.intel.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: Andi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20200220013616.19916-4-yao.jin@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      dbddf174
    • J
      perf report: Support a new key to reload the browser · 5e3b810a
      Jin Yao 提交于
      Sometimes we may need to reload the browser to update the output since
      some options are changed.
      
      This patch creates a new key K_RELOAD. Once the __cmd_report() returns
      K_RELOAD, it would repeat the whole process, such as, read samples from
      data file, sort the data and display in the browser.
      
       v5:
       ---
       1. Fix the 'make NO_SLANG=1' error. Define K_RELOAD in util/hist.h.
       2. Skip setup_sorting() in repeat path if last key is K_RELOAD.
      
       v4:
       ---
       Need to quit in perf_evsel_menu__run if key is K_RELOAD.
      Signed-off-by: NJin Yao <yao.jin@linux.intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20200220013616.19916-3-yao.jin@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5e3b810a
    • J
      perf report/top TUI: Support hotkey 'a' for annotation of unresolved addresses · ec0479a6
      Jin Yao 提交于
      In previous patch, we have supported the annotation functionality even
      without symbols.
      
      For this patch, it supports the hotkey 'a' on address in report view.
      Note that, for branch mode, we only support the annotation for "branch
      to" address.
      Signed-off-by: NJin Yao <yao.jin@linux.intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20200227043939.4403-4-yao.jin@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ec0479a6
    • J
      perf report: Support interactive annotation of code without symbols · 7b0a0dcb
      Jin Yao 提交于
      For perf report on stripped binaries it is currently impossible to do
      annotation. The annotation state is all tied to symbols, but there are
      either no symbols, or symbols are not covering all the code.
      
      We should support the annotation functionality even without symbols.
      
      This patch fakes a symbol and the symbol name is the string of address.
      After that, we just follow current annotation working flow.
      
      For example,
      
      1. perf report
      
        Overhead  Command  Shared Object     Symbol
          20.67%  div      libc-2.27.so      [.] __random_r
          17.29%  div      libc-2.27.so      [.] __random
          10.59%  div      div               [.] 0x0000000000000628
           9.25%  div      div               [.] 0x0000000000000612
           6.11%  div      div               [.] 0x0000000000000645
      
      2. Select the line of "10.59%  div      div               [.] 0x0000000000000628" and ENTER.
      
        Annotate 0x0000000000000628
        Zoom into div thread
        Zoom into div DSO (use the 'k' hotkey to zoom directly into the kernel)
        Browse map details
        Run scripts for samples of symbol [0x0000000000000628]
        Run scripts for all samples
        Switch to another data file in PWD
        Exit
      
      3. Select the "Annotate 0x0000000000000628" and ENTER.
      
      Percent│
             │
             │
             │     Disassembly of section .text:
             │
             │     0000000000000628 <.text+0x68>:
             │       divsd %xmm4,%xmm0
             │       divsd %xmm3,%xmm1
             │       movsd (%rsp),%xmm2
             │       addsd %xmm1,%xmm0
             │       addsd %xmm2,%xmm0
             │       movsd %xmm0,(%rsp)
      
      Now we can see the dump of object starting from 0x628.
      
       v5:
       ---
       Remove the hotkey 'a' implementation from this patch. It
       will be moved to a separate patch.
      
       v4:
       ---
       1. Support the hotkey 'a'. When we press 'a' on address,
          now it supports the annotation.
      
       2. Change the patch title from
          "Support interactive annotation of code without symbols" to
          "perf report: Support interactive annotation of code without symbols"
      
       v3:
       ---
       Keep just the ANNOTATION_DUMMY_LEN, and remove the
       opts->annotate_dummy_len since it's the "maybe in future
       we will provide" feature.
      
       v2:
       ---
       Fix a crash issue when annotating an address in "unknown" object.
      
       The steps to reproduce this issue:
      
       perf record -e cycles:u ls
       perf report
      
          75.29%  ls       ld-2.27.so        [.] do_lookup_x
          23.64%  ls       ld-2.27.so        [.] __GI___tunables_init
           1.04%  ls       [unknown]         [k] 0xffffffff85c01210
           0.03%  ls       ld-2.27.so        [.] _start
      
       When annotating 0xffffffff85c01210, the crash happens.
      
       v2 adds checking for ms->map in add_annotate_opt(). If the object is
       "unknown", ms->map is NULL.
      
      Committer notes:
      
      Renamed new_annotate_sym() to symbol__new_unresolved().
      
      Use PRIx64 to fix this issue in some 32-bit arches:
      
        ui/browsers/hists.c: In function 'symbol__new_unresolved':
        ui/browsers/hists.c:2474:38: error: format '%lx' expects argument of type 'long unsigned int', but argument 5 has type 'u64' {aka 'long long unsigned int'} [-Werror=format=]
          snprintf(name, sizeof(name), "%-#.*lx", BITS_PER_LONG / 4, addr);
                                        ~~~~~~^                      ~~~~
                                        %-#.*llx
      Signed-off-by: NJin Yao <yao.jin@linux.intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: NRavi Bangoria <ravi.bangoria@linux.ibm.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20200227043939.4403-3-yao.jin@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7b0a0dcb
  18. 27 2月, 2020 3 次提交
    • R
      perf annotate: Fix --show-nr-samples for tui/stdio2 · 46ccb442
      Ravi Bangoria 提交于
      perf annotate --show-nr-samples does not really show number of samples.
      
      The reason is we have two separate variables for the same purpose.
      
      One is in symbol_conf.show_nr_samples and another is
      annotation_options.show_nr_samples.
      
      We save command line option in symbol_conf.show_nr_samples but uses
      annotation_option.show_nr_samples while rendering tui/stdio2 browser.
      
      Though, we copy symbol_conf.show_nr_samples to
      annotation__default_options.show_nr_samples but that is not really
      effective as we don't use annotation__default_options once we copy
      default options to dynamic variable annotate.opts in cmd_annotate().
      
      Instead of all these complication, keep only one variable and use it all
      over. symbol_conf.show_nr_samples is used by perf report/top as well. So
      let's kill annotation_options.show_nr_samples.
      
      On a side note, I've kept annotation_options.show_nr_samples definition
      because it's still used by perf-config code. Follow up patch to fix
      perf-config for annotate will remove annotation_options.show_nr_samples.
      Signed-off-by: NRavi Bangoria <ravi.bangoria@linux.ibm.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
      Cc: Changbin Du <changbin.du@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Yisheng Xie <xieyisheng1@huawei.com>
      Link: http://lore.kernel.org/lkml/20200213064306.160480-4-ravi.bangoria@linux.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      46ccb442
    • R
      perf annotate: Fix --show-total-period for tui/stdio2 · 68aac855
      Ravi Bangoria 提交于
      perf annotate --show-total-period does not really show total period.
      
      The reason is we have two separate variables for the same purpose.
      
      One is in symbol_conf.show_total_period and another is
      annotation_options.show_total_period.
      
      We save command line option in symbol_conf.show_total_period but uses
      annotation_option.show_total_period while rendering tui/stdio2 browser.
      
      Though, we copy symbol_conf.show_total_period to
      annotation__default_options.show_total_period but that is not really
      effective as we don't use annotation__default_options once we copy
      default options to dynamic variable annotate.opts in cmd_annotate().
      
      Instead of all these complication, keep only one variable and use it all
      over. symbol_conf.show_total_period is used by perf report/top as well.
      So let's kill annotation_options.show_total_period.
      
      On a side note, I've kept annotation_options.show_total_period
      definition because it's still used by perf-config code. Follow up patch
      to fix perf-config for annotate will remove
      annotation_options.show_total_period.
      Signed-off-by: NRavi Bangoria <ravi.bangoria@linux.ibm.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
      Cc: Changbin Du <changbin.du@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Yisheng Xie <xieyisheng1@huawei.com>
      Link: http://lore.kernel.org/lkml/20200213064306.160480-3-ravi.bangoria@linux.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      68aac855
    • R
      perf annotate/tui: Re-render title bar after switching back from script browser · 54cf752c
      Ravi Bangoria 提交于
      The 'perf annotate' TUI browser provides a 'r' hot key to switch to a
      script browser. But the annotate browser title bar becomes hidden while
      switching back from script browser. Fix it.
      Signed-off-by: NRavi Bangoria <ravi.bangoria@linux.ibm.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
      Cc: Changbin Du <changbin.du@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Yisheng Xie <xieyisheng1@huawei.com>
      Link: http://lore.kernel.org/lkml/20200213064306.160480-2-ravi.bangoria@linux.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      54cf752c
  19. 06 1月, 2020 11 次提交