diff options
-rw-r--r-- | tools/perf/Makefile.perf | 42 | ||||
-rw-r--r-- | tools/perf/builtin-annotate.c | 26 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 16 | ||||
-rw-r--r-- | tools/perf/config/Makefile | 12 | ||||
-rw-r--r-- | tools/perf/ui/gtk/annotate.c | 13 | ||||
-rw-r--r-- | tools/perf/ui/gtk/gtk.h | 16 | ||||
-rw-r--r-- | tools/perf/ui/setup.c | 61 | ||||
-rw-r--r-- | tools/perf/ui/ui.h | 12 | ||||
-rw-r--r-- | tools/perf/util/annotate.h | 24 | ||||
-rw-r--r-- | tools/perf/util/hist.h | 15 | ||||
-rw-r--r-- | tools/perf/util/util.h | 2 |
11 files changed, 165 insertions, 74 deletions
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index a24f6c280b95..40c39c39ce80 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf | |||
@@ -114,6 +114,7 @@ SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ | |||
114 | BUILTIN_OBJS = | 114 | BUILTIN_OBJS = |
115 | LIB_H = | 115 | LIB_H = |
116 | LIB_OBJS = | 116 | LIB_OBJS = |
117 | GTK_OBJS = | ||
117 | PYRF_OBJS = | 118 | PYRF_OBJS = |
118 | SCRIPT_SH = | 119 | SCRIPT_SH = |
119 | 120 | ||
@@ -490,13 +491,19 @@ ifndef NO_SLANG | |||
490 | endif | 491 | endif |
491 | 492 | ||
492 | ifndef NO_GTK2 | 493 | ifndef NO_GTK2 |
493 | LIB_OBJS += $(OUTPUT)ui/gtk/browser.o | 494 | ALL_PROGRAMS += $(OUTPUT)libperf-gtk.so |
494 | LIB_OBJS += $(OUTPUT)ui/gtk/hists.o | 495 | |
495 | LIB_OBJS += $(OUTPUT)ui/gtk/setup.o | 496 | GTK_OBJS += $(OUTPUT)ui/gtk/browser.o |
496 | LIB_OBJS += $(OUTPUT)ui/gtk/util.o | 497 | GTK_OBJS += $(OUTPUT)ui/gtk/hists.o |
497 | LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o | 498 | GTK_OBJS += $(OUTPUT)ui/gtk/setup.o |
498 | LIB_OBJS += $(OUTPUT)ui/gtk/progress.o | 499 | GTK_OBJS += $(OUTPUT)ui/gtk/util.o |
499 | LIB_OBJS += $(OUTPUT)ui/gtk/annotate.o | 500 | GTK_OBJS += $(OUTPUT)ui/gtk/helpline.o |
501 | GTK_OBJS += $(OUTPUT)ui/gtk/progress.o | ||
502 | GTK_OBJS += $(OUTPUT)ui/gtk/annotate.o | ||
503 | |||
504 | install-gtk: $(OUTPUT)libperf-gtk.so | ||
505 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)' | ||
506 | $(INSTALL) $(OUTPUT)libperf-gtk.so '$(DESTDIR_SQ)$(libdir_SQ)' | ||
500 | endif | 507 | endif |
501 | 508 | ||
502 | ifndef NO_LIBPERL | 509 | ifndef NO_LIBPERL |
@@ -550,6 +557,12 @@ $(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS) | |||
550 | $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(OUTPUT)perf.o \ | 557 | $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(OUTPUT)perf.o \ |
551 | $(BUILTIN_OBJS) $(LIBS) -o $@ | 558 | $(BUILTIN_OBJS) $(LIBS) -o $@ |
552 | 559 | ||
560 | $(GTK_OBJS): $(OUTPUT)%.o: %.c $(LIB_H) | ||
561 | $(QUIET_CC)$(CC) -o $@ -c -fPIC $(CFLAGS) $(GTK_CFLAGS) $< | ||
562 | |||
563 | $(OUTPUT)libperf-gtk.so: $(GTK_OBJS) $(PERFLIBS) | ||
564 | $(QUIET_LINK)$(CC) -o $@ -shared $(ALL_LDFLAGS) $(filter %.o,$^) $(GTK_LIBS) | ||
565 | |||
553 | $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS | 566 | $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS |
554 | $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \ | 567 | $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \ |
555 | '-DPERF_HTML_PATH="$(htmldir_SQ)"' \ | 568 | '-DPERF_HTML_PATH="$(htmldir_SQ)"' \ |
@@ -632,6 +645,9 @@ $(OUTPUT)tests/python-use.o: tests/python-use.c $(OUTPUT)PERF-CFLAGS | |||
632 | $(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS | 645 | $(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS |
633 | $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< | 646 | $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< |
634 | 647 | ||
648 | $(OUTPUT)ui/setup.o: ui/setup.c $(OUTPUT)PERF-CFLAGS | ||
649 | $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DLIBDIR='"$(libdir_SQ)"' $< | ||
650 | |||
635 | $(OUTPUT)ui/browser.o: ui/browser.c $(OUTPUT)PERF-CFLAGS | 651 | $(OUTPUT)ui/browser.o: ui/browser.c $(OUTPUT)PERF-CFLAGS |
636 | $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $< | 652 | $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $< |
637 | 653 | ||
@@ -673,7 +689,8 @@ $(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h) | |||
673 | 689 | ||
674 | # we compile into subdirectories. if the target directory is not the source directory, they might not exists. So | 690 | # we compile into subdirectories. if the target directory is not the source directory, they might not exists. So |
675 | # we depend the various files onto their directories. | 691 | # we depend the various files onto their directories. |
676 | DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h | 692 | DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(GTK_OBJS) |
693 | DIRECTORY_DEPS += $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h | ||
677 | $(DIRECTORY_DEPS): | $(sort $(dir $(DIRECTORY_DEPS))) | 694 | $(DIRECTORY_DEPS): | $(sort $(dir $(DIRECTORY_DEPS))) |
678 | # In the second step, we make a rule to actually create these directories | 695 | # In the second step, we make a rule to actually create these directories |
679 | $(sort $(dir $(DIRECTORY_DEPS))): | 696 | $(sort $(dir $(DIRECTORY_DEPS))): |
@@ -786,7 +803,9 @@ check: $(OUTPUT)common-cmds.h | |||
786 | 803 | ||
787 | ### Installation rules | 804 | ### Installation rules |
788 | 805 | ||
789 | install-bin: all | 806 | install-gtk: |
807 | |||
808 | install-bin: all install-gtk | ||
790 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)' | 809 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)' |
791 | $(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)' | 810 | $(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)' |
792 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' | 811 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' |
@@ -831,7 +850,8 @@ config-clean: | |||
831 | @$(MAKE) -C config/feature-checks clean | 850 | @$(MAKE) -C config/feature-checks clean |
832 | 851 | ||
833 | clean: $(LIBTRACEEVENT)-clean $(LIBLK)-clean config-clean | 852 | clean: $(LIBTRACEEVENT)-clean $(LIBLK)-clean config-clean |
834 | $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) | 853 | $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(GTK_OBJS) |
854 | $(RM) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) | ||
835 | $(RM) $(ALL_PROGRAMS) perf | 855 | $(RM) $(ALL_PROGRAMS) perf |
836 | $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* | 856 | $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* |
837 | $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean | 857 | $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean |
@@ -850,7 +870,7 @@ else | |||
850 | GIT-HEAD-PHONY = | 870 | GIT-HEAD-PHONY = |
851 | endif | 871 | endif |
852 | 872 | ||
853 | .PHONY: all install clean config-clean strip | 873 | .PHONY: all install clean config-clean strip install-gtk |
854 | .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell | 874 | .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell |
855 | .PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope .FORCE-PERF-CFLAGS | 875 | .PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope .FORCE-PERF-CFLAGS |
856 | 876 | ||
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 0393d9800516..94f9a8e78117 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include "util/tool.h" | 30 | #include "util/tool.h" |
31 | #include "arch/common.h" | 31 | #include "arch/common.h" |
32 | 32 | ||
33 | #include <dlfcn.h> | ||
33 | #include <linux/bitmap.h> | 34 | #include <linux/bitmap.h> |
34 | 35 | ||
35 | struct perf_annotate { | 36 | struct perf_annotate { |
@@ -142,8 +143,18 @@ find_next: | |||
142 | 143 | ||
143 | if (use_browser == 2) { | 144 | if (use_browser == 2) { |
144 | int ret; | 145 | int ret; |
146 | int (*annotate)(struct hist_entry *he, | ||
147 | struct perf_evsel *evsel, | ||
148 | struct hist_browser_timer *hbt); | ||
149 | |||
150 | annotate = dlsym(perf_gtk_handle, | ||
151 | "hist_entry__gtk_annotate"); | ||
152 | if (annotate == NULL) { | ||
153 | ui__error("GTK browser not found!\n"); | ||
154 | return; | ||
155 | } | ||
145 | 156 | ||
146 | ret = hist_entry__gtk_annotate(he, evsel, NULL); | 157 | ret = annotate(he, evsel, NULL); |
147 | if (!ret || !ann->skip_missing) | 158 | if (!ret || !ann->skip_missing) |
148 | return; | 159 | return; |
149 | 160 | ||
@@ -247,8 +258,17 @@ static int __cmd_annotate(struct perf_annotate *ann) | |||
247 | goto out_delete; | 258 | goto out_delete; |
248 | } | 259 | } |
249 | 260 | ||
250 | if (use_browser == 2) | 261 | if (use_browser == 2) { |
251 | perf_gtk__show_annotations(); | 262 | void (*show_annotations)(void); |
263 | |||
264 | show_annotations = dlsym(perf_gtk_handle, | ||
265 | "perf_gtk__show_annotations"); | ||
266 | if (show_annotations == NULL) { | ||
267 | ui__error("GTK browser not found!\n"); | ||
268 | goto out_delete; | ||
269 | } | ||
270 | show_annotations(); | ||
271 | } | ||
252 | 272 | ||
253 | out_delete: | 273 | out_delete: |
254 | /* | 274 | /* |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 06e1abe351dd..21b5c2f54c2a 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include "util/hist.h" | 35 | #include "util/hist.h" |
36 | #include "arch/common.h" | 36 | #include "arch/common.h" |
37 | 37 | ||
38 | #include <dlfcn.h> | ||
38 | #include <linux/bitmap.h> | 39 | #include <linux/bitmap.h> |
39 | 40 | ||
40 | struct perf_report { | 41 | struct perf_report { |
@@ -591,8 +592,19 @@ static int __cmd_report(struct perf_report *rep) | |||
591 | ret = 0; | 592 | ret = 0; |
592 | 593 | ||
593 | } else if (use_browser == 2) { | 594 | } else if (use_browser == 2) { |
594 | perf_evlist__gtk_browse_hists(session->evlist, help, | 595 | int (*hist_browser)(struct perf_evlist *, |
595 | NULL, rep->min_percent); | 596 | const char *, |
597 | struct hist_browser_timer *, | ||
598 | float min_pcnt); | ||
599 | |||
600 | hist_browser = dlsym(perf_gtk_handle, | ||
601 | "perf_evlist__gtk_browse_hists"); | ||
602 | if (hist_browser == NULL) { | ||
603 | ui__error("GTK browser not found!\n"); | ||
604 | return ret; | ||
605 | } | ||
606 | hist_browser(session->evlist, help, NULL, | ||
607 | rep->min_percent); | ||
596 | } | 608 | } |
597 | } else | 609 | } else |
598 | perf_evlist__tty_browse_hists(session->evlist, rep, help); | 610 | perf_evlist__tty_browse_hists(session->evlist, rep, help); |
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index f5d661f5637d..d9bba8d57c40 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile | |||
@@ -377,11 +377,11 @@ ifndef NO_GTK2 | |||
377 | NO_GTK2 := 1 | 377 | NO_GTK2 := 1 |
378 | else | 378 | else |
379 | ifeq ($(feature-gtk2-infobar), 1) | 379 | ifeq ($(feature-gtk2-infobar), 1) |
380 | CFLAGS += -DHAVE_GTK_INFO_BAR_SUPPORT | 380 | GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT |
381 | endif | 381 | endif |
382 | CFLAGS += -DHAVE_GTK2_SUPPORT | 382 | CFLAGS += -DHAVE_GTK2_SUPPORT |
383 | CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null) | 383 | GTK_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null) |
384 | EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null) | 384 | GTK_LIBS := $(shell pkg-config --libs gtk+-2.0 2>/dev/null) |
385 | endif | 385 | endif |
386 | endif | 386 | endif |
387 | 387 | ||
@@ -554,7 +554,12 @@ else | |||
554 | sysconfdir = $(prefix)/etc | 554 | sysconfdir = $(prefix)/etc |
555 | ETC_PERFCONFIG = etc/perfconfig | 555 | ETC_PERFCONFIG = etc/perfconfig |
556 | endif | 556 | endif |
557 | ifeq ($(IS_X86_64),1) | ||
558 | lib = lib64 | ||
559 | else | ||
557 | lib = lib | 560 | lib = lib |
561 | endif | ||
562 | libdir = $(prefix)/$(lib) | ||
558 | 563 | ||
559 | # Shell quote (do not use $(call) to accommodate ancient setups); | 564 | # Shell quote (do not use $(call) to accommodate ancient setups); |
560 | ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG)) | 565 | ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG)) |
@@ -567,6 +572,7 @@ template_dir_SQ = $(subst ','\'',$(template_dir)) | |||
567 | htmldir_SQ = $(subst ','\'',$(htmldir)) | 572 | htmldir_SQ = $(subst ','\'',$(htmldir)) |
568 | prefix_SQ = $(subst ','\'',$(prefix)) | 573 | prefix_SQ = $(subst ','\'',$(prefix)) |
569 | sysconfdir_SQ = $(subst ','\'',$(sysconfdir)) | 574 | sysconfdir_SQ = $(subst ','\'',$(sysconfdir)) |
575 | libdir_SQ = $(subst ','\'',$(libdir)) | ||
570 | 576 | ||
571 | ifneq ($(filter /%,$(firstword $(perfexecdir))),) | 577 | ifneq ($(filter /%,$(firstword $(perfexecdir))),) |
572 | perfexec_instdir = $(perfexecdir) | 578 | perfexec_instdir = $(perfexecdir) |
diff --git a/tools/perf/ui/gtk/annotate.c b/tools/perf/ui/gtk/annotate.c index f538794615db..9c7ff8d31b27 100644 --- a/tools/perf/ui/gtk/annotate.c +++ b/tools/perf/ui/gtk/annotate.c | |||
@@ -154,9 +154,9 @@ static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym, | |||
154 | return 0; | 154 | return 0; |
155 | } | 155 | } |
156 | 156 | ||
157 | int symbol__gtk_annotate(struct symbol *sym, struct map *map, | 157 | static int symbol__gtk_annotate(struct symbol *sym, struct map *map, |
158 | struct perf_evsel *evsel, | 158 | struct perf_evsel *evsel, |
159 | struct hist_browser_timer *hbt) | 159 | struct hist_browser_timer *hbt) |
160 | { | 160 | { |
161 | GtkWidget *window; | 161 | GtkWidget *window; |
162 | GtkWidget *notebook; | 162 | GtkWidget *notebook; |
@@ -226,6 +226,13 @@ int symbol__gtk_annotate(struct symbol *sym, struct map *map, | |||
226 | return 0; | 226 | return 0; |
227 | } | 227 | } |
228 | 228 | ||
229 | int hist_entry__gtk_annotate(struct hist_entry *he, | ||
230 | struct perf_evsel *evsel, | ||
231 | struct hist_browser_timer *hbt) | ||
232 | { | ||
233 | return symbol__gtk_annotate(he->ms.sym, he->ms.map, evsel, hbt); | ||
234 | } | ||
235 | |||
229 | void perf_gtk__show_annotations(void) | 236 | void perf_gtk__show_annotations(void) |
230 | { | 237 | { |
231 | GtkWidget *window; | 238 | GtkWidget *window; |
diff --git a/tools/perf/ui/gtk/gtk.h b/tools/perf/ui/gtk/gtk.h index a72acbc565e0..8576cf194872 100644 --- a/tools/perf/ui/gtk/gtk.h +++ b/tools/perf/ui/gtk/gtk.h | |||
@@ -20,6 +20,9 @@ struct perf_gtk_context { | |||
20 | guint statbar_ctx_id; | 20 | guint statbar_ctx_id; |
21 | }; | 21 | }; |
22 | 22 | ||
23 | int perf_gtk__init(void); | ||
24 | void perf_gtk__exit(bool wait_for_ok); | ||
25 | |||
23 | extern struct perf_gtk_context *pgctx; | 26 | extern struct perf_gtk_context *pgctx; |
24 | 27 | ||
25 | static inline bool perf_gtk__is_active_context(struct perf_gtk_context *ctx) | 28 | static inline bool perf_gtk__is_active_context(struct perf_gtk_context *ctx) |
@@ -48,4 +51,17 @@ static inline GtkWidget *perf_gtk__setup_info_bar(void) | |||
48 | } | 51 | } |
49 | #endif | 52 | #endif |
50 | 53 | ||
54 | struct perf_evsel; | ||
55 | struct perf_evlist; | ||
56 | struct hist_entry; | ||
57 | struct hist_browser_timer; | ||
58 | |||
59 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help, | ||
60 | struct hist_browser_timer *hbt, | ||
61 | float min_pcnt); | ||
62 | int hist_entry__gtk_annotate(struct hist_entry *he, | ||
63 | struct perf_evsel *evsel, | ||
64 | struct hist_browser_timer *hbt); | ||
65 | void perf_gtk__show_annotations(void); | ||
66 | |||
51 | #endif /* _PERF_GTK_H_ */ | 67 | #endif /* _PERF_GTK_H_ */ |
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c index 47d9a571f261..5df5140a9f29 100644 --- a/tools/perf/ui/setup.c +++ b/tools/perf/ui/setup.c | |||
@@ -1,10 +1,64 @@ | |||
1 | #include <pthread.h> | 1 | #include <pthread.h> |
2 | #include <dlfcn.h> | ||
2 | 3 | ||
3 | #include "../util/cache.h" | 4 | #include "../util/cache.h" |
4 | #include "../util/debug.h" | 5 | #include "../util/debug.h" |
5 | #include "../util/hist.h" | 6 | #include "../util/hist.h" |
6 | 7 | ||
7 | pthread_mutex_t ui__lock = PTHREAD_MUTEX_INITIALIZER; | 8 | pthread_mutex_t ui__lock = PTHREAD_MUTEX_INITIALIZER; |
9 | void *perf_gtk_handle; | ||
10 | |||
11 | #ifdef HAVE_GTK2_SUPPORT | ||
12 | static int setup_gtk_browser(void) | ||
13 | { | ||
14 | int (*perf_ui_init)(void); | ||
15 | |||
16 | if (perf_gtk_handle) | ||
17 | return 0; | ||
18 | |||
19 | perf_gtk_handle = dlopen(PERF_GTK_DSO, RTLD_LAZY); | ||
20 | if (perf_gtk_handle == NULL) { | ||
21 | char buf[PATH_MAX]; | ||
22 | scnprintf(buf, sizeof(buf), "%s/%s", LIBDIR, PERF_GTK_DSO); | ||
23 | perf_gtk_handle = dlopen(buf, RTLD_LAZY); | ||
24 | } | ||
25 | if (perf_gtk_handle == NULL) | ||
26 | return -1; | ||
27 | |||
28 | perf_ui_init = dlsym(perf_gtk_handle, "perf_gtk__init"); | ||
29 | if (perf_ui_init == NULL) | ||
30 | goto out_close; | ||
31 | |||
32 | if (perf_ui_init() == 0) | ||
33 | return 0; | ||
34 | |||
35 | out_close: | ||
36 | dlclose(perf_gtk_handle); | ||
37 | return -1; | ||
38 | } | ||
39 | |||
40 | static void exit_gtk_browser(bool wait_for_ok) | ||
41 | { | ||
42 | void (*perf_ui_exit)(bool); | ||
43 | |||
44 | if (perf_gtk_handle == NULL) | ||
45 | return; | ||
46 | |||
47 | perf_ui_exit = dlsym(perf_gtk_handle, "perf_gtk__exit"); | ||
48 | if (perf_ui_exit == NULL) | ||
49 | goto out_close; | ||
50 | |||
51 | perf_ui_exit(wait_for_ok); | ||
52 | |||
53 | out_close: | ||
54 | dlclose(perf_gtk_handle); | ||
55 | |||
56 | perf_gtk_handle = NULL; | ||
57 | } | ||
58 | #else | ||
59 | static inline int setup_gtk_browser(void) { return -1; } | ||
60 | static inline void exit_gtk_browser(bool wait_for_ok __maybe_unused) {} | ||
61 | #endif | ||
8 | 62 | ||
9 | void setup_browser(bool fallback_to_pager) | 63 | void setup_browser(bool fallback_to_pager) |
10 | { | 64 | { |
@@ -17,8 +71,11 @@ void setup_browser(bool fallback_to_pager) | |||
17 | 71 | ||
18 | switch (use_browser) { | 72 | switch (use_browser) { |
19 | case 2: | 73 | case 2: |
20 | if (perf_gtk__init() == 0) | 74 | if (setup_gtk_browser() == 0) |
21 | break; | 75 | break; |
76 | printf("GTK browser requested but could not find %s\n", | ||
77 | PERF_GTK_DSO); | ||
78 | sleep(1); | ||
22 | /* fall through */ | 79 | /* fall through */ |
23 | case 1: | 80 | case 1: |
24 | use_browser = 1; | 81 | use_browser = 1; |
@@ -39,7 +96,7 @@ void exit_browser(bool wait_for_ok) | |||
39 | { | 96 | { |
40 | switch (use_browser) { | 97 | switch (use_browser) { |
41 | case 2: | 98 | case 2: |
42 | perf_gtk__exit(wait_for_ok); | 99 | exit_gtk_browser(wait_for_ok); |
43 | break; | 100 | break; |
44 | 101 | ||
45 | case 1: | 102 | case 1: |
diff --git a/tools/perf/ui/ui.h b/tools/perf/ui/ui.h index 1349d142a005..ab88383f8be8 100644 --- a/tools/perf/ui/ui.h +++ b/tools/perf/ui/ui.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/compiler.h> | 6 | #include <linux/compiler.h> |
7 | 7 | ||
8 | extern pthread_mutex_t ui__lock; | 8 | extern pthread_mutex_t ui__lock; |
9 | extern void *perf_gtk_handle; | ||
9 | 10 | ||
10 | extern int use_browser; | 11 | extern int use_browser; |
11 | 12 | ||
@@ -23,17 +24,6 @@ static inline int ui__init(void) | |||
23 | static inline void ui__exit(bool wait_for_ok __maybe_unused) {} | 24 | static inline void ui__exit(bool wait_for_ok __maybe_unused) {} |
24 | #endif | 25 | #endif |
25 | 26 | ||
26 | #ifdef HAVE_GTK2_SUPPORT | ||
27 | int perf_gtk__init(void); | ||
28 | void perf_gtk__exit(bool wait_for_ok); | ||
29 | #else | ||
30 | static inline int perf_gtk__init(void) | ||
31 | { | ||
32 | return -1; | ||
33 | } | ||
34 | static inline void perf_gtk__exit(bool wait_for_ok __maybe_unused) {} | ||
35 | #endif | ||
36 | |||
37 | void ui__refresh_dimensions(bool force); | 27 | void ui__refresh_dimensions(bool force); |
38 | 28 | ||
39 | #endif /* _PERF_UI_H_ */ | 29 | #endif /* _PERF_UI_H_ */ |
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index f0699e9bcc6f..834b7b57b788 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h | |||
@@ -165,30 +165,6 @@ static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused, | |||
165 | } | 165 | } |
166 | #endif | 166 | #endif |
167 | 167 | ||
168 | #ifdef HAVE_GTK2_SUPPORT | ||
169 | int symbol__gtk_annotate(struct symbol *sym, struct map *map, | ||
170 | struct perf_evsel *evsel, | ||
171 | struct hist_browser_timer *hbt); | ||
172 | |||
173 | static inline int hist_entry__gtk_annotate(struct hist_entry *he, | ||
174 | struct perf_evsel *evsel, | ||
175 | struct hist_browser_timer *hbt) | ||
176 | { | ||
177 | return symbol__gtk_annotate(he->ms.sym, he->ms.map, evsel, hbt); | ||
178 | } | ||
179 | |||
180 | void perf_gtk__show_annotations(void); | ||
181 | #else | ||
182 | static inline int hist_entry__gtk_annotate(struct hist_entry *he __maybe_unused, | ||
183 | struct perf_evsel *evsel __maybe_unused, | ||
184 | struct hist_browser_timer *hbt __maybe_unused) | ||
185 | { | ||
186 | return 0; | ||
187 | } | ||
188 | |||
189 | static inline void perf_gtk__show_annotations(void) {} | ||
190 | #endif | ||
191 | |||
192 | extern const char *disassembler_style; | 168 | extern const char *disassembler_style; |
193 | 169 | ||
194 | #endif /* __PERF_ANNOTATE_H */ | 170 | #endif /* __PERF_ANNOTATE_H */ |
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index ed4f90ebe0d5..20b175808cd3 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -228,20 +228,5 @@ static inline int script_browse(const char *script_opt __maybe_unused) | |||
228 | #define K_SWITCH_INPUT_DATA -3000 | 228 | #define K_SWITCH_INPUT_DATA -3000 |
229 | #endif | 229 | #endif |
230 | 230 | ||
231 | #ifdef HAVE_GTK2_SUPPORT | ||
232 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help, | ||
233 | struct hist_browser_timer *hbt __maybe_unused, | ||
234 | float min_pcnt); | ||
235 | #else | ||
236 | static inline | ||
237 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __maybe_unused, | ||
238 | const char *help __maybe_unused, | ||
239 | struct hist_browser_timer *hbt __maybe_unused, | ||
240 | float min_pcnt __maybe_unused) | ||
241 | { | ||
242 | return 0; | ||
243 | } | ||
244 | #endif | ||
245 | |||
246 | unsigned int hists__sort_list_width(struct hists *self); | 231 | unsigned int hists__sort_list_width(struct hists *self); |
247 | #endif /* __PERF_HIST_H */ | 232 | #endif /* __PERF_HIST_H */ |
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index c29ecaabf461..7fd840bf6b62 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h | |||
@@ -128,6 +128,8 @@ void put_tracing_file(char *file); | |||
128 | #endif | 128 | #endif |
129 | #endif | 129 | #endif |
130 | 130 | ||
131 | #define PERF_GTK_DSO "libperf-gtk.so" | ||
132 | |||
131 | /* General helper functions */ | 133 | /* General helper functions */ |
132 | extern void usage(const char *err) NORETURN; | 134 | extern void usage(const char *err) NORETURN; |
133 | extern void die(const char *err, ...) NORETURN __attribute__((format (printf, 1, 2))); | 135 | extern void die(const char *err, ...) NORETURN __attribute__((format (printf, 1, 2))); |