From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ian Rogers <irogers@google.com>,
Kan Liang <kan.liang@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 5/6] perf report: Add a menu item to annotate data type in TUI
Date: Wed, 10 Apr 2024 17:46:04 -0300 [thread overview]
Message-ID: <Zhb6jJneP36Z-or0@x1> (raw)
In-Reply-To: <20240409235000.1893969-6-namhyung@kernel.org>
On Tue, Apr 09, 2024 at 04:49:59PM -0700, Namhyung Kim wrote:
> When the hist entry has the type info, it should be able to display the
> annotation browser for the type like in `perf annotate --data-type`.
Trying to test this with:
root@number:~# perf report --header-only |& grep "perf record"
# cmdline : /home/acme/bin/perf record -a -e {cpu_core/mem-loads,ldlat=30/P,cpu_core/mem-stores/P}
root@number:~# perf evlist -v
cpu_core/mem-loads,ldlat=30/P: type: 4 (cpu_core), size: 136, config: 0x1cd (mem-loads), { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|CPU|PERIOD|IDENTIFIER, read_format: ID|LOST, disabled: 1, inherit: 1, freq: 1, precise_ip: 2, sample_id_all: 1, { bp_addr, config1 }: 0x1f
cpu_core/mem-stores/P: type: 4 (cpu_core), size: 136, config: 0x2cd (mem-stores), { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|CPU|PERIOD|IDENTIFIER, read_format: ID|LOST, inherit: 1, freq: 1, precise_ip: 3, sample_id_all: 1
dummy:u: type: 1 (software), size: 136, config: 0x9 (PERF_COUNT_SW_DUMMY), { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CPU|IDENTIFIER, read_format: ID|LOST, inherit: 1, exclude_kernel: 1, exclude_hv: 1, mmap: 1, comm: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1, ksymbol: 1, bpf_event: 1
root@number:~# perf report -s type
And when I press ESC to exit:
root@number:~# perf report -s type
perf: Segmentation fault
-------- backtrace --------
perf[0x61326b]
/lib64/libc.so.6(+0x3e9a0)[0x7f7173a5c9a0]
/lib64/libc.so.6(free+0x25)[0x7f7173abd385]
perf[0x5d5002]
perf[0x4fd007]
perf[0x523ce0]
perf[0x525ad4]
perf[0x503f43]
perf[0x557ad4]
perf[0x557eeb]
perf[0x4e5355]
perf[0x4dea42]
perf[0x528aad]
perf[0x42b559]
perf[0x4c39e9]
perf[0x4c3cf9]
perf[0x410e47]
/lib64/libc.so.6(+0x2814a)[0x7f7173a4614a]
/lib64/libc.so.6(__libc_start_main+0x8b)[0x7f7173a4620b]
perf[0x4113e5]
root@number:~#
Trying to build with debug info...
- Arnaldo
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/perf/builtin-report.c | 5 +++++
> tools/perf/ui/browsers/hists.c | 31 +++++++++++++++++++++++++++++++
> 2 files changed, 36 insertions(+)
>
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index dcd93ee5fc24..aaa6427a1224 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -1694,6 +1694,11 @@ int cmd_report(int argc, const char **argv)
> else
> use_browser = 0;
>
> + if (report.data_type && use_browser == 1) {
> + symbol_conf.annotate_data_member = true;
> + symbol_conf.annotate_data_sample = true;
> + }
> +
> if (sort_order && strstr(sort_order, "ipc")) {
> parse_options_usage(report_usage, options, "s", 1);
> goto error;
> diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
> index 0c02b3a8e121..71b32591d61a 100644
> --- a/tools/perf/ui/browsers/hists.c
> +++ b/tools/perf/ui/browsers/hists.c
> @@ -38,6 +38,7 @@
> #include "../ui.h"
> #include "map.h"
> #include "annotate.h"
> +#include "annotate-data.h"
> #include "srcline.h"
> #include "string2.h"
> #include "units.h"
> @@ -2505,6 +2506,32 @@ add_annotate_opt(struct hist_browser *browser __maybe_unused,
> return 1;
> }
>
> +static int
> +do_annotate_type(struct hist_browser *browser, struct popup_action *act)
> +{
> + struct hist_entry *he = browser->he_selection;
> +
> + hist_entry__annotate_data_tui(he, act->evsel, browser->hbt);
> + ui_browser__handle_resize(&browser->b);
> + return 0;
> +}
> +
> +static int
> +add_annotate_type_opt(struct hist_browser *browser,
> + struct popup_action *act, char **optstr,
> + struct hist_entry *he)
> +{
> + if (he == NULL || he->mem_type == NULL || he->mem_type->histograms == NULL)
> + return 0;
> +
> + if (asprintf(optstr, "Annotate type %s", he->mem_type->self.type_name) < 0)
> + return 0;
> +
> + act->evsel = hists_to_evsel(browser->hists);
> + act->fn = do_annotate_type;
> + return 1;
> +}
> +
> static int
> do_zoom_thread(struct hist_browser *browser, struct popup_action *act)
> {
> @@ -3307,6 +3334,10 @@ static int evsel__hists_browse(struct evsel *evsel, int nr_events, const char *h
> browser->he_selection->ip);
> }
> skip_annotation:
> + nr_options += add_annotate_type_opt(browser,
> + &actions[nr_options],
> + &options[nr_options],
> + browser->he_selection);
> nr_options += add_thread_opt(browser, &actions[nr_options],
> &options[nr_options], thread);
> nr_options += add_dso_opt(browser, &actions[nr_options],
> --
> 2.44.0.478.gd926399ef9-goog
next prev parent reply other threads:[~2024-04-10 20:46 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-09 23:49 [PATCHSET 0/6] perf annotate: Add TUI support for data type profiling (v1) Namhyung Kim
2024-04-09 23:49 ` [PATCH 1/6] perf annotate: Show progress of sample processing Namhyung Kim
2024-04-09 23:49 ` [PATCH 2/6] perf annotate-data: Add hist_entry__annotate_data_tty() Namhyung Kim
2024-04-09 23:49 ` [PATCH 3/6] perf annotate-data: Add hist_entry__annotate_data_tui() Namhyung Kim
2024-04-10 20:21 ` Arnaldo Carvalho de Melo
2024-04-10 21:04 ` Arnaldo Carvalho de Melo
2024-04-10 21:05 ` Arnaldo Carvalho de Melo
2024-04-10 21:12 ` Arnaldo Carvalho de Melo
2024-04-10 21:17 ` Arnaldo Carvalho de Melo
2024-04-10 21:20 ` Arnaldo Carvalho de Melo
2024-04-10 21:32 ` Arnaldo Carvalho de Melo
2024-04-10 23:49 ` Namhyung Kim
2024-04-09 23:49 ` [PATCH 4/6] perf annotate-data: Support event group display in TUI Namhyung Kim
2024-04-10 19:52 ` Arnaldo Carvalho de Melo
2024-04-10 20:24 ` Arnaldo Carvalho de Melo
2024-04-10 20:38 ` Arnaldo Carvalho de Melo
2024-04-09 23:49 ` [PATCH 5/6] perf report: Add a menu item to annotate data type " Namhyung Kim
2024-04-10 20:46 ` Arnaldo Carvalho de Melo [this message]
2024-04-10 20:50 ` Arnaldo Carvalho de Melo
2024-04-11 0:30 ` Namhyung Kim
2024-04-09 23:50 ` [PATCH 6/6] perf report: Do not collect sample histogram unnecessarily Namhyung Kim
2024-04-10 16:29 ` [PATCHSET 0/6] perf annotate: Add TUI support for data type profiling (v1) Ian Rogers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zhb6jJneP36Z-or0@x1 \
--to=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).