diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2012-11-14 11:47:40 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-12-09 06:46:04 -0500 |
commit | 752914208ada0d9ae0a6b3bf2906d43f3605832f (patch) | |
tree | 24aa9815eafe719170c36e319aa0d5d317ac0534 | |
parent | 919d590f13c94c5465db723178e4b72200fd5f90 (diff) |
perf ui: Always compile error printing code
It is used everywhere so always build it regardless of ui engine.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1352911664-24620-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/Makefile | 14 | ||||
-rw-r--r-- | tools/perf/ui/util.c | 10 | ||||
-rw-r--r-- | tools/perf/util/debug.c | 22 | ||||
-rw-r--r-- | tools/perf/util/debug.h | 33 |
4 files changed, 17 insertions, 62 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 891bc77bdb2c..8fca560cf78e 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -378,8 +378,11 @@ LIB_H += util/rblist.h | |||
378 | LIB_H += util/intlist.h | 378 | LIB_H += util/intlist.h |
379 | LIB_H += util/perf_regs.h | 379 | LIB_H += util/perf_regs.h |
380 | LIB_H += util/unwind.h | 380 | LIB_H += util/unwind.h |
381 | LIB_H += ui/helpline.h | ||
382 | LIB_H += util/vdso.h | 381 | LIB_H += util/vdso.h |
382 | LIB_H += ui/helpline.h | ||
383 | LIB_H += ui/progress.h | ||
384 | LIB_H += ui/util.h | ||
385 | LIB_H += ui/ui.h | ||
383 | 386 | ||
384 | LIB_OBJS += $(OUTPUT)util/abspath.o | 387 | LIB_OBJS += $(OUTPUT)util/abspath.o |
385 | LIB_OBJS += $(OUTPUT)util/alias.o | 388 | LIB_OBJS += $(OUTPUT)util/alias.o |
@@ -453,6 +456,7 @@ LIB_OBJS += $(OUTPUT)util/stat.o | |||
453 | LIB_OBJS += $(OUTPUT)ui/setup.o | 456 | LIB_OBJS += $(OUTPUT)ui/setup.o |
454 | LIB_OBJS += $(OUTPUT)ui/helpline.o | 457 | LIB_OBJS += $(OUTPUT)ui/helpline.o |
455 | LIB_OBJS += $(OUTPUT)ui/progress.o | 458 | LIB_OBJS += $(OUTPUT)ui/progress.o |
459 | LIB_OBJS += $(OUTPUT)ui/util.o | ||
456 | LIB_OBJS += $(OUTPUT)ui/hist.o | 460 | LIB_OBJS += $(OUTPUT)ui/hist.o |
457 | LIB_OBJS += $(OUTPUT)ui/stdio/hist.o | 461 | LIB_OBJS += $(OUTPUT)ui/stdio/hist.o |
458 | 462 | ||
@@ -646,7 +650,6 @@ ifndef NO_NEWT | |||
646 | LIB_OBJS += $(OUTPUT)ui/browsers/hists.o | 650 | LIB_OBJS += $(OUTPUT)ui/browsers/hists.o |
647 | LIB_OBJS += $(OUTPUT)ui/browsers/map.o | 651 | LIB_OBJS += $(OUTPUT)ui/browsers/map.o |
648 | LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o | 652 | LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o |
649 | LIB_OBJS += $(OUTPUT)ui/util.o | ||
650 | LIB_OBJS += $(OUTPUT)ui/tui/setup.o | 653 | LIB_OBJS += $(OUTPUT)ui/tui/setup.o |
651 | LIB_OBJS += $(OUTPUT)ui/tui/util.o | 654 | LIB_OBJS += $(OUTPUT)ui/tui/util.o |
652 | LIB_OBJS += $(OUTPUT)ui/tui/helpline.o | 655 | LIB_OBJS += $(OUTPUT)ui/tui/helpline.o |
@@ -655,9 +658,6 @@ ifndef NO_NEWT | |||
655 | LIB_H += ui/browsers/map.h | 658 | LIB_H += ui/browsers/map.h |
656 | LIB_H += ui/keysyms.h | 659 | LIB_H += ui/keysyms.h |
657 | LIB_H += ui/libslang.h | 660 | LIB_H += ui/libslang.h |
658 | LIB_H += ui/progress.h | ||
659 | LIB_H += ui/util.h | ||
660 | LIB_H += ui/ui.h | ||
661 | endif | 661 | endif |
662 | endif | 662 | endif |
663 | 663 | ||
@@ -677,10 +677,6 @@ ifndef NO_GTK2 | |||
677 | LIB_OBJS += $(OUTPUT)ui/gtk/util.o | 677 | LIB_OBJS += $(OUTPUT)ui/gtk/util.o |
678 | LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o | 678 | LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o |
679 | LIB_OBJS += $(OUTPUT)ui/gtk/progress.o | 679 | LIB_OBJS += $(OUTPUT)ui/gtk/progress.o |
680 | # Make sure that it'd be included only once. | ||
681 | ifeq ($(findstring -DNEWT_SUPPORT,$(BASIC_CFLAGS)),) | ||
682 | LIB_OBJS += $(OUTPUT)ui/util.o | ||
683 | endif | ||
684 | endif | 680 | endif |
685 | endif | 681 | endif |
686 | 682 | ||
diff --git a/tools/perf/ui/util.c b/tools/perf/ui/util.c index 4f989774c8c6..3014a7cd5271 100644 --- a/tools/perf/ui/util.c +++ b/tools/perf/ui/util.c | |||
@@ -52,6 +52,16 @@ int ui__warning(const char *format, ...) | |||
52 | return ret; | 52 | return ret; |
53 | } | 53 | } |
54 | 54 | ||
55 | int ui__error_paranoid(void) | ||
56 | { | ||
57 | return ui__error("Permission error - are you root?\n" | ||
58 | "Consider tweaking /proc/sys/kernel/perf_event_paranoid:\n" | ||
59 | " -1 - Not paranoid at all\n" | ||
60 | " 0 - Disallow raw tracepoint access for unpriv\n" | ||
61 | " 1 - Disallow cpu events for unpriv\n" | ||
62 | " 2 - Disallow kernel profiling for unpriv\n"); | ||
63 | } | ||
64 | |||
55 | 65 | ||
56 | /** | 66 | /** |
57 | * perf_error__register - Register error logging functions | 67 | * perf_error__register - Register error logging functions |
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index 03f830b48148..39861a2a7d18 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c | |||
@@ -49,28 +49,6 @@ int dump_printf(const char *fmt, ...) | |||
49 | return ret; | 49 | return ret; |
50 | } | 50 | } |
51 | 51 | ||
52 | #if !defined(NEWT_SUPPORT) && !defined(GTK2_SUPPORT) | ||
53 | int ui__warning(const char *format, ...) | ||
54 | { | ||
55 | va_list args; | ||
56 | |||
57 | va_start(args, format); | ||
58 | vfprintf(stderr, format, args); | ||
59 | va_end(args); | ||
60 | return 0; | ||
61 | } | ||
62 | #endif | ||
63 | |||
64 | int ui__error_paranoid(void) | ||
65 | { | ||
66 | return ui__error("Permission error - are you root?\n" | ||
67 | "Consider tweaking /proc/sys/kernel/perf_event_paranoid:\n" | ||
68 | " -1 - Not paranoid at all\n" | ||
69 | " 0 - Disallow raw tracepoint access for unpriv\n" | ||
70 | " 1 - Disallow cpu events for unpriv\n" | ||
71 | " 2 - Disallow kernel profiling for unpriv\n"); | ||
72 | } | ||
73 | |||
74 | void trace_event(union perf_event *event) | 52 | void trace_event(union perf_event *event) |
75 | { | 53 | { |
76 | unsigned char *raw_event = (void *)event; | 54 | unsigned char *raw_event = (void *)event; |
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h index 83e8d234af6b..6e2667fb8211 100644 --- a/tools/perf/util/debug.h +++ b/tools/perf/util/debug.h | |||
@@ -5,6 +5,8 @@ | |||
5 | #include <stdbool.h> | 5 | #include <stdbool.h> |
6 | #include "event.h" | 6 | #include "event.h" |
7 | #include "../ui/helpline.h" | 7 | #include "../ui/helpline.h" |
8 | #include "../ui/progress.h" | ||
9 | #include "../ui/util.h" | ||
8 | 10 | ||
9 | extern int verbose; | 11 | extern int verbose; |
10 | extern bool quiet, dump_trace; | 12 | extern bool quiet, dump_trace; |
@@ -12,38 +14,7 @@ extern bool quiet, dump_trace; | |||
12 | int dump_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); | 14 | int dump_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); |
13 | void trace_event(union perf_event *event); | 15 | void trace_event(union perf_event *event); |
14 | 16 | ||
15 | struct ui_progress; | ||
16 | struct perf_error_ops; | ||
17 | |||
18 | #if defined(NEWT_SUPPORT) || defined(GTK2_SUPPORT) | ||
19 | |||
20 | #include "../ui/progress.h" | ||
21 | int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2))); | 17 | int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2))); |
22 | #include "../ui/util.h" | ||
23 | |||
24 | #else | ||
25 | |||
26 | static inline void ui_progress__update(u64 curr __maybe_unused, | ||
27 | u64 total __maybe_unused, | ||
28 | const char *title __maybe_unused) {} | ||
29 | static inline void ui_progress__finish(void) {} | ||
30 | |||
31 | #define ui__error(format, arg...) ui__warning(format, ##arg) | ||
32 | |||
33 | static inline int | ||
34 | perf_error__register(struct perf_error_ops *eops __maybe_unused) | ||
35 | { | ||
36 | return 0; | ||
37 | } | ||
38 | |||
39 | static inline int | ||
40 | perf_error__unregister(struct perf_error_ops *eops __maybe_unused) | ||
41 | { | ||
42 | return 0; | ||
43 | } | ||
44 | |||
45 | #endif /* NEWT_SUPPORT || GTK2_SUPPORT */ | ||
46 | |||
47 | int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2))); | 18 | int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2))); |
48 | int ui__error_paranoid(void); | 19 | int ui__error_paranoid(void); |
49 | 20 | ||