perf: initial infrasructure for kbuild/kconfig
A message that is not in the archive (sent off-list or not yet received): [email protected]
RFC PATCH 1/7 perf: initial infrasructure for kbuild/kconfig
Need help adapting the build targets from the top level Makefile.
For this RFC series, the commands can be run manually:
$ cd tools/perf $ ../../scripts/kconfig/conf --allyesconfig Pconfig --> generates .config for perf
$ mkdir include/config
$ mkdir include/generated
$ /tmp/kbuild/scripts/kconfig/conf --silentoldconfig Pconfig
--> takes .config and generates include/config/auto.conf and
include/generated/autoconf.hSigned-off-by David Ahern <[email protected]>
--- tools/perf/Makefile | 6 +++++- tools/perf/Pconfig | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 tools/perf/Pconfig
tools/perf/Makefile +5 -1
@@ -5,6 +5,9 @@ all: include config/utilities.mak +# Read in config +-include include/config/auto.conf + # Define V to have a more verbose compile. # # Define O to save output files in a separate directory.
@@ -167,7 +170,7 @@ endif ### --- END CONFIGURATION SECTION --- -BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)util -I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE +BASIC_CFLAGS = -Iinclude -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)util -I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE BASIC_LDFLAGS = # Guard against environment variables
@@ -336,6 +339,7 @@ LIB_H += util/intlist.h LIB_H += util/perf_regs.h LIB_H += util/unwind.h LIB_H += ui/helpline.h +LIB_H += include/generated/autoconf.h LIB_OBJS += $(OUTPUT)util/abspath.o LIB_OBJS += $(OUTPUT)util/alias.o
tools/perf/Pconfig new file +17 -0
@@ -0,0 +1,17 @@ +config NEWT + bool "Enable newt-based TUI" + +config GTK2 + bool "Enable GTK-based UI" + +config LIBUNWIND + bool "Enable support for libunwind" + +config DEMANGLE + bool "Enable support for demangle" + +config LIBPERL + bool "Enable support for perl scripting engine" + +config LIBPYTHON + bool "Enable support for python scripting engine"
Signature · 1 line
1.7.10.1
RFC PATCH 2/7 perf: make perl support based on CONFIG_LIBPERL
In reply to a message not in the archiveSigned-off-by David Ahern <[email protected]>
--- tools/perf/Makefile | 25 +++++++++++-------------- tools/perf/config/feature-tests.mak | 2 +- tools/perf/util/trace-event-scripting.c | 13 +++++++------ 3 files changed, 19 insertions(+), 21 deletions(-)
tools/perf/Makefile +11 -14
@@ -16,8 +16,6 @@ include config/utilities.mak # # Define CROSS_COMPILE as prefix name of compiler if you want cross-builds. # -# Define NO_LIBPERL to disable perl script extension. -# # Define NO_LIBPYTHON to disable python script extension. # # Define PYTHON to point to the python binary if the default
@@ -614,23 +612,22 @@ else endif endif -ifdef NO_LIBPERL - BASIC_CFLAGS += -DNO_LIBPERL -else +ifdef CONFIG_LIBPERL PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) - - ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED)),y) - BASIC_CFLAGS += -DNO_LIBPERL - else - ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS) - EXTLIBS += $(PERL_EMBED_LIBADD) - LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o - LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o - endif + ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED)),y) + $(warning perl module ExtUtils::Embed is not installed) + $(warning Install it or unset CONFIG_LIBPERL to continue) + $(error ) + endif + + ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS) + EXTLIBS += $(PERL_EMBED_LIBADD) + LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o + LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o endif disable-python = $(eval $(disable-python_code))
tools/perf/config/feature-tests.mak +1 -1
@@ -93,7 +93,7 @@ int main(void) endef endif -ifndef NO_LIBPERL +ifdef CONFIG_LIBPERL define SOURCE_PERL_EMBED #include <EXTERN.h> #include <perl.h>
tools/perf/util/trace-event-scripting.c +7 -6
@@ -27,6 +27,7 @@#include "../perf.h" #include "util.h" #include "trace-event.h" +#include "generated/autoconf.h" struct scripting_context *scripting_context;
@@ -108,7 +109,7 @@ void setup_python_scripting(void)static void print_perl_unsupported_msg (void ) {fprintf (stderr,"Perl scripting not supported." -" Install libperl and rebuild perf to enable it.\n" +" Enable CONFIG_LIBPERL and rebuild perf.\n" "For example:\n # apt-get install libperl-dev (ubuntu)" "\n # yum install 'perl(ExtUtils::Embed)' (Fedora)" "\n etc.\n" );
@@ -153,16 +154,16 @@ static void register_perl_scripting(struct scripting_ops *scripting_ops) scripting_context =malloc (sizeof (struct scripting_context )); } -#ifdef NO_LIBPERL +#ifdef CONFIG_LIBPERL +extern struct scripting_ops perl_scripting_ops; +void setup_perl_scripting (void ) { -register_perl_scripting (&perl_scripting_unsupported_ops); +register_perl_scripting (&perl_scripting_ops); }#else -extern struct scripting_ops perl_scripting_ops; -void setup_perl_scripting (void ) { -register_perl_scripting (&perl_scripting_ops); +register_perl_scripting (&perl_scripting_unsupported_ops); }#endif
Signature · 1 line
1.7.10.1
RFC PATCH 3/7 perf: make python support based on CONFIG_LIBPYTHON
In reply to a message not in the archiveSigned-off-by David Ahern <[email protected]>
--- tools/perf/Makefile | 117 ++++++++++++++----------------- tools/perf/config/feature-tests.mak | 2 +- tools/perf/util/trace-event-scripting.c | 17 ++--- 3 files changed, 60 insertions(+), 76 deletions(-)
tools/perf/Makefile +52 -65
@@ -16,8 +16,6 @@ include config/utilities.mak # # Define CROSS_COMPILE as prefix name of compiler if you want cross-builds. # -# Define NO_LIBPYTHON to disable python script extension. -# # Define PYTHON to point to the python binary if the default # `python' is not correct; for example: PYTHON=python2 #
@@ -630,78 +628,67 @@ ifdef CONFIG_LIBPERL LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o endif -disable-python = $(eval $(disable-python_code)) -define disable-python_code - BASIC_CFLAGS += -DNO_LIBPYTHON - $(if $(1),$(warning No $(1) was found)) - $(warning Python support won't be built) -endef - -override PYTHON := \ - $(call get-executable-or-default,PYTHON,python) - -ifndef PYTHON - $(call disable-python,python interpreter) - python-clean := -else +ifdef CONFIG_LIBPYTHON + override PYTHON := \ + $(call get-executable-or-default,PYTHON,python) - PYTHON_WORD := $(call shell-wordify,$(PYTHON)) + ifndef PYTHON + $(warning python interpreter not found.) + $(warning Install it or unset CONFIG_LIBPYTHON to continue.) + $(error ) + endif - # python extension build directories - PYTHON_EXTBUILD := $(OUTPUT)python_ext_build/ - PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/ - PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/ - export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP + PYTHON_WORD := $(call shell-wordify,$(PYTHON)) - python-clean := rm -rf $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so + # python extension build directories + PYTHON_EXTBUILD := $(OUTPUT)python_ext_build/ + PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/ + PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/ + export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP - ifdef NO_LIBPYTHON - $(call disable-python) - else + python-clean := rm -rf $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so override PYTHON_CONFIG := \ - $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config) + $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config) ifndef PYTHON_CONFIG - $(call disable-python,python-config tool) - else - - PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) - - PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) - PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) - PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) - PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) - FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) - - ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED)),y) - $(call disable-python,Python.h (for Python 2.x)) - else - - ifneq ($(call try-cc,$(SOURCE_PYTHON_VERSION),$(FLAGS_PYTHON_EMBED)),y) - $(warning Python 3 is not yet supported; please set) - $(warning PYTHON and/or PYTHON_CONFIG appropriately.) - $(warning If you also have Python 2 installed, then) - $(warning try something like:) - $(warning $(and ,)) - $(warning $(and ,) make PYTHON=python2) - $(warning $(and ,)) - $(warning Otherwise, disable Python support entirely:) - $(warning $(and ,)) - $(warning $(and ,) make NO_LIBPYTHON=1) - $(warning $(and ,)) - $(error $(and ,)) - else - ALL_LDFLAGS += $(PYTHON_EMBED_LDFLAGS) - EXTLIBS += $(PYTHON_EMBED_LIBADD) - LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o - LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o - LANG_BINDINGS += $(OUTPUT)python/perf.so - endif - - endif + $(warning python-config not found.) + $(warning Install it or unset CONFIG_LIBPYTHON to continue.) + $(error ) endif - endif + + PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) + + PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) + PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) + PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) + PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) + FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) + + ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED)),y) + $(warning Failed to detect python development kit.) + $(warning Install it or unset CONFIG_LIBPYTHON to continue.) + $(warning e.g., apt-get install python-dev (ubuntu).) + $(warning yum install python-devel (Fedora).) + $(error ) + endif + + ifneq ($(call try-cc,$(SOURCE_PYTHON_VERSION),$(FLAGS_PYTHON_EMBED)),y) + $(warning Python 3 is not yet supported; please set) + $(warning PYTHON and/or PYTHON_CONFIG appropriately.) + $(warning If you also have Python 2 installed, then) + $(warning try something like:) + $(warning $(and ,)) + $(warning $(and ,) make PYTHON=python2) + $(warning $(and ,)) + $(warning Otherwise, disable Python support entirely by unsetting CONFIG_LIBPYTHON.) + endif + + ALL_LDFLAGS += $(PYTHON_EMBED_LDFLAGS) + EXTLIBS += $(PYTHON_EMBED_LIBADD) + LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o + LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o + LANG_BINDINGS += $(OUTPUT)python/perf.so endif ifdef NO_DEMANGLE
tools/perf/config/feature-tests.mak +1 -1
@@ -106,7 +106,7 @@ return 0; endef endif -ifndef NO_LIBPYTHON +ifdef CONFIG_LIBPYTHON define SOURCE_PYTHON_VERSION #include <Python.h> #if PY_VERSION_HEX >= 0x03000000
tools/perf/util/trace-event-scripting.c +7 -10
@@ -46,11 +46,8 @@ static void process_event_unsupported(union perf_event *event __unused,static void print_python_unsupported_msg (void ) { -fprintf (stderr,"Python scripting not supported." -" Install libpython and rebuild perf to enable it.\n" -"For example:\n # apt-get install python-dev (ubuntu)" -"\n # yum install python-devel (Fedora)" -"\n etc.\n" ); +fprintf (stderr,"Python scripting not supported.\n" +"Enable CONFIG_LIBPYTHON and rebuild perf to enable it.\n" ); } static int python_start_script_unsupported(const char *script __unused,
@@ -92,17 +89,17 @@ static void register_python_scripting(struct scripting_ops *scripting_ops) scripting_context =malloc (sizeof (struct scripting_context )); } -#ifdef NO_LIBPYTHON +#ifdef CONFIG_LIBPYTHON +extern struct scripting_ops python_scripting_ops; +void setup_python_scripting (void ) { -register_python_scripting (&python_scripting_unsupported_ops); +register_python_scripting (&python_scripting_ops); }#else -extern struct scripting_ops python_scripting_ops; -void setup_python_scripting (void ) { -register_python_scripting (&python_scripting_ops); +register_python_scripting (&python_scripting_unsupported_ops); }#endif
Signature · 1 line
1.7.10.1
RFC PATCH 4/7 perf: make gtk2 support based on CONFIG_GTK2
In reply to a message not in the archiveSigned-off-by David Ahern <[email protected]>
--- tools/perf/Makefile | 46 ++++++++++++++++------------------- tools/perf/config/feature-tests.mak | 2 +- tools/perf/ui/helpline.h | 9 ++++--- tools/perf/util/cache.h | 13 +++++----- tools/perf/util/debug.c | 2 +- tools/perf/util/debug.h | 7 +++--- tools/perf/util/hist.h | 12 ++++----- 7 files changed, 45 insertions(+), 46 deletions(-)
tools/perf/Makefile +21 -25
@@ -36,8 +36,6 @@ include config/utilities.mak # # Define NO_NEWT if you do not want TUI support. # -# Define NO_GTK2 if you do not want GTK+ GUI support. -# # Define NO_DEMANGLE if you do not want C++ symbol demangling. # # Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
@@ -585,29 +583,27 @@ else endif endif -ifdef NO_GTK2 - BASIC_CFLAGS += -DNO_GTK2_SUPPORT -else - FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) - ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y) - msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); - BASIC_CFLAGS += -DNO_GTK2_SUPPORT - else - ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2)),y) - BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR - endif - BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null) - EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null) - LIB_OBJS += $(OUTPUT)ui/gtk/browser.o - LIB_OBJS += $(OUTPUT)ui/gtk/setup.o - LIB_OBJS += $(OUTPUT)ui/gtk/util.o - LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o - # Make sure that it'd be included only once. - ifneq ($(findstring -DNO_NEWT_SUPPORT,$(BASIC_CFLAGS)),) - LIB_OBJS += $(OUTPUT)ui/setup.o - LIB_OBJS += $(OUTPUT)ui/util.o - endif - endif +ifdef CONFIG_GTK2 + FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) + ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y) + $(warning GTK2 not found. Please install gtk2-devel or libgtk2.0-dev or unset CONFIG_GTK2) + $(error ) + endif + ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2)),y) + BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR + endif + BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null) + EXTLIBS += $(shell pkg-config --libs gtk+-2.0) + LIB_OBJS += $(OUTPUT)ui/gtk/browser.o + LIB_OBJS += $(OUTPUT)ui/gtk/setup.o + LIB_OBJS += $(OUTPUT)ui/gtk/util.o + LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o + + # Make sure that it'd be included only once. + ifneq ($(findstring -DNO_NEWT_SUPPORT,$(BASIC_CFLAGS)),) + LIB_OBJS += $(OUTPUT)ui/setup.o + LIB_OBJS += $(OUTPUT)ui/util.o + endif endif ifdef CONFIG_LIBPERL
tools/perf/config/feature-tests.mak +1 -1
@@ -65,7 +65,7 @@ int main(void) endef endif -ifndef NO_GTK2 +ifdef CONFIG_GTK2 define SOURCE_GTK2 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #include <gtk/gtk.h>
tools/perf/ui/helpline.h +5 -4
@@ -5,6 +5,7 @@#include <stdarg.h> #include "../util/cache.h" +#include "generated/autoconf.h" struct ui_helpline {void (*pop)(void );
@@ -34,14 +35,14 @@ extern char ui_helpline__last_msg[];int ui_helpline__show_help (const char *format,va_list ap);#endif /* NO_NEWT_SUPPORT */ -#ifdef NO_GTK2_SUPPORT +#ifdef CONFIG_GTK2 +int perf_gtk__show_helpline (const char *format,va_list ap); +#else static inline int perf_gtk__show_helpline (const char *format__used ,va_list ap__used ) {return 0 ; } -#else -int perf_gtk__show_helpline (const char *format,va_list ap); -#endif /* NO_GTK2_SUPPORT */ +#endif /* CONFIG_GTK2 */ #endif /* _PERF_UI_HELPLINE_H_ */
tools/perf/util/cache.h +7 -6
@@ -5,6 +5,7 @@#include "util.h" #include "strbuf.h" #include "../perf.h" +#include "generated/autoconf.h" #define CMD_EXEC_PATH "--exec-path"#define CMD_PERF_DIR "--perf-dir="
@@ -33,7 +34,7 @@ extern int pager_use_color;extern int use_browser; -#if defined(NO_NEWT_SUPPORT ) && defined(NO_GTK2_SUPPORT ) +#if defined(NO_NEWT_SUPPORT ) && !defined(CONFIG_GTK2 )static inline void setup_browser (bool fallback_to_pager) {if (fallback_to_pager)
@@ -55,17 +56,17 @@ int ui__init(void);void ui__exit (bool wait_for_ok);#endif -#ifdef NO_GTK2_SUPPORT +#ifdef CONFIG_GTK2 +int perf_gtk__init (void ); +void perf_gtk__exit (bool wait_for_ok); +#else static inline int perf_gtk__init (void ) {return -1 ; }static inline void perf_gtk__exit (bool wait_for_ok__used ) {} -#else -int perf_gtk__init (void ); -void perf_gtk__exit (bool wait_for_ok);#endif -#endif /* NO_NEWT_SUPPORT && NO_GTK2_SUPPORT */ +#endif /* NO_NEWT_SUPPORT && CONFIG_GTK2 */ char *alias_lookup (const char *alias);int split_cmdline (char *cmdline,const char ***argv);
tools/perf/util/debug.c +1 -1
@@ -49,7 +49,7 @@ int dump_printf(const char *fmt, ...)return ret; } -#if defined(NO_NEWT_SUPPORT ) && defined(NO_GTK2_SUPPORT ) +#if defined(NO_NEWT_SUPPORT ) && !defined(CONFIG_GTK2 )int ui__warning (const char *format, ...) {va_list args;
tools/perf/util/debug.h +4 -3
@@ -5,6 +5,7 @@#include <stdbool.h> #include "event.h" #include "../ui/helpline.h" +#include "generated/autoconf.h" extern int verbose;extern bool quiet, dump_trace;
@@ -15,7 +16,7 @@ void trace_event(union perf_event *event);struct ui_progress ;struct perf_error_ops ; -#if defined(NO_NEWT_SUPPORT ) && defined(NO_GTK2_SUPPORT ) +#if defined(NO_NEWT_SUPPORT ) && !defined(CONFIG_GTK2 )static inline void ui_progress__update (u64 curr__used ,u64 total__used ,const char *title__used ) {}
@@ -33,13 +34,13 @@ perf_error__unregister(struct perf_error_ops *eops __used) return 0; } -#else /* NO_NEWT_SUPPORT && NO_GTK2_SUPPORT */ +#else /* NO_NEWT_SUPPORT && !CONFIG_GTK2 */ #include "../ui/progress.h" int ui__error (const char *format, ...) __attribute__((format (printf,1 ,2 )));#include "../ui/util.h" -#endif /* NO_NEWT_SUPPORT && NO_GTK2_SUPPORT */ +#endif /* NO_NEWT_SUPPORT && !CONFIG_GTK2 */ int ui__warning (const char *format, ...) __attribute__((format (printf,1 ,2 )));int ui__error_paranoid (void );
tools/perf/util/hist.h +6 -6
@@ -4,6 +4,7 @@#include <linux/types.h> #include <pthread.h> #include "callchain.h" +#include "generated/autoconf.h" extern struct callchain_param callchain_param;
@@ -146,7 +147,11 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, int refresh);#endif -#ifdef NO_GTK2_SUPPORT +#ifdef CONFIG_GTK2 +int perf_evlist__gtk_browse_hists (struct perf_evlist *evlist,const char *help, +void (*timer)(void *arg),void *arg, +int refresh); +#else static inline int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __used, const char *help __used,
@@ -156,11 +161,6 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __used, {return 0 ; } - -#else -int perf_evlist__gtk_browse_hists (struct perf_evlist *evlist,const char *help, -void (*timer)(void *arg),void *arg, -int refresh);#endif unsigned int hists__sort_list_width (struct hists *self);
Signature · 1 line
1.7.10.1
RFC PATCH 5/7 perf: make newt support based on CONFIG_NEWT
In reply to a message not in the archiveSigned-off-by David Ahern <[email protected]>
--- tools/perf/Makefile | 60 ++++++++++++++++------------------- tools/perf/config/feature-tests.mak | 2 +- tools/perf/ui/gtk/util.c | 4 +-- tools/perf/ui/helpline.h | 10 +++--- tools/perf/util/annotate.h | 9 +++--- tools/perf/util/cache.h | 12 +++---- tools/perf/util/debug.c | 2 +- tools/perf/util/debug.h | 6 ++-- tools/perf/util/hist.h | 18 +++++------ 9 files changed, 60 insertions(+), 63 deletions(-)
tools/perf/Makefile +28 -32
@@ -34,8 +34,6 @@ include config/utilities.mak # # Define WERROR=0 to disable treating any warnings as errors. # -# Define NO_NEWT if you do not want TUI support. -# # Define NO_DEMANGLE if you do not want C++ symbol demangling. # # Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
@@ -552,35 +550,33 @@ else LIB_OBJS += $(OUTPUT)util/unwind.o endif -ifdef NO_NEWT - BASIC_CFLAGS += -DNO_NEWT_SUPPORT -else - FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt - ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT)),y) - msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev); - BASIC_CFLAGS += -DNO_NEWT_SUPPORT - else - # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h - BASIC_CFLAGS += -I/usr/include/slang - EXTLIBS += -lnewt -lslang - LIB_OBJS += $(OUTPUT)ui/setup.o - LIB_OBJS += $(OUTPUT)ui/browser.o - LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o - LIB_OBJS += $(OUTPUT)ui/browsers/hists.o - LIB_OBJS += $(OUTPUT)ui/browsers/map.o - LIB_OBJS += $(OUTPUT)ui/progress.o - LIB_OBJS += $(OUTPUT)ui/util.o - LIB_OBJS += $(OUTPUT)ui/tui/setup.o - LIB_OBJS += $(OUTPUT)ui/tui/util.o - LIB_OBJS += $(OUTPUT)ui/tui/helpline.o - LIB_H += ui/browser.h - LIB_H += ui/browsers/map.h - LIB_H += ui/keysyms.h - LIB_H += ui/libslang.h - LIB_H += ui/progress.h - LIB_H += ui/util.h - LIB_H += ui/ui.h - endif +ifdef CONFIG_NEWT + FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt + ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT)),y) + $(warning newt not found. Please install newt-devel or libnewt-dev or disable CONFIG_NEWT) + $(error ) + endif + + # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h + BASIC_CFLAGS += -I/usr/include/slang + EXTLIBS += -lnewt -lslang + LIB_OBJS += $(OUTPUT)ui/setup.o + LIB_OBJS += $(OUTPUT)ui/browser.o + LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o + LIB_OBJS += $(OUTPUT)ui/browsers/hists.o + LIB_OBJS += $(OUTPUT)ui/browsers/map.o + LIB_OBJS += $(OUTPUT)ui/progress.o + LIB_OBJS += $(OUTPUT)ui/util.o + LIB_OBJS += $(OUTPUT)ui/tui/setup.o + LIB_OBJS += $(OUTPUT)ui/tui/util.o + LIB_OBJS += $(OUTPUT)ui/tui/helpline.o + LIB_H += ui/browser.h + LIB_H += ui/browsers/map.h + LIB_H += ui/keysyms.h + LIB_H += ui/libslang.h + LIB_H += ui/progress.h + LIB_H += ui/util.h + LIB_H += ui/ui.h endif ifdef CONFIG_GTK2
@@ -600,7 +596,7 @@ ifdef CONFIG_GTK2 LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o # Make sure that it'd be included only once. - ifneq ($(findstring -DNO_NEWT_SUPPORT,$(BASIC_CFLAGS)),) + ifndef CONFIG_NEWT LIB_OBJS += $(OUTPUT)ui/setup.o LIB_OBJS += $(OUTPUT)ui/util.o endif
tools/perf/config/feature-tests.mak +1 -1
@@ -52,7 +52,7 @@ int main(void) } endef -ifndef NO_NEWT +ifdef CONFIG_NEWT define SOURCE_NEWT #include <newt.h>
tools/perf/ui/gtk/util.c +2 -2
@@ -114,9 +114,9 @@ struct perf_error_ops perf_gtk_eops = {/* * FIXME: Functions below should be implemented properly. -* For now, just add stubs for NO_NEWT=1 build. +* For now, just add stubs for !CONFIG_NEWT build. */ -#ifdef NO_NEWT_SUPPORT +#ifndef CONFIG_NEWT void ui_progress__update (u64 curr__used ,u64 total__used ,const char *title__used ) {
tools/perf/ui/helpline.h +5 -5
@@ -24,16 +24,16 @@ void ui_helpline__puts(const char *msg);extern char ui_helpline__current[512 ]; -#ifdef NO_NEWT_SUPPORT +#ifdef CONFIG_NEWT +extern char ui_helpline__last_msg[]; +int ui_helpline__show_help (const char *format,va_list ap); +#else static inline int ui_helpline__show_help (const char *format__used ,va_list ap__used ) {return 0 ; } -#else -extern char ui_helpline__last_msg[]; -int ui_helpline__show_help (const char *format,va_list ap); -#endif /* NO_NEWT_SUPPORT */ +#endif /* CONFIG_NEWT */ #ifdef CONFIG_GTK2 int perf_gtk__show_helpline (const char *format,va_list ap);
tools/perf/util/annotate.h +5 -4
@@ -7,6 +7,7 @@#include "symbol.h" #include <linux/list.h> #include <linux/rbtree.h> +#include "generated/autoconf.h" struct ins ;
@@ -137,7 +138,10 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx, bool print_lines, bool full_paths, int min_pcnt, int max_lines); -#ifdef NO_NEWT_SUPPORT +#ifdef CONFIG_NEWT +int symbol__tui_annotate (struct symbol *sym,struct map *map,int evidx, +void (*timer)(void *arg),void *arg,int delay_secs); +#else static inline int symbol__tui_annotate(struct symbol *sym __used, struct map *map __used, int evidx __used,
@@ -146,9 +150,6 @@ static inline int symbol__tui_annotate(struct symbol *sym __used, {return 0 ; } -#else -int symbol__tui_annotate (struct symbol *sym,struct map *map,int evidx, -void (*timer)(void *arg),void *arg,int delay_secs);#endif extern const char *disassembler_style;
tools/perf/util/cache.h +6 -6
@@ -34,7 +34,7 @@ extern int pager_use_color;extern int use_browser; -#if defined(NO_NEWT_SUPPORT ) && !defined(CONFIG_GTK2 ) +#if !defined(CONFIG_NEWT ) && !defined(CONFIG_GTK2 )static inline void setup_browser (bool fallback_to_pager) {if (fallback_to_pager)
@@ -45,15 +45,15 @@ static inline void exit_browser(bool wait_for_ok __used) {}void setup_browser (bool fallback_to_pager);void exit_browser (bool wait_for_ok); -#ifdef NO_NEWT_SUPPORT +#ifdef CONFIG_NEWT +int ui__init (void ); +void ui__exit (bool wait_for_ok); +#else static inline int ui__init (void ) {return -1 ; }static inline void ui__exit (bool wait_for_ok__used ) {} -#else -int ui__init (void ); -void ui__exit (bool wait_for_ok);#endif #ifdef CONFIG_GTK2
@@ -66,7 +66,7 @@ static inline int perf_gtk__init(void) }static inline void perf_gtk__exit (bool wait_for_ok__used ) {}#endif -#endif /* NO_NEWT_SUPPORT && CONFIG_GTK2 */ +#endif /* CONFIG_NEWT && CONFIG_GTK2 */ char *alias_lookup (const char *alias);int split_cmdline (char *cmdline,const char ***argv);
tools/perf/util/debug.c +1 -1
@@ -49,7 +49,7 @@ int dump_printf(const char *fmt, ...)return ret; } -#if defined(NO_NEWT_SUPPORT ) && !defined(CONFIG_GTK2 ) +#if !defined(CONFIG_NEWT ) && !defined(CONFIG_GTK2 )int ui__warning (const char *format, ...) {va_list args;
tools/perf/util/debug.h +3 -3
@@ -16,7 +16,7 @@ void trace_event(union perf_event *event);struct ui_progress ;struct perf_error_ops ; -#if defined(NO_NEWT_SUPPORT ) && !defined(CONFIG_GTK2 ) +#if !defined(CONFIG_NEWT ) && !defined(CONFIG_GTK2 )static inline void ui_progress__update (u64 curr__used ,u64 total__used ,const char *title__used ) {}
@@ -34,13 +34,13 @@ perf_error__unregister(struct perf_error_ops *eops __used) return 0; } -#else /* NO_NEWT_SUPPORT && !CONFIG_GTK2 */ +#else /* !CONFIG_NEWT && !CONFIG_GTK2 */ #include "../ui/progress.h" int ui__error (const char *format, ...) __attribute__((format (printf,1 ,2 )));#include "../ui/util.h" -#endif /* NO_NEWT_SUPPORT && !CONFIG_GTK2 */ +#endif /* !CONFIG_NEWT && !CONFIG_GTK2 */ int ui__warning (const char *format, ...) __attribute__((format (printf,1 ,2 )));int ui__error_paranoid (void );
tools/perf/util/hist.h +9 -9
@@ -116,7 +116,15 @@ bool hists__new_col_len(struct hists *self, enum hist_column col, u16 len);struct perf_evlist ; -#ifdef NO_NEWT_SUPPORT +#ifdef CONFIG_NEWT +#include "../ui/keysyms.h" +int hist_entry__tui_annotate (struct hist_entry *he,int evidx, +void (*timer)(void *arg),void *arg,int delay_secs); + +int perf_evlist__tui_browse_hists (struct perf_evlist *evlist,const char *help, +void (*timer)(void *arg),void *arg, +int refresh); +#else static inline int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __used, const char *help __used,
@@ -137,14 +145,6 @@ static inline int hist_entry__tui_annotate(struct hist_entry *self __used, }#define K_LEFT -1#define K_RIGHT -2 -#else -#include "../ui/keysyms.h" -int hist_entry__tui_annotate (struct hist_entry *he,int evidx, -void (*timer)(void *arg),void *arg,int delay_secs); - -int perf_evlist__tui_browse_hists (struct perf_evlist *evlist,const char *help, -void (*timer)(void *arg),void *arg, -int refresh);#endif #ifdef CONFIG_GTK2
Signature · 1 line
1.7.10.1
RFC PATCH 6/7 perf: make dwarf unwind support based on CONFIG_LIBUNWIND
In reply to a message not in the archiveSigned-off-by David Ahern <[email protected]>
--- tools/perf/Makefile | 43 +++++++++++++++-------------------- tools/perf/arch/x86/Makefile | 2 +- tools/perf/builtin-record.c | 15 ++++++------ tools/perf/config/feature-tests.mak | 2 +- tools/perf/util/unwind.h | 5 ++-- 5 files changed, 31 insertions(+), 36 deletions(-)
tools/perf/Makefile +18 -25
@@ -37,9 +37,6 @@ include config/utilities.mak # Define NO_DEMANGLE if you do not want C++ symbol demangling. # # Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds) -# -# Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf -# backtrace post unwind. $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
@@ -480,20 +477,25 @@ ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y) endif endif # NO_LIBELF -ifndef NO_LIBUNWIND -# for linking with debug library, run like: -# make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ -ifdef LIBUNWIND_DIR - LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include - LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib -endif +ifdef CONFIG_LIBUNWIND + # for linking with debug library, run like: + # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ + ifdef LIBUNWIND_DIR + LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include + LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib + endif -FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS) -ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND)),y) - msg := $(warning No libunwind found. Please install libunwind >= 0.99); - NO_LIBUNWIND := 1 -endif # Libunwind support -endif # NO_LIBUNWIND + FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS) + ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND)),y) + $(warning No libunwind found. Please install libunwind >= 0.99) + $(error ) + endif # Libunwind support + + EXTLIBS += $(LIBUNWIND_LIBS) + BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS) + BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS) + LIB_OBJS += $(OUTPUT)util/unwind.o +endif # CONFIG_LIBUNWIND -include arch/$(ARCH)/Makefile
@@ -541,15 +543,6 @@ endif # PERF_HAVE_DWARF_REGS endif # NO_DWARF endif # NO_LIBELF -ifdef NO_LIBUNWIND - BASIC_CFLAGS += -DNO_LIBUNWIND_SUPPORT -else - EXTLIBS += $(LIBUNWIND_LIBS) - BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS) - BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS) - LIB_OBJS += $(OUTPUT)util/unwind.o -endif - ifdef CONFIG_NEWT FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT)),y)
tools/perf/arch/x86/Makefile +1 -1
@@ -2,7 +2,7 @@ ifndef NO_DWARF PERF_HAVE_DWARF_REGS := 1 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o endif -ifndef NO_LIBUNWIND +ifdef CONFIG_LIBUNWIND LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind.o endif LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
tools/perf/builtin-record.c +8 -7
@@ -26,6 +26,7 @@#include "util/symbol.h" #include "util/cpumap.h" #include "util/thread_map.h" +#include "generated/autoconf.h" #include <unistd.h> #include <sched.h>
@@ -33,11 +34,11 @@#define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: " -#ifdef NO_LIBUNWIND_SUPPORT -static char callchain_help[] =CALLCHAIN_HELP "[fp]" ; -#else +#ifdef CONFIG_LIBUNWIND static unsigned long default_stack_dump_size =8192 ;static char callchain_help[] =CALLCHAIN_HELP "[fp] dwarf" ; +#else +static char callchain_help[] =CALLCHAIN_HELP "[fp]" ;#endif enum write_mode_t {
@@ -738,7 +739,7 @@ error:return ret; } -#ifndef NO_LIBUNWIND_SUPPORT +#ifdef CONFIG_LIBUNWIND static int get_stack_size (char *str,unsigned long *_size) {char *endptr;
@@ -764,7 +765,7 @@ static int get_stack_size(char *str, unsigned long *_size) max_size, str);return -1 ; } -#endif /* !NO_LIBUNWIND_SUPPORT */ +#endif /* CONFIG_LIBUNWIND */ static int parse_callchain_opt(const struct option *opt __used, const char *arg,
@@ -803,7 +804,7 @@ parse_callchain_opt(const struct option *opt __used, const char *arg, "needed for -g fp\n");break ; -#ifndef NO_LIBUNWIND_SUPPORT +#ifdef CONFIG_LIBUNWIND /* Dwarf style */ }else if (!strncmp (name,"dwarf" ,sizeof ("dwarf" ))) { ret =0 ;
@@ -821,7 +822,7 @@ parse_callchain_opt(const struct option *opt __used, const char *arg,if (!ret)pr_debug ("callchain: stack dump size %d\n" , rec->opts.stack_dump_size); -#endif /* !NO_LIBUNWIND_SUPPORT */ +#endif /* CONFIG_LIBUNWIND */ }else {pr_err ("callchain: Unknown -g option " "value: %s\n" , arg);
tools/perf/config/feature-tests.mak +1 -1
@@ -155,7 +155,7 @@ int main(void) } endef -ifndef NO_LIBUNWIND +ifdef CONFIG_LIBUNWIND define SOURCE_LIBUNWIND #include <libunwind.h> #include <stdlib.h>
tools/perf/util/unwind.h +3 -2
@@ -4,6 +4,7 @@#include "types.h" #include "event.h" #include "symbol.h" +#include "generated/autoconf.h" struct unwind_entry {struct map *map;
@@ -13,7 +14,7 @@ struct unwind_entry {typedef int (*unwind_entry_cb_t )(struct unwind_entry *entry,void *arg); -#ifndef NO_LIBUNWIND_SUPPORT +#ifdef CONFIG_LIBUNWIND int unwind__get_entries(unwind_entry_cb_t cb, void *arg, struct machine *machine, struct thread *thread,
@@ -30,5 +31,5 @@ unwind__get_entries(unwind_entry_cb_t cb __used, void *arg __used, {return 0 ; } -#endif /* NO_LIBUNWIND_SUPPORT */ +#endif /* CONFIG_LIBUNWIND */ #endif /* __UNWIND_H */
Signature · 1 line
1.7.10.1
RFC PATCH 7/7 perf: make demangle support based on CONFIG_DEMANGLE
In reply to a message not in the archiveSigned-off-by David Ahern <[email protected]>
--- tools/perf/Makefile | 25 ++++++++++++++----------- tools/perf/util/symbol.h | 6 +++--- 2 files changed, 17 insertions(+), 14 deletions(-)
tools/perf/Makefile +14 -11
@@ -34,8 +34,6 @@ include config/utilities.mak # # Define WERROR=0 to disable treating any warnings as errors. # -# Define NO_DEMANGLE if you do not want C++ symbol demangling. -# # Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds) $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
@@ -459,9 +457,14 @@ PYRF_OBJS += $(OUTPUT)util/xyarray.o -include config.mak.autogen -include config.mak +ifdef CONFIG_DEMANGLE + ifdef NO_LIBELF + $(error CONFIG_DEMANGLE requires LIBELF) + endif +endif + ifdef NO_LIBELF NO_DWARF := 1 - NO_DEMANGLE := 1 NO_LIBUNWIND := 1 else FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
@@ -472,7 +475,9 @@ ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y) else NO_LIBELF := 1 NO_DWARF := 1 - NO_DEMANGLE := 1 + ifdef CONFIG_DEMANGLE + $(error CONFIG_DEMANGLE requires elf support) + endif endif endif endif # NO_LIBELF
@@ -676,13 +681,11 @@ ifdef CONFIG_LIBPYTHON LANG_BINDINGS += $(OUTPUT)python/perf.so endif -ifdef NO_DEMANGLE - BASIC_CFLAGS += -DNO_DEMANGLE -else - ifdef HAVE_CPLUS_DEMANGLE +ifdef CONFIG_DEMANGLE + ifdef HAVE_CPLUS_DEMANGLE EXTLIBS += -liberty BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE - else + else FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD)) ifeq ($(has_bfd),y)
@@ -704,8 +707,8 @@ else EXTLIBS += -liberty BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE else - msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling) - BASIC_CFLAGS += -DNO_DEMANGLE + $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling) + $(error ) endif endif endif
tools/perf/util/symbol.h +3 -3
@@ -25,14 +25,14 @@ static inline char *bfd_demangle(void __used *v, const char *c, int i) return cplus_demangle(c, i); }#else -#ifdef NO_DEMANGLE +#ifdef CONFIG_DEMANGLE +#include <bfd.h> +#else static inline char *bfd_demangle (void __used *v,const char __used *c,int __used i) {return NULL ; } -#else -#include <bfd.h> #endif #endif
Signature · 1 line
1.7.10.1