aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-09-28 05:32:03 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-10-02 17:36:23 -0400
commitf9f526ecdc09a851f4f5567ebcf9bc553778f6c2 (patch)
tree1ddf1f736e35b7a130819ad5a49b0fc937728603 /tools/perf/util
parent1254b51e32649f2d34ec6b070ed36717c5a6b825 (diff)
perf tools: Convert to GTK2_SUPPORT
For building perf without gtk+2, we can set NO_GTK2=1 as a argument of make. It then defines NO_GTK2_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-8-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/cache.h28
-rw-r--r--tools/perf/util/debug.c2
-rw-r--r--tools/perf/util/debug.h17
-rw-r--r--tools/perf/util/hist.h11
4 files changed, 30 insertions, 28 deletions
diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h
index 70f318dc1d9a..07aec06e4443 100644
--- a/tools/perf/util/cache.h
+++ b/tools/perf/util/cache.h
@@ -33,14 +33,7 @@ extern int pager_use_color;
33 33
34extern int use_browser; 34extern int use_browser;
35 35
36#if !defined(NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT) 36#if defined(NEWT_SUPPORT) || defined(GTK2_SUPPORT)
37static inline void setup_browser(bool fallback_to_pager)
38{
39 if (fallback_to_pager)
40 setup_pager();
41}
42static inline void exit_browser(bool wait_for_ok __maybe_unused) {}
43#else
44void setup_browser(bool fallback_to_pager); 37void setup_browser(bool fallback_to_pager);
45void exit_browser(bool wait_for_ok); 38void exit_browser(bool wait_for_ok);
46 39
@@ -55,17 +48,26 @@ static inline int ui__init(void)
55static inline void ui__exit(bool wait_for_ok __maybe_unused) {} 48static inline void ui__exit(bool wait_for_ok __maybe_unused) {}
56#endif 49#endif
57 50
58#ifdef NO_GTK2_SUPPORT 51#ifdef GTK2_SUPPORT
52int perf_gtk__init(void);
53void perf_gtk__exit(bool wait_for_ok);
54#else
59static inline int perf_gtk__init(void) 55static inline int perf_gtk__init(void)
60{ 56{
61 return -1; 57 return -1;
62} 58}
63static inline void perf_gtk__exit(bool wait_for_ok __maybe_unused) {} 59static inline void perf_gtk__exit(bool wait_for_ok __maybe_unused) {}
64#else
65int perf_gtk__init(void);
66void perf_gtk__exit(bool wait_for_ok);
67#endif 60#endif
68#endif /* !NEWT_SUPPORT && NO_GTK2_SUPPORT */ 61
62#else /* NEWT_SUPPORT || GTK2_SUPPORT */
63
64static inline void setup_browser(bool fallback_to_pager)
65{
66 if (fallback_to_pager)
67 setup_pager();
68}
69static inline void exit_browser(bool wait_for_ok __maybe_unused) {}
70#endif /* NEWT_SUPPORT || GTK2_SUPPORT */
69 71
70char *alias_lookup(const char *alias); 72char *alias_lookup(const char *alias);
71int split_cmdline(char *cmdline, const char ***argv); 73int split_cmdline(char *cmdline, const char ***argv);
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index 0f6ad7037d9c..03f830b48148 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(NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT) 52#if !defined(NEWT_SUPPORT) && !defined(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 3fe9ade7a2c2..dec98750b484 100644
--- a/tools/perf/util/debug.h
+++ b/tools/perf/util/debug.h
@@ -15,7 +15,14 @@ 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(NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT) 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)));
22#include "../ui/util.h"
23
24#else
25
19static inline void ui_progress__update(u64 curr __maybe_unused, 26static inline void ui_progress__update(u64 curr __maybe_unused,
20 u64 total __maybe_unused, 27 u64 total __maybe_unused,
21 const char *title __maybe_unused) {} 28 const char *title __maybe_unused) {}
@@ -34,13 +41,7 @@ perf_error__unregister(struct perf_error_ops *eops __maybe_unused)
34 return 0; 41 return 0;
35} 42}
36 43
37#else /* !NEWT_SUPPORT && NO_GTK2_SUPPORT */ 44#endif /* NEWT_SUPPORT || GTK2_SUPPORT */
38
39#include "../ui/progress.h"
40int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2)));
41#include "../ui/util.h"
42
43#endif /* !NEWT_SUPPORT && NO_GTK2_SUPPORT */
44 45
45int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2))); 46int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2)));
46int ui__error_paranoid(void); 47int ui__error_paranoid(void);
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 843638d0287f..6ca74079d5c9 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -187,7 +187,11 @@ static inline int hist_entry__tui_annotate(struct hist_entry *self
187#define K_RIGHT -2 187#define K_RIGHT -2
188#endif 188#endif
189 189
190#ifdef NO_GTK2_SUPPORT 190#ifdef GTK2_SUPPORT
191int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help,
192 void(*timer)(void *arg), void *arg,
193 int refresh);
194#else
191static inline 195static inline
192int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __maybe_unused, 196int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __maybe_unused,
193 const char *help __maybe_unused, 197 const char *help __maybe_unused,
@@ -197,11 +201,6 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __maybe_unused,
197{ 201{
198 return 0; 202 return 0;
199} 203}
200
201#else
202int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help,
203 void(*timer)(void *arg), void *arg,
204 int refresh);
205#endif 204#endif
206 205
207unsigned int hists__sort_list_width(struct hists *self); 206unsigned int hists__sort_list_width(struct hists *self);