Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf ui/tui: Show fatal error message only if exists

When perf exits with some error it shows the error message with
ui__error() or ui__warning() and then calls ui__exit() during
exit_browser().

On TUI, it then shows a window titled "Fatal Error" to inform user a
last message which might be related with this condition. However it
sometimes contains no message and just annoyes users.

The usual case for this is running perf top as normal user. (And
/proc/sys/kernel/perf_event_paranoid being 1).

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1421736050-5283-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
4397bd2f 605a3069

+5 -1
+3
tools/perf/ui/tui/helpline.c
··· 9 9 #include "../libslang.h" 10 10 11 11 char ui_helpline__last_msg[1024]; 12 + bool tui_helpline__set; 12 13 13 14 static void tui_helpline__pop(void) 14 15 { ··· 35 34 ret = vscnprintf(ui_helpline__last_msg + backlog, 36 35 sizeof(ui_helpline__last_msg) - backlog, format, ap); 37 36 backlog += ret; 37 + 38 + tui_helpline__set = true; 38 39 39 40 if (ui_helpline__last_msg[backlog - 1] == '\n') { 40 41 ui_helpline__puts(ui_helpline__last_msg);
+2 -1
tools/perf/ui/tui/setup.c
··· 17 17 static volatile int ui__need_resize; 18 18 19 19 extern struct perf_error_ops perf_tui_eops; 20 + extern bool tui_helpline__set; 20 21 21 22 extern void hist_browser__init_hpp(void); 22 23 ··· 160 159 161 160 void ui__exit(bool wait_for_ok) 162 161 { 163 - if (wait_for_ok) 162 + if (wait_for_ok && tui_helpline__set) 164 163 ui__question_window("Fatal Error", 165 164 ui_helpline__last_msg, 166 165 "Press any key...", 0);