1. 23 6月, 2020 1 次提交
  2. 06 5月, 2020 3 次提交
  3. 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
  4. 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
  5. 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
  6. 06 1月, 2020 11 次提交
  7. 26 11月, 2019 1 次提交
  8. 20 11月, 2019 2 次提交
  9. 12 11月, 2019 3 次提交
  10. 07 11月, 2019 1 次提交
    • J
      perf report: Sort by sampled cycles percent per block for tui · 7fa46cbf
      Jin Yao 提交于
      Previous patch has implemented a new option "--total-cycles".  But only
      stdio mode is supported.
      
      This patch supports the tui mode and support '--percent-limit'.
      
      For example,
      
       perf record -b ./div
       perf report --total-cycles --percent-limit 1
      
       # Samples: 2753248 of event 'cycles'
       Sampled Cycles%  Sampled Cycles  Avg Cycles%  Avg Cycles                                              [Program Block Range]         Shared Object
                26.04%            2.8M        0.40%          18                                             [div.c:42 -> div.c:39]                   div
                15.17%            1.2M        0.16%           7                                 [random_r.c:357 -> random_r.c:380]          libc-2.27.so
                 5.11%          402.0K        0.04%           2                                             [div.c:27 -> div.c:28]                   div
                 4.87%          381.6K        0.04%           2                                     [random.c:288 -> random.c:291]          libc-2.27.so
                 4.53%          381.0K        0.04%           2                                             [div.c:40 -> div.c:40]                   div
                 3.85%          300.9K        0.02%           1                                             [div.c:22 -> div.c:25]                   div
                 3.08%          241.1K        0.02%           1                                           [rand.c:26 -> rand.c:27]          libc-2.27.so
                 3.06%          240.0K        0.02%           1                                     [random.c:291 -> random.c:291]          libc-2.27.so
                 2.78%          215.7K        0.02%           1                                     [random.c:298 -> random.c:298]          libc-2.27.so
                 2.52%          198.3K        0.02%           1                                     [random.c:293 -> random.c:293]          libc-2.27.so
                 2.36%          184.8K        0.02%           1                                           [rand.c:28 -> rand.c:28]          libc-2.27.so
                 2.33%          180.5K        0.02%           1                                     [random.c:295 -> random.c:295]          libc-2.27.so
                 2.28%          176.7K        0.02%           1                                     [random.c:295 -> random.c:295]          libc-2.27.so
                 2.20%          168.8K        0.02%           1                                         [rand@plt+0 -> rand@plt+0]                   div
                 1.98%          158.2K        0.02%           1                                 [random_r.c:388 -> random_r.c:388]          libc-2.27.so
                 1.57%          123.3K        0.02%           1                                             [div.c:42 -> div.c:44]                   div
                 1.44%          116.0K        0.42%          19                                 [random_r.c:357 -> random_r.c:394]          libc-2.27.so
      
      --------------------------------------------------
      
       v7:
       ---
       1. Since we have used use_browser in report__browse_block_hists
          to support stdio mode, now we also add supporting for tui.
      
       2. Move block tui browser code from ui/browsers/hists.c
          to block-info.c.
      
       v6:
       ---
       Create report__tui_browse_block_hists in block-info.c
       (codes are moved from builtin-report.c).
      
       v5:
       ---
       Fix a crash issue when running perf report without
       '--total-cycles'. The issue is because the internal flag
       is renamed from 'total_cycles' to 'total_cycles_mode' in
       previous patch but this patch still uses 'total_cycles'
       to check if the '--total-cycles' option is enabled, which
       causes the code to be inconsistent.
      
       v4:
       ---
       Since the block collection is moved out of printing in
       previous patch, this patch is updated accordingly for
       tui supporting.
      
       v3:
       ---
       Minor change since the function name is changed:
       block_total_cycles_percent -> block_info__total_cycles_percent
      Signed-off-by: NJin Yao <yao.jin@linux.intel.com>
      Reviewed-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: Jin Yao <yao.jin@intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20191107074719.26139-8-yao.jin@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7fa46cbf
  11. 25 9月, 2019 1 次提交
  12. 20 9月, 2019 3 次提交
  13. 01 9月, 2019 6 次提交