Re: [PATCH v5 4/4] perf report: support hotkey to let user select any event for sorting
From: Jiri Olsa
Date: Thu Dec 19 2019 - 04:10:31 EST
On Thu, Dec 19, 2019 at 02:09:29PM +0800, Jin Yao wrote:
SNIP
> + case '0' ... '9':
> + if (!symbol_conf.event_group ||
> + evsel->core.nr_members < 2) {
> + snprintf(buf, sizeof(buf),
> + "Sort by index only available with group events!");
> + helpline = buf;
> + continue;
> + }
> +
> + symbol_conf.group_sort_idx = key - '0';
> +
> + if (symbol_conf.group_sort_idx >= evsel->core.nr_members) {
> + snprintf(buf, sizeof(buf),
> + "Max event group index to sort is %d (index from 0 to %d)",
> + evsel->core.nr_members - 1,
> + evsel->core.nr_members - 1);
> + helpline = buf;
> + continue;
> + }
> +
> + key = K_RELOAD;
> + goto out_free_stack;
> case 'a':
> if (!hists__has(hists, sym)) {
> ui_browser__warning(&browser->b, delay_secs * 2,
> --
> 2.17.1
>
maybe also something like this to eliminate unneeded refresh?
jirka
---
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 22e76bd1a2d9..9f5dd48500a2 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2947,6 +2947,9 @@ static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events,
continue;
}
+ if (key - '0' == symbol_conf.group_sort_idx)
+ continue;
+
symbol_conf.group_sort_idx = key - '0';
if (symbol_conf.group_sort_idx >= evsel->core.nr_members) {