From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751457AbbFYH4A (ORCPT ); Thu, 25 Jun 2015 03:56:00 -0400 Received: from terminus.zytor.com ([198.137.202.10]:36312 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751105AbbFYHzx (ORCPT ); Thu, 25 Jun 2015 03:55:53 -0400 Date: Thu, 25 Jun 2015 00:55:14 -0700 From: tip-bot for Namhyung Kim Message-ID: Cc: tglx@linutronix.de, a.p.zijlstra@chello.nl, dsahern@gmail.com, hpa@zytor.com, acme@redhat.com, jolsa@redhat.com, namhyung@kernel.org, linux-kernel@vger.kernel.org, mingo@kernel.org Reply-To: jolsa@redhat.com, namhyung@kernel.org, linux-kernel@vger.kernel.org, mingo@kernel.org, a.p.zijlstra@chello.nl, tglx@linutronix.de, dsahern@gmail.com, hpa@zytor.com, acme@redhat.com In-Reply-To: <1434858076-6533-1-git-send-email-namhyung@kernel.org> References: <1434858076-6533-1-git-send-email-namhyung@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf top: Move toggling event logic into hists browser Git-Commit-ID: 13d1e536b14ec2d404319a25e681a3287ca084ad X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 13d1e536b14ec2d404319a25e681a3287ca084ad Gitweb: http://git.kernel.org/tip/13d1e536b14ec2d404319a25e681a3287ca084ad Author: Namhyung Kim AuthorDate: Sun, 21 Jun 2015 12:41:16 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 22 Jun 2015 11:21:11 -0300 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 Cc: David Ahern Cc: Jiri Olsa Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1434858076-6533-1-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-top.c | 24 +++--------------------- tools/perf/ui/browsers/hists.c | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 619a869..ecf3197 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -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; diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index c42adb6..7629bef 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, 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";