aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2015-05-29 08:53:44 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-05-29 11:49:00 -0400
commited426915900db3c58c410b8b38f6ff0e46bf6c96 (patch)
tree754aa0939698ea7cc04587ee0b10be323fc9c64d /tools
parentd7a3d85e08477a979933a2bb3b525a8de99543c2 (diff)
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 <namhyung@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> 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/1432904024-13170-1-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/ui/browsers/annotate.c4
-rw-r--r--tools/perf/ui/browsers/hists.c4
-rw-r--r--tools/perf/ui/tui/setup.c2
3 files changed, 9 insertions, 1 deletions
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index e5250eb2dd57..acb0e23b138e 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,
838int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel, 838int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel,
839 struct hist_browser_timer *hbt) 839 struct hist_browser_timer *hbt)
840{ 840{
841 /* reset abort key so that it can get Ctrl-C as a key */
842 SLang_reset_tty();
843 SLang_init_tty(0, 0, 0);
844
841 return map_symbol__tui_annotate(&he->ms, evsel, hbt); 845 return map_symbol__tui_annotate(&he->ms, evsel, hbt);
842} 846}
843 847
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index f981cb8f0158..e64893f2fd7f 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,
1741 if (browser == NULL) 1741 if (browser == NULL)
1742 return -1; 1742 return -1;
1743 1743
1744 /* reset abort key so that it can get Ctrl-C as a key */
1745 SLang_reset_tty();
1746 SLang_init_tty(0, 0, 0);
1747
1744 if (min_pcnt) { 1748 if (min_pcnt) {
1745 browser->min_pcnt = min_pcnt; 1749 browser->min_pcnt = min_pcnt;
1746 hist_browser__update_nr_entries(browser); 1750 hist_browser__update_nr_entries(browser);
diff --git a/tools/perf/ui/tui/setup.c b/tools/perf/ui/tui/setup.c
index b77e1d771363..60d1f29b4b50 100644
--- a/tools/perf/ui/tui/setup.c
+++ b/tools/perf/ui/tui/setup.c
@@ -129,7 +129,7 @@ int ui__init(void)
129 err = SLsmg_init_smg(); 129 err = SLsmg_init_smg();
130 if (err < 0) 130 if (err < 0)
131 goto out; 131 goto out;
132 err = SLang_init_tty(0, 0, 0); 132 err = SLang_init_tty(-1, 0, 0);
133 if (err < 0) 133 if (err < 0)
134 goto out; 134 goto out;
135 135