Skip to content

Commit d5a599d

Browse files
committed
perf report/top: Add menu entry for toggling callchain expansion
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 <torvalds@linux-foundation.org> Reviewed-by: Jiri Olsa <jolsa@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Jin Yao <yao.jin@linux.intel.com> Cc: Kan Liang <kan.liang@intel.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lkml.kernel.org/n/tip-f9o03jo29fypvd8ly3j49d36@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 9218a91 commit d5a599d

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

‎tools/perf/ui/browsers/hists.c‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2527,6 +2527,26 @@ add_dso_opt(struct hist_browser *browser, struct popup_action *act,
25272527
return 1;
25282528
}
25292529

2530+
static int do_toggle_callchain(struct hist_browser *browser, struct popup_action *act __maybe_unused)
2531+
{
2532+
hist_browser__toggle_fold(browser);
2533+
return 0;
2534+
}
2535+
2536+
static int add_callchain_toggle_opt(struct hist_browser *browser, struct popup_action *act, char **optstr)
2537+
{
2538+
struct hist_entry *he = browser->he_selection;
2539+
2540+
if (!he->has_children)
2541+
return 0;
2542+
2543+
if (asprintf(optstr, "Expand/Collapse callchain") < 0)
2544+
return 0;
2545+
2546+
act->fn = do_toggle_callchain;
2547+
return 1;
2548+
}
2549+
25302550
static int
25312551
do_browse_map(struct hist_browser *browser __maybe_unused,
25322552
struct popup_action *act)
@@ -3137,6 +3157,7 @@ static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events,
31373157
&options[nr_options], thread);
31383158
nr_options += add_dso_opt(browser, &actions[nr_options],
31393159
&options[nr_options], map);
3160+
nr_options += add_callchain_toggle_opt(browser, &actions[nr_options], &options[nr_options]);
31403161
nr_options += add_map_opt(browser, &actions[nr_options],
31413162
&options[nr_options],
31423163
browser->selection ?

0 commit comments

Comments
 (0)