From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757273AbbE2Sjk (ORCPT ); Fri, 29 May 2015 14:39:40 -0400 Received: from terminus.zytor.com ([198.137.202.10]:35260 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757239AbbE2SjT (ORCPT ); Fri, 29 May 2015 14:39:19 -0400 Date: Fri, 29 May 2015 11:39:02 -0700 From: tip-bot for Namhyung Kim Message-ID: Cc: hpa@zytor.com, dsahern@gmail.com, mingo@kernel.org, acme@redhat.com, tglx@linutronix.de, a.p.zijlstra@chello.nl, jolsa@redhat.com, linux-kernel@vger.kernel.org, namhyung@kernel.org Reply-To: dsahern@gmail.com, hpa@zytor.com, mingo@kernel.org, tglx@linutronix.de, acme@redhat.com, a.p.zijlstra@chello.nl, jolsa@redhat.com, namhyung@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <1432904024-13170-1-git-send-email-namhyung@kernel.org> References: <1432904024-13170-1-git-send-email-namhyung@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf tools: Make Ctrl-C stop processing on TUI Git-Commit-ID: ed426915900db3c58c410b8b38f6ff0e46bf6c96 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: ed426915900db3c58c410b8b38f6ff0e46bf6c96 Gitweb: http://git.kernel.org/tip/ed426915900db3c58c410b8b38f6ff0e46bf6c96 Author: Namhyung Kim AuthorDate: Fri, 29 May 2015 21:53:44 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 29 May 2015 12:49:00 -0300 perf tools: Make Ctrl-C stop processing on TUI It was inconvenient that perf cannot be quit with SIGINT during processing samples on TUI especially for large data files. This was because the first argument of SLang_init_tty(), abort_char, being 0. The manual says it's the ascii value of the control character that will be used to generate the interrupt signal [1]. Passing -1 means to use the default value (Ctrl-C). However, after processing samples, Ctrl-C was used to in other cases as well - like stepping back from annotate. So recover the original behavior after processing. [1] http://jedsoft.org/slang/doc/html/cslang-6.html#ss6.1 Signed-off-by: Namhyung Kim Tested-by: Arnaldo Carvalho de Melo Cc: David Ahern Cc: Jiri Olsa Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1432904024-13170-1-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/ui/browsers/annotate.c | 4 ++++ tools/perf/ui/browsers/hists.c | 4 ++++ tools/perf/ui/tui/setup.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index e5250eb..acb0e23 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c @@ -838,6 +838,10 @@ int map_symbol__tui_annotate(struct map_symbol *ms, struct perf_evsel *evsel, int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel, struct hist_browser_timer *hbt) { + /* reset abort key so that it can get Ctrl-C as a key */ + SLang_reset_tty(); + SLang_init_tty(0, 0, 0); + return map_symbol__tui_annotate(&he->ms, evsel, hbt); } diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index f981cb8..e64893f 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c @@ -1741,6 +1741,10 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, if (browser == NULL) return -1; + /* reset abort key so that it can get Ctrl-C as a key */ + SLang_reset_tty(); + SLang_init_tty(0, 0, 0); + if (min_pcnt) { browser->min_pcnt = min_pcnt; hist_browser__update_nr_entries(browser); diff --git a/tools/perf/ui/tui/setup.c b/tools/perf/ui/tui/setup.c index b77e1d7..60d1f29 100644 --- a/tools/perf/ui/tui/setup.c +++ b/tools/perf/ui/tui/setup.c @@ -129,7 +129,7 @@ int ui__init(void) err = SLsmg_init_smg(); if (err < 0) goto out; - err = SLang_init_tty(0, 0, 0); + err = SLang_init_tty(-1, 0, 0); if (err < 0) goto out;