diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-03-17 17:27:28 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-03-17 17:27:28 -0400 |
commit | d5dbc518cd8fbc7cf54b91d5b506eb4d67e4047d (patch) | |
tree | b0070205671ea96526194966270b1147fc587382 | |
parent | 4c47f4fcd60a2f4153d6fe0c31650fbec112a1bd (diff) |
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>
-rw-r--r-- | tools/perf/ui/browsers/annotate.c | 8 | ||||
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 23 | ||||
-rw-r--r-- | tools/perf/util/hist.h | 9 |
3 files changed, 26 insertions, 14 deletions
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index 9d32e3c0cfee..e5250eb2dd57 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c | |||
@@ -829,10 +829,16 @@ out: | |||
829 | return key; | 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 | int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel, | 838 | int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel, |
833 | struct hist_browser_timer *hbt) | 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 | static void annotate_browser__mark_jump_targets(struct annotate_browser *browser, | 844 | static void annotate_browser__mark_jump_targets(struct annotate_browser *browser, |
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index c37e70ae0b20..cd7350aeb8e7 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -1704,6 +1704,7 @@ retry_popup_menu: | |||
1704 | if (choice == annotate || choice == annotate_t || choice == annotate_f) { | 1704 | if (choice == annotate || choice == annotate_t || choice == annotate_f) { |
1705 | struct hist_entry *he; | 1705 | struct hist_entry *he; |
1706 | struct annotation *notes; | 1706 | struct annotation *notes; |
1707 | struct map_symbol ms; | ||
1707 | int err; | 1708 | int err; |
1708 | do_annotate: | 1709 | do_annotate: |
1709 | if (!objdump_path && perf_session_env__lookup_objdump(env)) | 1710 | if (!objdump_path && perf_session_env__lookup_objdump(env)) |
@@ -1713,25 +1714,21 @@ do_annotate: | |||
1713 | if (he == NULL) | 1714 | if (he == NULL) |
1714 | continue; | 1715 | continue; |
1715 | 1716 | ||
1716 | /* | ||
1717 | * we stash the branch_info symbol + map into the | ||
1718 | * the ms so we don't have to rewrite all the annotation | ||
1719 | * code to use branch_info. | ||
1720 | * in branch mode, the ms struct is not used | ||
1721 | */ | ||
1722 | if (choice == annotate_f) { | 1717 | if (choice == annotate_f) { |
1723 | he->ms.sym = he->branch_info->from.sym; | 1718 | ms.map = he->branch_info->from.map; |
1724 | he->ms.map = he->branch_info->from.map; | 1719 | ms.sym = he->branch_info->from.sym; |
1725 | } else if (choice == annotate_t) { | 1720 | } else if (choice == annotate_t) { |
1726 | he->ms.sym = he->branch_info->to.sym; | 1721 | ms.map = he->branch_info->to.map; |
1727 | he->ms.map = he->branch_info->to.map; | 1722 | ms.sym = he->branch_info->to.sym; |
1723 | } else { | ||
1724 | ms = *browser->selection; | ||
1728 | } | 1725 | } |
1729 | 1726 | ||
1730 | notes = symbol__annotation(he->ms.sym); | 1727 | notes = symbol__annotation(ms.sym); |
1731 | if (!notes->src) | 1728 | if (!notes->src) |
1732 | continue; | 1729 | continue; |
1733 | 1730 | ||
1734 | err = hist_entry__tui_annotate(he, evsel, hbt); | 1731 | err = map_symbol__tui_annotate(&ms, evsel, hbt); |
1735 | /* | 1732 | /* |
1736 | * offer option to annotate the other branch source or target | 1733 | * offer option to annotate the other branch source or target |
1737 | * (if they exists) when returning from annotate | 1734 | * (if they exists) when returning from annotate |
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index e988c9fcd1bc..9f31b89a527a 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -303,6 +303,9 @@ struct hist_browser_timer { | |||
303 | 303 | ||
304 | #ifdef HAVE_SLANG_SUPPORT | 304 | #ifdef HAVE_SLANG_SUPPORT |
305 | #include "../ui/keysyms.h" | 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 | int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel, | 309 | int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel, |
307 | struct hist_browser_timer *hbt); | 310 | struct hist_browser_timer *hbt); |
308 | 311 | ||
@@ -321,6 +324,12 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused, | |||
321 | { | 324 | { |
322 | return 0; | 325 | return 0; |
323 | } | 326 | } |
327 | static inline int map_symbol__tui_annotate(struct map_symbol *ms __maybe_unused, | ||
328 | struct perf_evsel *evsel __maybe_unused, | ||
329 | struct hist_browser_timer *hbt __maybe_unused) | ||
330 | { | ||
331 | return 0; | ||
332 | } | ||
324 | 333 | ||
325 | static inline int hist_entry__tui_annotate(struct hist_entry *he __maybe_unused, | 334 | static inline int hist_entry__tui_annotate(struct hist_entry *he __maybe_unused, |
326 | struct perf_evsel *evsel __maybe_unused, | 335 | struct perf_evsel *evsel __maybe_unused, |