summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2024-04-10 20:32:55 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2024-04-12 12:02:06 -0300
commit0bfbe661a21f7c77a22eb978e0de3b672041e502 (patch)
tree1fb6ab132f536115364d8f0f66d2a2606260c4d2 /tools
parent2b08f219d592d5b3d17db9a3850a9d793e6c9d83 (diff)
downloadlinux-stable-0bfbe661a21f7c77a22eb978e0de3b672041e502.tar.gz
linux-stable-0bfbe661a21f7c77a22eb978e0de3b672041e502.tar.bz2
linux-stable-0bfbe661a21f7c77a22eb978e0de3b672041e502.zip
perf report: Add a menu item to annotate data type in TUI
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`. Reviewed-by: Ian Rogers <irogers@google.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20240411033256.2099646-7-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-report.c5
-rw-r--r--tools/perf/ui/browsers/hists.c31
2 files changed, 36 insertions, 0 deletions
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 @@ repeat:
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"
@@ -2506,6 +2507,32 @@ add_annotate_opt(struct hist_browser *browser __maybe_unused,
}
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)
{
struct thread *thread = act->thread;
@@ -3307,6 +3334,10 @@ do_hotkey: // key came straight from options ui__popup_menu()
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],