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 - 07:43:32 EST


On Thu, Dec 19, 2019 at 08:38:39PM +0800, Jin, Yao wrote:
>
>
> On 12/19/2019 5:10 PM, Jiri Olsa wrote:
> > 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) {
> >
>
> Hi Jiri,
>
> Thanks, I think it's a good improvement. It can avoid the unnecessary
> refresh.
>
> If no more comments on this patch-set, I will add this improvement and then
> post v6.

sure, I don't have any more comments

jirka