aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-09-28 05:32:02 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-10-02 17:36:22 -0400
commit1254b51e32649f2d34ec6b070ed36717c5a6b825 (patch)
treefd582d9f1b25e73ebc1e81da46af462451b27f0f /tools/perf
parentf315e16850d00ae5b19f11810bc00bf68cf3c24a (diff)
perf tools: Convert to NEWT_SUPPORT
For building perf without libnewt, we can set NO_NEWT=1 as a argument of make. It then defines NO_NEWT_SUPPORT macro for C code to do the proper handling. However it usually used in a negative semantics - e.g. #ifndef - so we saw double negations which can be misleading. Convert it to a positive form to make it more readable. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1348824728-14025-7-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/Makefile8
-rw-r--r--tools/perf/ui/gtk/util.c2
-rw-r--r--tools/perf/ui/helpline.h10
-rw-r--r--tools/perf/util/annotate.h8
-rw-r--r--tools/perf/util/cache.h12
-rw-r--r--tools/perf/util/debug.c2
-rw-r--r--tools/perf/util/debug.h6
-rw-r--r--tools/perf/util/hist.h18
8 files changed, 32 insertions, 34 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 99b2bb371bcd..3d2181c57507 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -554,16 +554,14 @@ ifndef NO_LIBAUDIT
554 endif 554 endif
555endif 555endif
556 556
557ifdef NO_NEWT 557ifndef NO_NEWT
558 BASIC_CFLAGS += -DNO_NEWT_SUPPORT
559else
560 FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt 558 FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt
561 ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT)),y) 559 ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT)),y)
562 msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev); 560 msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev);
563 BASIC_CFLAGS += -DNO_NEWT_SUPPORT
564 else 561 else
565 # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h 562 # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
566 BASIC_CFLAGS += -I/usr/include/slang 563 BASIC_CFLAGS += -I/usr/include/slang
564 BASIC_CFLAGS += -DNEWT_SUPPORT
567 EXTLIBS += -lnewt -lslang 565 EXTLIBS += -lnewt -lslang
568 LIB_OBJS += $(OUTPUT)ui/setup.o 566 LIB_OBJS += $(OUTPUT)ui/setup.o
569 LIB_OBJS += $(OUTPUT)ui/browser.o 567 LIB_OBJS += $(OUTPUT)ui/browser.o
@@ -603,7 +601,7 @@ else
603 LIB_OBJS += $(OUTPUT)ui/gtk/util.o 601 LIB_OBJS += $(OUTPUT)ui/gtk/util.o
604 LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o 602 LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o
605 # Make sure that it'd be included only once. 603 # Make sure that it'd be included only once.
606 ifneq ($(findstring -DNO_NEWT_SUPPORT,$(BASIC_CFLAGS)),) 604 ifeq ($(findstring -DNEWT_SUPPORT,$(BASIC_CFLAGS)),)
607 LIB_OBJS += $(OUTPUT)ui/setup.o 605 LIB_OBJS += $(OUTPUT)ui/setup.o
608 LIB_OBJS += $(OUTPUT)ui/util.o 606 LIB_OBJS += $(OUTPUT)ui/util.o
609 endif 607 endif
diff --git a/tools/perf/ui/gtk/util.c b/tools/perf/ui/gtk/util.c
index 8aada5b3c04c..ccb046aac98b 100644
--- a/tools/perf/ui/gtk/util.c
+++ b/tools/perf/ui/gtk/util.c
@@ -116,7 +116,7 @@ struct perf_error_ops perf_gtk_eops = {
116 * FIXME: Functions below should be implemented properly. 116 * FIXME: Functions below should be implemented properly.
117 * For now, just add stubs for NO_NEWT=1 build. 117 * For now, just add stubs for NO_NEWT=1 build.
118 */ 118 */
119#ifdef NO_NEWT_SUPPORT 119#ifndef NEWT_SUPPORT
120void ui_progress__update(u64 curr __maybe_unused, u64 total __maybe_unused, 120void ui_progress__update(u64 curr __maybe_unused, u64 total __maybe_unused,
121 const char *title __maybe_unused) 121 const char *title __maybe_unused)
122{ 122{
diff --git a/tools/perf/ui/helpline.h b/tools/perf/ui/helpline.h
index 2b667ee454c3..e1f126ba0690 100644
--- a/tools/perf/ui/helpline.h
+++ b/tools/perf/ui/helpline.h
@@ -23,16 +23,16 @@ void ui_helpline__puts(const char *msg);
23 23
24extern char ui_helpline__current[512]; 24extern char ui_helpline__current[512];
25 25
26#ifdef NO_NEWT_SUPPORT 26#ifdef NEWT_SUPPORT
27extern char ui_helpline__last_msg[];
28int ui_helpline__show_help(const char *format, va_list ap);
29#else
27static inline int ui_helpline__show_help(const char *format __maybe_unused, 30static inline int ui_helpline__show_help(const char *format __maybe_unused,
28 va_list ap __maybe_unused) 31 va_list ap __maybe_unused)
29{ 32{
30 return 0; 33 return 0;
31} 34}
32#else 35#endif /* NEWT_SUPPORT */
33extern char ui_helpline__last_msg[];
34int ui_helpline__show_help(const char *format, va_list ap);
35#endif /* NO_NEWT_SUPPORT */
36 36
37#ifdef NO_GTK2_SUPPORT 37#ifdef NO_GTK2_SUPPORT
38static inline int perf_gtk__show_helpline(const char *format __maybe_unused, 38static inline int perf_gtk__show_helpline(const char *format __maybe_unused,
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index 9b5b21e7b032..39242dcee8f2 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -138,7 +138,10 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx,
138 bool print_lines, bool full_paths, int min_pcnt, 138 bool print_lines, bool full_paths, int min_pcnt,
139 int max_lines); 139 int max_lines);
140 140
141#ifdef NO_NEWT_SUPPORT 141#ifdef NEWT_SUPPORT
142int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
143 void(*timer)(void *arg), void *arg, int delay_secs);
144#else
142static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused, 145static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused,
143 struct map *map __maybe_unused, 146 struct map *map __maybe_unused,
144 int evidx __maybe_unused, 147 int evidx __maybe_unused,
@@ -148,9 +151,6 @@ static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused,
148{ 151{
149 return 0; 152 return 0;
150} 153}
151#else
152int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
153 void(*timer)(void *arg), void *arg, int delay_secs);
154#endif 154#endif
155 155
156extern const char *disassembler_style; 156extern const char *disassembler_style;
diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h
index ab1769426541..70f318dc1d9a 100644
--- a/tools/perf/util/cache.h
+++ b/tools/perf/util/cache.h
@@ -33,7 +33,7 @@ extern int pager_use_color;
33 33
34extern int use_browser; 34extern int use_browser;
35 35
36#if defined(NO_NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT) 36#if !defined(NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT)
37static inline void setup_browser(bool fallback_to_pager) 37static inline void setup_browser(bool fallback_to_pager)
38{ 38{
39 if (fallback_to_pager) 39 if (fallback_to_pager)
@@ -44,15 +44,15 @@ static inline void exit_browser(bool wait_for_ok __maybe_unused) {}
44void setup_browser(bool fallback_to_pager); 44void setup_browser(bool fallback_to_pager);
45void exit_browser(bool wait_for_ok); 45void exit_browser(bool wait_for_ok);
46 46
47#ifdef NO_NEWT_SUPPORT 47#ifdef NEWT_SUPPORT
48int ui__init(void);
49void ui__exit(bool wait_for_ok);
50#else
48static inline int ui__init(void) 51static inline int ui__init(void)
49{ 52{
50 return -1; 53 return -1;
51} 54}
52static inline void ui__exit(bool wait_for_ok __maybe_unused) {} 55static inline void ui__exit(bool wait_for_ok __maybe_unused) {}
53#else
54int ui__init(void);
55void ui__exit(bool wait_for_ok);
56#endif 56#endif
57 57
58#ifdef NO_GTK2_SUPPORT 58#ifdef NO_GTK2_SUPPORT
@@ -65,7 +65,7 @@ static inline void perf_gtk__exit(bool wait_for_ok __maybe_unused) {}
65int perf_gtk__init(void); 65int perf_gtk__init(void);
66void perf_gtk__exit(bool wait_for_ok); 66void perf_gtk__exit(bool wait_for_ok);
67#endif 67#endif
68#endif /* NO_NEWT_SUPPORT && NO_GTK2_SUPPORT */ 68#endif /* !NEWT_SUPPORT && NO_GTK2_SUPPORT */
69 69
70char *alias_lookup(const char *alias); 70char *alias_lookup(const char *alias);
71int split_cmdline(char *cmdline, const char ***argv); 71int split_cmdline(char *cmdline, const char ***argv);
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index 66eb3828ceb5..0f6ad7037d9c 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -49,7 +49,7 @@ int dump_printf(const char *fmt, ...)
49 return ret; 49 return ret;
50} 50}
51 51
52#if defined(NO_NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT) 52#if !defined(NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT)
53int ui__warning(const char *format, ...) 53int ui__warning(const char *format, ...)
54{ 54{
55 va_list args; 55 va_list args;
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h
index bb2e7d1007ab..3fe9ade7a2c2 100644
--- a/tools/perf/util/debug.h
+++ b/tools/perf/util/debug.h
@@ -15,7 +15,7 @@ void trace_event(union perf_event *event);
15struct ui_progress; 15struct ui_progress;
16struct perf_error_ops; 16struct perf_error_ops;
17 17
18#if defined(NO_NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT) 18#if !defined(NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT)
19static inline void ui_progress__update(u64 curr __maybe_unused, 19static inline void ui_progress__update(u64 curr __maybe_unused,
20 u64 total __maybe_unused, 20 u64 total __maybe_unused,
21 const char *title __maybe_unused) {} 21 const char *title __maybe_unused) {}
@@ -34,13 +34,13 @@ perf_error__unregister(struct perf_error_ops *eops __maybe_unused)
34 return 0; 34 return 0;
35} 35}
36 36
37#else /* NO_NEWT_SUPPORT && NO_GTK2_SUPPORT */ 37#else /* !NEWT_SUPPORT && NO_GTK2_SUPPORT */
38 38
39#include "../ui/progress.h" 39#include "../ui/progress.h"
40int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2))); 40int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2)));
41#include "../ui/util.h" 41#include "../ui/util.h"
42 42
43#endif /* NO_NEWT_SUPPORT && NO_GTK2_SUPPORT */ 43#endif /* !NEWT_SUPPORT && NO_GTK2_SUPPORT */
44 44
45int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2))); 45int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2)));
46int ui__error_paranoid(void); 46int ui__error_paranoid(void);
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index f011ad4756e8..843638d0287f 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -154,7 +154,15 @@ int hist_entry__period_snprintf(struct perf_hpp *hpp, struct hist_entry *he,
154 154
155struct perf_evlist; 155struct perf_evlist;
156 156
157#ifdef NO_NEWT_SUPPORT 157#ifdef NEWT_SUPPORT
158#include "../ui/keysyms.h"
159int hist_entry__tui_annotate(struct hist_entry *he, int evidx,
160 void(*timer)(void *arg), void *arg, int delay_secs);
161
162int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help,
163 void(*timer)(void *arg), void *arg,
164 int refresh);
165#else
158static inline 166static inline
159int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused, 167int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused,
160 const char *help __maybe_unused, 168 const char *help __maybe_unused,
@@ -177,14 +185,6 @@ static inline int hist_entry__tui_annotate(struct hist_entry *self
177} 185}
178#define K_LEFT -1 186#define K_LEFT -1
179#define K_RIGHT -2 187#define K_RIGHT -2
180#else
181#include "../ui/keysyms.h"
182int hist_entry__tui_annotate(struct hist_entry *he, int evidx,
183 void(*timer)(void *arg), void *arg, int delay_secs);
184
185int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help,
186 void(*timer)(void *arg), void *arg,
187 int refresh);
188#endif 188#endif
189 189
190#ifdef NO_GTK2_SUPPORT 190#ifdef NO_GTK2_SUPPORT