aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2015-06-20 23:41:16 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-06-22 10:21:11 -0400
commit13d1e536b14ec2d404319a25e681a3287ca084ad (patch)
treecf7cc84f01311c333525b0fda2cad1610a59219d
parenta9a3cd900fbbcbf837d65653105e7bfc583ced09 (diff)
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: Namhyung 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.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/builtin-top.c24
-rw-r--r--tools/perf/ui/browsers/hists.c19
2 files changed, 20 insertions, 23 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 619a8696fda7..ecf319728f25 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -586,27 +586,9 @@ static void *display_thread_tui(void *arg)
586 hists->uid_filter_str = top->record_opts.target.uid_str; 586 hists->uid_filter_str = top->record_opts.target.uid_str;
587 } 587 }
588 588
589 while (true) { 589 perf_evlist__tui_browse_hists(top->evlist, help, &hbt,
590 int key = perf_evlist__tui_browse_hists(top->evlist, help, &hbt, 590 top->min_percent,
591 top->min_percent, 591 &top->session->header.env);
592 &top->session->header.env);
593
594 if (key != 'f')
595 break;
596
597 perf_evlist__toggle_enable(top->evlist);
598 /*
599 * No need to refresh, resort/decay histogram entries
600 * if we are not collecting samples:
601 */
602 if (top->evlist->enabled) {
603 hbt.refresh = top->delay_secs;
604 help = "Press 'f' to disable the events or 'h' to see other hotkeys";
605 } else {
606 help = "Press 'f' again to re-enable the events";
607 hbt.refresh = 0;
608 }
609 }
610 592
611 done = 1; 593 done = 1;
612 return NULL; 594 return NULL;
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index c42adb600091..7629bef2fd79 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1902,8 +1902,23 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
1902 case CTRL('c'): 1902 case CTRL('c'):
1903 goto out_free_stack; 1903 goto out_free_stack;
1904 case 'f': 1904 case 'f':
1905 if (!is_report_browser(hbt)) 1905 if (!is_report_browser(hbt)) {
1906 goto out_free_stack; 1906 struct perf_top *top = hbt->arg;
1907
1908 perf_evlist__toggle_enable(top->evlist);
1909 /*
1910 * No need to refresh, resort/decay histogram
1911 * entries if we are not collecting samples:
1912 */
1913 if (top->evlist->enabled) {
1914 helpline = "Press 'f' to disable the events or 'h' to see other hotkeys";
1915 hbt->refresh = delay_secs;
1916 } else {
1917 helpline = "Press 'f' again to re-enable the events";
1918 hbt->refresh = 0;
1919 }
1920 continue;
1921 }
1907 /* Fall thru */ 1922 /* Fall thru */
1908 default: 1923 default:
1909 helpline = "Press '?' for help on key bindings"; 1924 helpline = "Press '?' for help on key bindings";