]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
perf top: Move toggling event logic into hists browser
authorNamhyung Kim <namhyung@kernel.org>
Sun, 21 Jun 2015 03:41:16 +0000 (12:41 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 22 Jun 2015 14:21:11 +0000 (11:21 -0300)
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>
tools/perf/builtin-top.c
tools/perf/ui/browsers/hists.c

index 619a8696fda7c939cd0e6497abab5845813bda12..ecf319728f25d649768e33b3e1f274d04432f3fc 100644 (file)
@@ -586,27 +586,9 @@ static void *display_thread_tui(void *arg)
                hists->uid_filter_str = top->record_opts.target.uid_str;
        }
 
-       while (true)  {
-               int key = perf_evlist__tui_browse_hists(top->evlist, help, &hbt,
-                                                       top->min_percent,
-                                                       &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;
-               }
-       }
+       perf_evlist__tui_browse_hists(top->evlist, help, &hbt,
+                                     top->min_percent,
+                                     &top->session->header.env);
 
        done = 1;
        return NULL;
index c42adb6000914554bf0d109e02d9ad5cec801313..7629bef2fd791b41f64e49da53bc895e62d3dab4 100644 (file)
@@ -1902,8 +1902,23 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
                case CTRL('c'):
                        goto out_free_stack;
                case 'f':
-                       if (!is_report_browser(hbt))
-                               goto out_free_stack;
+                       if (!is_report_browser(hbt)) {
+                               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 */
                default:
                        helpline = "Press '?' for help on key bindings";