Commit 13d1e536 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

perf top: Move toggling event logic into hists browser

Current 'f' key action to enable/disable events won't work if there're
more than one event since perf_evsel_menu__run() doesn't return the key.
So move it to the hists browser loop so that it can be processed as like
other key action, and it's more natural to handle it there IMHO.
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1434858076-6533-1-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent a9a3cd90
...@@ -586,27 +586,9 @@ static void *display_thread_tui(void *arg) ...@@ -586,27 +586,9 @@ static void *display_thread_tui(void *arg)
hists->uid_filter_str = top->record_opts.target.uid_str; hists->uid_filter_str = top->record_opts.target.uid_str;
} }
while (true) { perf_evlist__tui_browse_hists(top->evlist, help, &hbt,
int key = perf_evlist__tui_browse_hists(top->evlist, help, &hbt, top->min_percent,
top->min_percent, &top->session->header.env);
&top->session->header.env);
if (key != 'f')
break;
perf_evlist__toggle_enable(top->evlist);
/*
* No need to refresh, resort/decay histogram entries
* if we are not collecting samples:
*/
if (top->evlist->enabled) {
hbt.refresh = top->delay_secs;
help = "Press 'f' to disable the events or 'h' to see other hotkeys";
} else {
help = "Press 'f' again to re-enable the events";
hbt.refresh = 0;
}
}
done = 1; done = 1;
return NULL; return NULL;
......
...@@ -1902,8 +1902,23 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, ...@@ -1902,8 +1902,23 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
case CTRL('c'): case CTRL('c'):
goto out_free_stack; goto out_free_stack;
case 'f': case 'f':
if (!is_report_browser(hbt)) if (!is_report_browser(hbt)) {
goto out_free_stack; struct perf_top *top = hbt->arg;
perf_evlist__toggle_enable(top->evlist);
/*
* No need to refresh, resort/decay histogram
* entries if we are not collecting samples:
*/
if (top->evlist->enabled) {
helpline = "Press 'f' to disable the events or 'h' to see other hotkeys";
hbt->refresh = delay_secs;
} else {
helpline = "Press 'f' again to re-enable the events";
hbt->refresh = 0;
}
continue;
}
/* Fall thru */ /* Fall thru */
default: default:
helpline = "Press '?' for help on key bindings"; helpline = "Press '?' for help on key bindings";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment