Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf hists browser: Allow annotating entries in callchains

Instead of annotating just the top level hist_entry, allow instead
annotating a map_symbol, i.e. the top level hist_entry or one of the
callchains for which there were samples.

Suggested-by: Stephane Eranian <eranian@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/n/tip-k1zxj5564je9jei4yd15ouwn@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+26 -14
+7 -1
tools/perf/ui/browsers/annotate.c
··· 829 829 return key; 830 830 } 831 831 832 + int map_symbol__tui_annotate(struct map_symbol *ms, struct perf_evsel *evsel, 833 + struct hist_browser_timer *hbt) 834 + { 835 + return symbol__tui_annotate(ms->sym, ms->map, evsel, hbt); 836 + } 837 + 832 838 int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel, 833 839 struct hist_browser_timer *hbt) 834 840 { 835 - return symbol__tui_annotate(he->ms.sym, he->ms.map, evsel, hbt); 841 + return map_symbol__tui_annotate(&he->ms, evsel, hbt); 836 842 } 837 843 838 844 static void annotate_browser__mark_jump_targets(struct annotate_browser *browser,
+10 -13
tools/perf/ui/browsers/hists.c
··· 1704 1704 if (choice == annotate || choice == annotate_t || choice == annotate_f) { 1705 1705 struct hist_entry *he; 1706 1706 struct annotation *notes; 1707 + struct map_symbol ms; 1707 1708 int err; 1708 1709 do_annotate: 1709 1710 if (!objdump_path && perf_session_env__lookup_objdump(env)) ··· 1714 1713 if (he == NULL) 1715 1714 continue; 1716 1715 1717 - /* 1718 - * we stash the branch_info symbol + map into the 1719 - * the ms so we don't have to rewrite all the annotation 1720 - * code to use branch_info. 1721 - * in branch mode, the ms struct is not used 1722 - */ 1723 1716 if (choice == annotate_f) { 1724 - he->ms.sym = he->branch_info->from.sym; 1725 - he->ms.map = he->branch_info->from.map; 1726 - } else if (choice == annotate_t) { 1727 - he->ms.sym = he->branch_info->to.sym; 1728 - he->ms.map = he->branch_info->to.map; 1717 + ms.map = he->branch_info->from.map; 1718 + ms.sym = he->branch_info->from.sym; 1719 + } else if (choice == annotate_t) { 1720 + ms.map = he->branch_info->to.map; 1721 + ms.sym = he->branch_info->to.sym; 1722 + } else { 1723 + ms = *browser->selection; 1729 1724 } 1730 1725 1731 - notes = symbol__annotation(he->ms.sym); 1726 + notes = symbol__annotation(ms.sym); 1732 1727 if (!notes->src) 1733 1728 continue; 1734 1729 1735 - err = hist_entry__tui_annotate(he, evsel, hbt); 1730 + err = map_symbol__tui_annotate(&ms, evsel, hbt); 1736 1731 /* 1737 1732 * offer option to annotate the other branch source or target 1738 1733 * (if they exists) when returning from annotate
+9
tools/perf/util/hist.h
··· 303 303 304 304 #ifdef HAVE_SLANG_SUPPORT 305 305 #include "../ui/keysyms.h" 306 + int map_symbol__tui_annotate(struct map_symbol *ms, struct perf_evsel *evsel, 307 + struct hist_browser_timer *hbt); 308 + 306 309 int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel, 307 310 struct hist_browser_timer *hbt); 308 311 ··· 321 318 struct hist_browser_timer *hbt __maybe_unused, 322 319 float min_pcnt __maybe_unused, 323 320 struct perf_session_env *env __maybe_unused) 321 + { 322 + return 0; 323 + } 324 + static inline int map_symbol__tui_annotate(struct map_symbol *ms __maybe_unused, 325 + struct perf_evsel *evsel __maybe_unused, 326 + struct hist_browser_timer *hbt __maybe_unused) 324 327 { 325 328 return 0; 326 329 }