aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-11-14 11:47:40 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-12-09 06:46:04 -0500
commit752914208ada0d9ae0a6b3bf2906d43f3605832f (patch)
tree24aa9815eafe719170c36e319aa0d5d317ac0534
parent919d590f13c94c5465db723178e4b72200fd5f90 (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/Makefile14
-rw-r--r--tools/perf/ui/util.c10
-rw-r--r--tools/perf/util/debug.c22
-rw-r--r--tools/perf/util/debug.h33
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
378LIB_H += util/intlist.h 378LIB_H += util/intlist.h
379LIB_H += util/perf_regs.h 379LIB_H += util/perf_regs.h
380LIB_H += util/unwind.h 380LIB_H += util/unwind.h
381LIB_H += ui/helpline.h
382LIB_H += util/vdso.h 381LIB_H += util/vdso.h
382LIB_H += ui/helpline.h
383LIB_H += ui/progress.h
384LIB_H += ui/util.h
385LIB_H += ui/ui.h
383 386
384LIB_OBJS += $(OUTPUT)util/abspath.o 387LIB_OBJS += $(OUTPUT)util/abspath.o
385LIB_OBJS += $(OUTPUT)util/alias.o 388LIB_OBJS += $(OUTPUT)util/alias.o
@@ -453,6 +456,7 @@ LIB_OBJS += $(OUTPUT)util/stat.o
453LIB_OBJS += $(OUTPUT)ui/setup.o 456LIB_OBJS += $(OUTPUT)ui/setup.o
454LIB_OBJS += $(OUTPUT)ui/helpline.o 457LIB_OBJS += $(OUTPUT)ui/helpline.o
455LIB_OBJS += $(OUTPUT)ui/progress.o 458LIB_OBJS += $(OUTPUT)ui/progress.o
459LIB_OBJS += $(OUTPUT)ui/util.o
456LIB_OBJS += $(OUTPUT)ui/hist.o 460LIB_OBJS += $(OUTPUT)ui/hist.o
457LIB_OBJS += $(OUTPUT)ui/stdio/hist.o 461LIB_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
662endif 662endif
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
685endif 681endif
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
55int 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)
53int 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
64int 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
74void trace_event(union perf_event *event) 52void 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
9extern int verbose; 11extern int verbose;
10extern bool quiet, dump_trace; 12extern bool quiet, dump_trace;
@@ -12,38 +14,7 @@ extern bool quiet, dump_trace;
12int dump_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); 14int dump_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
13void trace_event(union perf_event *event); 15void trace_event(union perf_event *event);
14 16
15struct ui_progress;
16struct perf_error_ops;
17
18#if defined(NEWT_SUPPORT) || defined(GTK2_SUPPORT)
19
20#include "../ui/progress.h"
21int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2))); 17int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2)));
22#include "../ui/util.h"
23
24#else
25
26static inline void ui_progress__update(u64 curr __maybe_unused,
27 u64 total __maybe_unused,
28 const char *title __maybe_unused) {}
29static inline void ui_progress__finish(void) {}
30
31#define ui__error(format, arg...) ui__warning(format, ##arg)
32
33static inline int
34perf_error__register(struct perf_error_ops *eops __maybe_unused)
35{
36 return 0;
37}
38
39static inline int
40perf_error__unregister(struct perf_error_ops *eops __maybe_unused)
41{
42 return 0;
43}
44
45#endif /* NEWT_SUPPORT || GTK2_SUPPORT */
46
47int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2))); 18int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2)));
48int ui__error_paranoid(void); 19int ui__error_paranoid(void);
49 20