03 Nov, 2020

1 commit

  • 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: dbddf1747441 ("perf report/top TUI: Support hotkeys to let user select any event for sorting")
    Signed-off-by: Song Liu
    Acked-by: Jiri Olsa
    Cc: Jin Yao
    Cc: stable@vger.kernel.org # v5.7+
    Link: http://lore.kernel.org/lkml/20201030235431.534417-1-songliubraving@fb.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Song Liu
     

01 Sep, 2020

1 commit

  • 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: bee9ca1c8a237ca1 ("perf report TUI: Remove needless 'dummy' event from menu")
    Cc: Adrian Hunter
    Cc: Ian Rogers
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

09 Jul, 2020

1 commit


06 Jul, 2020

2 commits

  • Fixing the common case of:

    perf record
    perf report

    And getting just the cycles events.

    We now have a 'dummy' event to get perf metadata events that take place
    while we synthesize metadata records for pre-existing processes by
    traversing procfs, so we always have this extra 'dummy' evsel, but we
    don't have to offer it as there will be no samples on it, remove this
    distraction.

    Cc: Adrian Hunter
    Cc: Ian Rogers
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Link: https://lore.kernel.org/lkml/20200706115452.GA2772@redhat.com/
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • The segmentation fault can be reproduced as following steps:

    1) Executing perf report in tui.

    2) Typing '/xxxxx' to filter the symbol to get nothing matched.

    3) Pressing enter with no entry selected.

    Then it will report a segmentation fault.

    It is caused by the lack of check of browser->he_selection when
    accessing it's member res_samples in perf_evsel__hists_browse().

    These processes are meaningful for specified samples, so we can skip
    these when nothing is selected.

    Fixes: 4968ac8fb7c3 ("perf report: Implement browsing of individual samples")
    Signed-off-by: Wei Li
    Acked-by: Jiri Olsa
    Acked-by: Namhyung Kim
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Hanjun Guo
    Cc: Jin Yao
    Cc: Mark Rutland
    Link: http://lore.kernel.org/lkml/20200612094322.39565-1-liwei391@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Wei Li
     

23 Jun, 2020

1 commit

  • The '>' expression itself is bool, no need to convert it to bool again.
    This fixes the following coccicheck warning:

    tools/perf/ui/browsers/annotate.c:212:30-35: WARNING: conversion to bool
    not needed here

    Signed-off-by: Jason Yan
    Cc: Alexander Shishkin
    Cc: Jiri Olsa
    Cc: Mark Rutland
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lore.kernel.org/lkml/20200420123528.11655-1-yanaijie@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Jason Yan
     

06 May, 2020

5 commits


03 Apr, 2020

1 commit

  • In d10ec006dcd7 ("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
    Cc: Jin Yao
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Fixes: d10ec006dcd7 ("perf hists browser: Allow passing an initial hotkey")
    Link: http://lore.kernel.org/lkml/20200330154314.GB4576@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

24 Mar, 2020

5 commits

  • 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: Jin Yao
    Acked-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Kan Liang
    Cc: Peter Zijlstra
    Link: http://lore.kernel.org/lkml/20200220013616.19916-4-yao.jin@linux.intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    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: Jin Yao
    Tested-by: Arnaldo Carvalho de Melo
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Kan Liang
    Cc: Peter Zijlstra
    Link: http://lore.kernel.org/lkml/20200220013616.19916-3-yao.jin@linux.intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Jin Yao
     
  • When performing "perf report --group", it shows the event group
    information together. By default, the output is sorted by the first
    event in group.

    It would be nice for user to select any event for sorting. This patch
    introduces a new option "--group-sort-idx" to sort the output by the
    event at the index n in event group.

    For example,

    Before:

    # perf report --group --stdio

    # To display the perf.data header info, please use --header/--header-only options.
    #
    #
    # Total Lost Samples: 0
    #
    # Samples: 12K of events 'cpu/instructions,period=2000003/, cpu/cpu-cycles,period=200003/, BR_MISP_RETIRED.ALL_BRANCHES:pp, cpu/event=0xc0,umask=1,cmask=1,
    # Event count (approx.): 6451235635
    #
    # 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
    ...

    After:

    # perf report --group --stdio --group-sort-idx 3

    # To display the perf.data header info, please use --header/--header-only options.
    #
    #
    # Total Lost Samples: 0
    #
    # Samples: 12K of events 'cpu/instructions,period=2000003/, cpu/cpu-cycles,period=200003/, BR_MISP_RETIRED.ALL_BRANCHES:pp, cpu/event=0xc0,umask=1,cmask=1,
    # Event count (approx.): 6451235635
    #
    # 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
    0.00% 0.00% 0.00% 0.02% mgen [kernel.kallsyms] [k] scheduler_tick

    Now the output is sorted by the fourth event in group.

    v7:
    ---
    Rebase to latest perf/core, no other change.

    v4:
    ---
    1. Update Documentation/perf-report.txt to mention
    '--group-sort-idx' support multiple groups with different
    amount of events and it should be used on grouped events.

    2. Update __hpp__group_sort_idx(), just return when the
    idx is out of limit.

    3. Return failure on symbol_conf.group_sort_idx && !session->evlist->nr_groups.
    So now we don't need to use together with --group.

    v3:
    ---
    Refine the code in __hpp__group_sort_idx().

    Before:
    for (i = 1; i < nr_members; i++) {
    if (i == idx) {
    ret = field_cmp(fields_a[i], fields_b[i]);
    if (ret)
    goto out;
    }
    }

    After:
    if (idx >= 1 && idx < nr_members) {
    ret = field_cmp(fields_a[idx], fields_b[idx]);
    if (ret)
    goto out;
    }

    Signed-off-by: Jin Yao
    Tested-by: Arnaldo Carvalho de Melo
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Kan Liang
    Cc: Peter Zijlstra
    Link: http://lore.kernel.org/lkml/20200220013616.19916-2-yao.jin@linux.intel.com
    [ Renamed pair_fields_alloc() to hist_entry__new_pair() and combined decl + assignment of vars ]
    Signed-off-by: Arnaldo Carvalho de Melo

    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: Jin Yao
    Tested-by: Arnaldo Carvalho de Melo
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Kan Liang
    Cc: Peter Zijlstra
    Link: http://lore.kernel.org/lkml/20200227043939.4403-4-yao.jin@linux.intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    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 :
    │ 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: Jin Yao
    Tested-by: Arnaldo Carvalho de Melo
    Tested-by: Ravi Bangoria
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Kan Liang
    Cc: Peter Zijlstra
    Link: http://lore.kernel.org/lkml/20200227043939.4403-3-yao.jin@linux.intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Jin Yao
     

27 Feb, 2020

4 commits

  • privsize is passed as 0 from all the symbol__annotate() callers.
    Remove it from argument list.

    Signed-off-by: Ravi Bangoria
    Acked-by: Jiri Olsa
    Cc: Ian Rogers
    Cc: Jin Yao
    Cc: Namhyung Kim
    Cc: Song Liu
    Link: http://lore.kernel.org/lkml/20200204045233.474937-2-ravi.bangoria@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    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: Ravi Bangoria
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Adrian Hunter
    Cc: Alexey Budankov
    Cc: Changbin Du
    Cc: Ian Rogers
    Cc: Jin Yao
    Cc: Jiri Olsa
    Cc: Leo Yan
    Cc: Namhyung Kim
    Cc: Song Liu
    Cc: Taeung Song
    Cc: Thomas Richter
    Cc: Yisheng Xie
    Link: http://lore.kernel.org/lkml/20200213064306.160480-4-ravi.bangoria@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    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: Ravi Bangoria
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Adrian Hunter
    Cc: Alexey Budankov
    Cc: Changbin Du
    Cc: Ian Rogers
    Cc: Jin Yao
    Cc: Jiri Olsa
    Cc: Leo Yan
    Cc: Namhyung Kim
    Cc: Song Liu
    Cc: Taeung Song
    Cc: Thomas Richter
    Cc: Yisheng Xie
    Link: http://lore.kernel.org/lkml/20200213064306.160480-3-ravi.bangoria@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    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: Ravi Bangoria
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Adrian Hunter
    Cc: Alexey Budankov
    Cc: Changbin Du
    Cc: Ian Rogers
    Cc: Jin Yao
    Cc: Jiri Olsa
    Cc: Leo Yan
    Cc: Namhyung Kim
    Cc: Song Liu
    Cc: Taeung Song
    Cc: Thomas Richter
    Cc: Yisheng Xie
    Link: http://lore.kernel.org/lkml/20200213064306.160480-2-ravi.bangoria@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ravi Bangoria
     

14 Jan, 2020

2 commits

  • Ravi Bangoria reported an issue when doing the gtk2 feature detection on
    Fedora 31, where some types got deprecated:

    /usr/include/gtk-2.0/gtk/gtktypeutils.h:236:1: error: ‘GTypeDebugFlags’ is deprecated [-Werror=deprecated-declarations]
    236 | void gtk_type_init (GTypeDebugFlags debug_flags);

    Fix this for perf by allowing the compile to pass with deprecated
    symbols via the -Wno-deprecated-declarations compiler directive.

    Reported-by: Ravi Bangoria
    Signed-off-by: Jiri Olsa
    Tested-by: Ravi Bangoria
    Cc: Alexander Shishkin
    Cc: Jelle van der Waa
    Cc: Michael Petlan
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lore.kernel.org/lkml/20200113104358.123511-2-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • When we moved zalloc.o to the library we missed gtk library which needs
    it compiled in, otherwise the missing __zfree symbol will cause the
    library to fail to load.

    Adding the zalloc object to the gtk library build.

    Fixes: 7f7c536f23e6 ("tools lib: Adopt zalloc()/zfree() from tools/perf")
    Signed-off-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Jelle van der Waa
    Cc: Michael Petlan
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lore.kernel.org/lkml/20200113104358.123511-1-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

06 Jan, 2020

11 commits

  • The 'e' and 'c' hotkeys were present for a long time, but not documented
    in the help window, change 'e' to be a toggle so that it gets consistent
    with other toggles like '+' and document it in the help window.

    Keep 'c' as is for people used to it but don't document, as it is easier
    to just use 'e' to show/hide all the callchains for a top level
    histogram entry.

    Reviewed-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: Jin Yao
    Cc: Kan Liang
    Cc: Linus Torvalds
    Cc: Namhyung Kim
    Link: https://lkml.kernel.org/n/tip-pmyi5x34stlqmyu81rci94x9@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • This can happen in the --children mode, i.e. the default mode when
    callchains are present, where one of the main entries may be a callchain
    entry with no samples.

    So far we were not providing any information about why an annotation
    couldn't be provided even offering the Annotation option in the popup
    menu.

    Work is needed to allow for no-samples "annotation', i.e. to show the
    disassembly anyway and allow for navigation, etc.

    Reviewed-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: Jin Yao
    Cc: Kan Liang
    Cc: Linus Torvalds
    Cc: Namhyung Kim
    Link: https://lkml.kernel.org/n/tip-0hhzj2de15o88cguy7h66zre@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • When the users presses ENTER in the main 'perf report/top' screen a
    popup menu is presented, in it some hotkeys are suggested as
    alternatives to using the menu, or for additional features.

    At that point the user may try those hotkeys, so allow for that by
    recording the key used and exiting, the caller then can check for that
    possibility and process the hotkey.

    I.e. try pressing ENTER, and then 'k' to exit and zoom into the kernel
    map, using ESC then zooms out, etc.

    Reviewed-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: Jin Yao
    Cc: Kan Liang
    Cc: Linus Torvalds
    Cc: Namhyung Kim
    Link: https://lkml.kernel.org/n/tip-ujfq3fw44kf6qrtfajl5dcsp@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • With this patch if an optional pointer is passed to ui__popup_menu()
    then when any key that is not being handled (ENTER, ESC, etc) is typed,
    it'll record that key in the pointer and return, allowing for hotkey
    processing on the caller.

    If NULL is passed, no change in logic, unhandled keys continue to be
    ignored.

    Reviewed-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: Jin Yao
    Cc: Kan Liang
    Cc: Linus Torvalds
    Cc: Namhyung Kim
    Link: https://lkml.kernel.org/n/tip-6ojn19mqzgmrdm8kdoigic0m@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Sometimes we're in an outer code, like the main hists browser popup menu
    and the user follows a suggestion about using some hotkey, and that
    hotkey is really handled by hists_browser__run(), so allow for calling
    it with that hotkey, making it handle it instead of waiting for the user
    to press one.

    Reviewed-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: Jin Yao
    Cc: Kan Liang
    Cc: Linus Torvalds
    Cc: Namhyung Kim
    Link: https://lkml.kernel.org/n/tip-xv2l7i6o4urn37nv1h40ryfs@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • As a convenience, equivalent to pressing Enter in a line with a kernel
    symbol and then selecting "Zoom" into the kernel DSO.

    Reviewed-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: Jin Yao
    Cc: Kan Liang
    Cc: Linus Torvalds
    Cc: Namhyung Kim
    Link: https://lkml.kernel.org/n/tip-vbnlnrpyfvz9deqoobtc3dz7@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • We'll use it to provide a top level hotkey to zoom into the kernel dso
    directly.

    Reviewed-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: Jin Yao
    Cc: Kan Liang
    Cc: Linus Torvalds
    Cc: Namhyung Kim
    Link: https://lkml.kernel.org/n/tip-ae9cjel6v05wjnz9r6z77b6x@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Taking into account the current status of the callchain, i.e. if folded,
    show "Expand", otherwise "Collapse", also show the name of the entry
    that will be affected and mention the hotkeys for expanding/collapsing
    all callchains below the main entry, the one that appears with/without
    callchains.

    Reviewed-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: Jin Yao
    Cc: Kan Liang
    Cc: Linus Torvalds
    Cc: Namhyung Kim
    Link: https://lkml.kernel.org/n/tip-03arm6poo8463k5tfcfp7gkk@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Since previously pressing ENTER toggled expansion/collapse of callchain
    entries and now brings up the same menu used when callchains are not
    present, add an entry so that users can quickly figure out the change in
    behaviour.

    Its worth mentioning that we also always had 'e'/'c' to expand/collapse
    all entries in a hist entry and 'E'/'C' for all hist entries.

    Suggested-by: Linus Torvalds
    Reviewed-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: Jin Yao
    Cc: Kan Liang
    Cc: Namhyung Kim
    Link: https://lkml.kernel.org/n/tip-f9o03jo29fypvd8ly3j49d36@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • When callchains are present the ENTER key switches from bringing up the
    menu that offers Annotation, Zoom by DSO, etc to expanding/collapsing
    one callchain level, causing confusion, fix it by making it consistently
    bring up the menu and use '+' to expand/collapse one callchain level.

    Next patch will also add an entry to the menu to allow
    expanding/collapsing, so that people used to ENTER expanding one
    callchain level can quickly find it and use it instead.

    Reported-by: Linus Torvalds
    Reviewed-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: Jin Yao
    Cc: Kan Liang
    Cc: Namhyung Kim
    Link: https://lkml.kernel.org/n/tip-bjz35omktig8cwn6lbj1ifns@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • We need to set actions->ms.map since 599a2f38a989 ("perf hists browser:
    Check sort keys before hot key actions"), as in that patch we bail out
    if map is NULL.

    Reviewed-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: Namhyung Kim
    Fixes: 599a2f38a989 ("perf hists browser: Check sort keys before hot key actions")
    Link: https://lkml.kernel.org/n/tip-wp1ssoewy6zihwwexqpohv0j@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

26 Nov, 2019

4 commits

  • One more step in the merge of 'struct maps' with 'struct map_groups'.

    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Link: https://lkml.kernel.org/n/tip-9ibtn3vua76f934t7woyf26w@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • One more step on the merge of 'struct maps' with 'struct map_groups'.

    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Link: https://lkml.kernel.org/n/tip-61rra2wg392rhvdgw421wzpt@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • One more step on the merge of 'struct maps' with 'struct map_groups'.

    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Link: https://lkml.kernel.org/n/tip-69vcr8pubpym90skxhmbwhiw@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • And pick the shortest name: 'struct maps'.

    The split existed because we used to have two groups of maps, one for
    functions and one for variables, but that only complicated things,
    sometimes we needed to figure out what was at some address and then had
    to first try it on the functions group and if that failed, fall back to
    the variables one.

    That split is long gone, so for quite a while we had only one struct
    maps per struct map_groups, simplify things by combining those structs.

    First patch is the minimum needed to merge both, follow up patches will
    rename 'thread->mg' to 'thread->maps', etc.

    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Link: https://lkml.kernel.org/n/tip-hom6639ro7020o708trhxh59@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

20 Nov, 2019

2 commits

  • This patch supports jumping from tui total cycles view to symbol source
    view.

    For example,

    perf record -b ./div
    perf report --total-cycles

    In total cycles view, we can select one entry and press 'a' or press
    ENTER key to jump to symbol source view.

    This patch also sets sort_order to NULL in cmd_report() which will use
    the default branch sort order. The percent value in new annotate view
    will be consistent with the percent in annotate view switched from perf
    report (we observed the original percent gap with previous patches).

    v2:
    ---
    Fix the 'make NO_SLANG=1' error. (set __maybe_unused to
    annotation_opts in block_hists_tui_browse()).

    Signed-off-by: Jin Yao
    Acked-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Jin Yao
    Cc: Kan Liang
    Cc: Peter Zijlstra
    Link: http://lore.kernel.org/lkml/20191118140849.20714-2-yao.jin@linux.intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Jin Yao
     
  • It would be nice if we could jump to the assembler/source view (like the
    normal perf report) from total cycles view.

    This patch moves the block_hists_tui_browse from block-info.c to
    ui/browsers/hists.c in order to reuse some browser codes (i.e
    do_annotate) for implementing new annotation view.

    v2:
    ---
    Fix the 'make NO_SLANG=1' error. (Change 'int block_hists_tui_browse()'
    to 'static inline int block_hists_tui_browse()')

    Signed-off-by: Jin Yao
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Jin Yao
    Cc: Kan Liang
    Cc: Peter Zijlstra
    Link: http://lore.kernel.org/lkml/20191118140849.20714-1-yao.jin@linux.intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Jin Yao