Skip to contentSkip to conversation

perf tools: Factor features display code

RFC In review Jiri Olsa 4 participants 16 messages Feb 19, 2014 – Feb 27, 2014 perf events

lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

cover perf tools: Factor features display code

hi,
sending factored code for detected features display.

The main reason for this was the rest of the libdw DWARF unwind patchset, so I attached it as well to show up the benefit (patch 5).

Basically I'm splitting the detected features output to 'detected libraries' (displayed now by default) and the rest. Please check patch 1 changelog for all the factoring details.

The factored code now allows the detection code to easily display which of the DWARF unwind libraries is compiled in.

It passed tests/make suite.

You can try in here:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/libdw_unwind10

thanks for comments,
jirka

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc David Ahern <[email protected]>
Cc Jean Pihet <[email protected]>

---
Jiri Olsa (6):
perf tools: Factor features display code perf tools: Add variable display for VF make output perf tools: Add feature check for libdw dwarf unwind perf tools: Add libdw DWARF post unwind support perf tools: Setup default dwarf post unwinder perf tests: Add NO_LIBDW_DWARF_UNWIND make test

 tools/perf/Makefile.perf                                   |  14 ++++-
 tools/perf/arch/x86/Makefile                               |   5 ++
 tools/perf/arch/x86/util/unwind-libdw.c                    |  51 ++++++++++++++++
 tools/perf/config/Makefile                                 | 232 ++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------
 tools/perf/config/feature-checks/Makefile                  |   6 +-
 tools/perf/config/feature-checks/test-all.c                |   5 ++
 tools/perf/config/feature-checks/test-libdw-dwarf-unwind.c |  13 ++++
 tools/perf/tests/make                                      |   3 +
 tools/perf/util/unwind-libdw.c                             | 210 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/unwind-libdw.h                             |  21 +++++++
 10 files changed, 494 insertions(+), 66 deletions(-)
 create mode 100644 tools/perf/arch/x86/util/unwind-libdw.c
 create mode 100644 tools/perf/config/feature-checks/test-libdw-dwarf-unwind.c
 create mode 100644 tools/perf/util/unwind-libdw.c
 create mode 100644 tools/perf/util/unwind-libdw.h
author
#1 lore raw

PATCH 1/6 perf tools: Factor features display code

Currently the we display all detected features/libraries by following rules:
- if one of the features is missing
- if it's build from clean tree

This patch changes changes this behavior in several ways.

- We no longer display all detected features, only detected libraries are displayed by default:

  $ make
    BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:

  ...                         dwarf: [ on  ]
  ...                         glibc: [ on  ]
  ...                          gtk2: [ on  ]
  ...                      libaudit: [ on  ]
  ...                        libbfd: [ on  ]
  ...                        libelf: [ on  ]
  ...                       libnuma: [ on  ]
  ...                       libperl: [ on  ]
  ...                     libpython: [ on  ]
  ...                      libslang: [ on  ]
  ...                     libunwind: [ on  ]

The assumption is, that above libraries are the most interesting part of the detection, while we don't care much about detection of on-exit support.

- If all above libraries are detected, the default is not shown on subsequent builds.

- If one of the above libraries is missing, the detection output is forced.

- The features status is stored in PERF-FEATURES file and the detection output is forced in case the there's difference between the file contents and currently detected features.

- If you want to see all detected features, you can use VF=1 make variable, that forces the detected features output.

  $ make VF=1
    BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:

  ...                         dwarf: [ on  ]
  ...                         glibc: [ on  ]
  ...                          gtk2: [ on  ]
  ...                      libaudit: [ on  ]
  ...                        libbfd: [ on  ]
  ...                        libelf: [ on  ]
  ...                       libnuma: [ on  ]
  ...                       libperl: [ on  ]
  ...                     libpython: [ on  ]
  ...                      libslang: [ on  ]
  ...                     libunwind: [ on  ]
  ...                     backtrace: [ on  ]
  ...                fortify-source: [ on  ]
  ...                  gtk2-infobar: [ on  ]
  ...             libelf-getphdrnum: [ on  ]
  ...                   libelf-mmap: [ on  ]
  ...             libpython-version: [ on  ]
  ...                       on-exit: [ on  ]
  ...            stackprotector-all: [ on  ]
  ...                       timerfd: [ on  ]

... libunwind-debug-frame: [ OFF ]
... bionic: [ OFF ]

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc David Ahern <[email protected]>
Cc Jean Pihet <[email protected]>
---
 tools/perf/Makefile.perf   |   4 +-
 tools/perf/config/Makefile | 123 ++++++++++++++++++++++++++++++---------------
 2 files changed, 85 insertions(+), 42 deletions(-)
tools/perf/Makefile.perf +3 -1
index 5fedd69..bde91f8 100644
@@ -7,6 +7,8 @@ include config/utilities.mak
 
 # Define V to have a more verbose compile.
 #
+# Define VF to have a more verbose feature check output.
+#
 # Define O to save output files in a separate directory.
 #
 # Define ARCH as name of target architecture if you want cross-builds.
@@ -897,7 +899,7 @@ config-clean:
 clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
 	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS)
 	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf
-	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
+	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)PERF-FEATURES $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
 	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
 	$(python-clean)
 
tools/perf/config/Makefile +82 -41

150 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#2 lore raw

Em Wed, Feb 19, 2014 at 04:52:54PM +0100, Jiri Olsa escreveu:

Quoted 14 lines

Currently the we display all detected features/libraries by following rules:
- if one of the features is missing
- if it's build from clean tree

This patch changes changes this behavior in several ways.

- We no longer display all detected features, only detected libraries are displayed by default:

  $ make
    BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:

Quoted 11 lines
  ...                         dwarf: [ on  ]
  ...                         glibc: [ on  ]
  ...                          gtk2: [ on  ]
  ...                      libaudit: [ on  ]
  ...                        libbfd: [ on  ]
  ...                        libelf: [ on  ]
  ...                       libnuma: [ on  ]
  ...                       libperl: [ on  ]
  ...                     libpython: [ on  ]
  ...                      libslang: [ on  ]
  ...                     libunwind: [ on  ]

I like it, testing now, one suggestion: Since this is just about libraries, ditch the "lib' prefix, and make the header more informative, making it look like this:

Auto-detecting system libraries that enables features:

   ...                         dwarf: [ on  ]
   ...                             c: [ on  ]
   ...                          gtk2: [ on  ]
   ...                         audit: [ on  ]
   ...                           bfd: [ on  ]
   ...                           elf: [ on  ]
   ...                          numa: [ on  ]
   ...                          perl: [ on  ]
   ...                        python: [ on  ]
   ...                         slang: [ on  ]
   ...                        unwind: [ on  ]

Also, do we look first for dwarf, then for glibc?

Back to the other patches...

- Arnaldo

author
#3 lore raw
Quoted 32 lines · Arnaldo Carvalho de Melo

Em Wed, Feb 19, 2014 at 04:52:54PM +0100, Jiri Olsa escreveu:

Quoted 14 lines

Currently the we display all detected features/libraries by following rules:
- if one of the features is missing
- if it's build from clean tree

This patch changes changes this behavior in several ways.

- We no longer display all detected features, only detected libraries are displayed by default:

  $ make
    BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:

Quoted 11 lines
  ...                         dwarf: [ on  ]
  ...                         glibc: [ on  ]
  ...                          gtk2: [ on  ]
  ...                      libaudit: [ on  ]
  ...                        libbfd: [ on  ]
  ...                        libelf: [ on  ]
  ...                       libnuma: [ on  ]
  ...                       libperl: [ on  ]
  ...                     libpython: [ on  ]
  ...                      libslang: [ on  ]
  ...                     libunwind: [ on  ]

I like it, testing now, one suggestion: Since this is just about libraries, ditch the "lib' prefix, and make the header more informative, making it look like this:

Auto-detecting system libraries that enables features:

Quoted 11 lines
   ...                         dwarf: [ on  ]
   ...                             c: [ on  ]
   ...                          gtk2: [ on  ]
   ...                         audit: [ on  ]
   ...                           bfd: [ on  ]
   ...                           elf: [ on  ]
   ...                          numa: [ on  ]
   ...                          perl: [ on  ]
   ...                        python: [ on  ]
   ...                         slang: [ on  ]
   ...                        unwind: [ on  ]

yep, we could prettify it somehow.. but those names are tightly bound to tests in config/feature-checks/Makefile .. so it'd mean bigger change ;-)

Quoted 2 lines

Also, do we look first for dwarf, then for glibc?

the order is artifical.. we check all together.. almost ;-)

we can sort the output to make more sense, like from the most crucial lib..

jirka

#4 lore raw
Quoted 45 lines · Jiri Olsa
Quoted 32 lines · Arnaldo Carvalho de Melo

Em Wed, Feb 19, 2014 at 04:52:54PM +0100, Jiri Olsa escreveu:

Quoted 14 lines

Currently the we display all detected features/libraries by following rules:
- if one of the features is missing
- if it's build from clean tree

This patch changes changes this behavior in several ways.

- We no longer display all detected features, only detected libraries are displayed by default:

  $ make
    BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:

Quoted 11 lines
  ...                         dwarf: [ on  ]
  ...                         glibc: [ on  ]
  ...                          gtk2: [ on  ]
  ...                      libaudit: [ on  ]
  ...                        libbfd: [ on  ]
  ...                        libelf: [ on  ]
  ...                       libnuma: [ on  ]
  ...                       libperl: [ on  ]
  ...                     libpython: [ on  ]
  ...                      libslang: [ on  ]
  ...                     libunwind: [ on  ]

I like it, testing now, one suggestion: Since this is just about libraries, ditch the "lib' prefix, and make the header more informative, making it look like this:

Auto-detecting system libraries that enables features:

Quoted 11 lines
   ...                         dwarf: [ on  ]
   ...                             c: [ on  ]
   ...                          gtk2: [ on  ]
   ...                         audit: [ on  ]
   ...                           bfd: [ on  ]
   ...                           elf: [ on  ]
   ...                          numa: [ on  ]
   ...                          perl: [ on  ]
   ...                        python: [ on  ]
   ...                         slang: [ on  ]
   ...                        unwind: [ on  ]
Quoted 3 lines

yep, we could prettify it somehow.. but those names are tightly bound to tests in config/feature-checks/Makefile .. so it'd mean bigger change ;-)

The naming is also generally related to the feature test and the component library being tested, so it could be misleading/confusing to strip it?

Thanks,

Ingo

#5 lore raw
In reply to Jiri Olsa
perf tools: Factor features display code
Commit-ID:  0695e57b9a6a5eb856a58cf488f715b3bb7366a0
Gitweb:     http://git.kernel.org/tip/0695e57b9a6a5eb856a58cf488f715b3bb7366a0
Author:     Jiri Olsa <[email protected]>
AuthorDate: Wed, 19 Feb 2014 16:52:54 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 24 Feb 2014 09:29:35 -0300

perf tools: Factor features display code

Currently the we display all detected features/libraries by following rules:

- if one of the features is missing
- if it's build from clean tree

This patch changes changes this behavior in several ways.

- We no longer display all detected features, only detected libraries are displayed by default:

  $ make
    BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:

  ...                         dwarf: [ on  ]
  ...                         glibc: [ on  ]
  ...                          gtk2: [ on  ]
  ...                      libaudit: [ on  ]
  ...                        libbfd: [ on  ]
  ...                        libelf: [ on  ]
  ...                       libnuma: [ on  ]
  ...                       libperl: [ on  ]
  ...                     libpython: [ on  ]
  ...                      libslang: [ on  ]
  ...                     libunwind: [ on  ]

The assumption is, that above libraries are the most interesting part
of the detection, while we don't care much about detection of on-exit support.

- If all above libraries are detected, the default is not shown on subsequent builds.

- If one of the above libraries is missing, the detection output is forced.

- The features status is stored in PERF-FEATURES file and the detection output is forced in case the there's difference between the file contents and currently detected features.

- If you want to see all detected features, you can use VF=1 make variable, that forces the detected features output.

  $ make VF=1
    BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:

  ...                         dwarf: [ on  ]
  ...                         glibc: [ on  ]
  ...                          gtk2: [ on  ]
  ...                      libaudit: [ on  ]
  ...                        libbfd: [ on  ]
  ...                        libelf: [ on  ]
  ...                       libnuma: [ on  ]
  ...                       libperl: [ on  ]
  ...                     libpython: [ on  ]
  ...                      libslang: [ on  ]
  ...                     libunwind: [ on  ]
  ...                     backtrace: [ on  ]
  ...                fortify-source: [ on  ]
  ...                  gtk2-infobar: [ on  ]
  ...             libelf-getphdrnum: [ on  ]
  ...                   libelf-mmap: [ on  ]
  ...             libpython-version: [ on  ]
  ...                       on-exit: [ on  ]
  ...            stackprotector-all: [ on  ]
  ...                       timerfd: [ on  ]

... libunwind-debug-frame: [ OFF ]
... bionic: [ OFF ]

Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jean Pihet <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 tools/perf/Makefile.perf   |   4 +-
 tools/perf/config/Makefile | 123 ++++++++++++++++++++++++++++++---------------
 2 files changed, 85 insertions(+), 42 deletions(-)
tools/perf/Makefile.perf +3 -1
index 5fedd69..bde91f8 100644
@@ -7,6 +7,8 @@ include config/utilities.mak
 
 # Define V to have a more verbose compile.
 #
+# Define VF to have a more verbose feature check output.
+#
 # Define O to save output files in a separate directory.
 #
 # Define ARCH as name of target architecture if you want cross-builds.
@@ -897,7 +899,7 @@ config-clean:
 clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
 	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS)
 	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf
-	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
+	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)PERF-FEATURES $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
 	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
 	$(python-clean)
 
tools/perf/config/Makefile +82 -41

150 lines not on this page · raw message

author
#6 lore raw

PATCH 2/6 perf tools: Add variable display for VF make output

In reply to Jiri Olsa

Adding dump of interesting build directories to the make VF=1 output.

  $ make VF=1
    BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:

  ...                         dwarf: [ on  ]
  ...                         glibc: [ on  ]
  ...                          gtk2: [ on  ]
  ...                      libaudit: [ on  ]
  ...                        libbfd: [ on  ]
  ...                        libelf: [ on  ]
  ...                       libnuma: [ on  ]
  ...                       libperl: [ on  ]
  ...                     libpython: [ on  ]
  ...                      libslang: [ on  ]
  ...                     libunwind: [ on  ]
  ...                     backtrace: [ on  ]
  ...                fortify-source: [ on  ]
  ...                  gtk2-infobar: [ on  ]
  ...             libelf-getphdrnum: [ on  ]
  ...                   libelf-mmap: [ on  ]
  ...             libpython-version: [ on  ]
  ...                       on-exit: [ on  ]
  ...            stackprotector-all: [ on  ]
  ...                       timerfd: [ on  ]

... libunwind-debug-frame: [ OFF ]
... bionic: [ OFF ]

  ...                        prefix: /home/jolsa
  ...                        bindir: /home/jolsa/bin
  ...                        libdir: /home/jolsa/lib64

... sysconfdir: /home/jolsa/etc

Adding functions to print variable/text in features display - feature_print_var/feature_print_text (feature_print_text is used in next patches).

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc David Ahern <[email protected]>
Cc Jean Pihet <[email protected]>
---
 tools/perf/config/Makefile | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
tools/perf/config/Makefile +19 -4
index 39e6e6c..97a64c4 100644
@@ -591,9 +591,9 @@ endif
 #
 # Print the result of the feature test:
 #
-feature_print = $(eval $(feature_print_code)) $(info $(MSG))
+feature_print_status = $(eval $(feature_print_status_code)) $(info $(MSG))
 
-define feature_print_code
+define feature_print_status_code
   ifeq ($(feature-$(1)), 1)
     MSG = $(shell printf '...%30s: [ \033[32mon\033[m  ]' $(1))
   else
@@ -601,6 +601,16 @@ define feature_print_code
   endif
 endef
 
+feature_print_var = $(eval $(feature_print_var_code)) $(info $(MSG))
+define feature_print_var_code
+    MSG = $(shell printf '...%30s: %s' $(1) $($(1)))
+endef
+
+feature_print_text = $(eval $(feature_print_text_code)) $(info $(MSG))
+define feature_print_text_code
+    MSG = $(shell printf '...%30s: %s' $(1) $(2))
+endef
+
 PERF_FEATURES := $(foreach feat,$(LIB_FEATURE_TESTS),feature-$(feat)($(feature-$(feat))))
 PERF_FEATURES_FILE := $(shell touch $(OUTPUT)PERF-FEATURES; cat $(OUTPUT)PERF-FEATURES)
 
@@ -633,11 +643,16 @@ endif
 ifeq ($(display_lib),1)
   $(info )
   $(info Auto-detecting system features:)
-  $(foreach feat,$(LIB_FEATURE_TESTS),$(call feature_print,$(feat),))
+  $(foreach feat,$(LIB_FEATURE_TESTS),$(call feature_print_status,$(feat),))
 endif
 
 ifeq ($(display_vf),1)
-  $(foreach feat,$(VF_FEATURE_TESTS),$(call feature_print,$(feat),))
+  $(foreach feat,$(VF_FEATURE_TESTS),$(call feature_print_status,$(feat),))
+  $(info )
+  $(call feature_print_var,prefix)
+  $(call feature_print_var,bindir)
+  $(call feature_print_var,libdir)
+  $(call feature_print_var,sysconfdir)
 endif
 
 ifeq ($(display_lib),1)
Signature · 1 line
1.8.3.1
#7 lore raw

[tip:perf/core] perf tools: Add variable display for VF make output

perf tools: Add variable display for VF make output
Commit-ID:  8d79076a3c5dbe45109fd15d2489168fbbb28a3d
Gitweb:     http://git.kernel.org/tip/8d79076a3c5dbe45109fd15d2489168fbbb28a3d
Author:     Jiri Olsa <[email protected]>
AuthorDate: Wed, 19 Feb 2014 16:52:55 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 24 Feb 2014 09:29:36 -0300

perf tools: Add variable display for VF make output

Adding dump of interesting build directories to the make VF=1 output.

  $ make VF=1
    BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:

  ...                         dwarf: [ on  ]
  ...                         glibc: [ on  ]
  ...                          gtk2: [ on  ]
  ...                      libaudit: [ on  ]
  ...                        libbfd: [ on  ]
  ...                        libelf: [ on  ]
  ...                       libnuma: [ on  ]
  ...                       libperl: [ on  ]
  ...                     libpython: [ on  ]
  ...                      libslang: [ on  ]
  ...                     libunwind: [ on  ]
  ...                     backtrace: [ on  ]
  ...                fortify-source: [ on  ]
  ...                  gtk2-infobar: [ on  ]
  ...             libelf-getphdrnum: [ on  ]
  ...                   libelf-mmap: [ on  ]
  ...             libpython-version: [ on  ]
  ...                       on-exit: [ on  ]
  ...            stackprotector-all: [ on  ]
  ...                       timerfd: [ on  ]

... libunwind-debug-frame: [ OFF ]
... bionic: [ OFF ]

  ...                        prefix: /home/jolsa
  ...                        bindir: /home/jolsa/bin
  ...                        libdir: /home/jolsa/lib64

... sysconfdir: /home/jolsa/etc

Adding functions to print variable/text in features display - feature_print_var/feature_print_text (feature_print_text is used in next patches).

Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jean Pihet <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 tools/perf/config/Makefile | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
tools/perf/config/Makefile +19 -4
index 39e6e6c..97a64c4 100644
@@ -591,9 +591,9 @@ endif
 #
 # Print the result of the feature test:
 #
-feature_print = $(eval $(feature_print_code)) $(info $(MSG))
+feature_print_status = $(eval $(feature_print_status_code)) $(info $(MSG))
 
-define feature_print_code
+define feature_print_status_code
   ifeq ($(feature-$(1)), 1)
     MSG = $(shell printf '...%30s: [ \033[32mon\033[m  ]' $(1))
   else
@@ -601,6 +601,16 @@ define feature_print_code
   endif
 endef
 
+feature_print_var = $(eval $(feature_print_var_code)) $(info $(MSG))
+define feature_print_var_code
+    MSG = $(shell printf '...%30s: %s' $(1) $($(1)))
+endef
+
+feature_print_text = $(eval $(feature_print_text_code)) $(info $(MSG))
+define feature_print_text_code
+    MSG = $(shell printf '...%30s: %s' $(1) $(2))
+endef
+
 PERF_FEATURES := $(foreach feat,$(LIB_FEATURE_TESTS),feature-$(feat)($(feature-$(feat))))
 PERF_FEATURES_FILE := $(shell touch $(OUTPUT)PERF-FEATURES; cat $(OUTPUT)PERF-FEATURES)
 
@@ -633,11 +643,16 @@ endif
 ifeq ($(display_lib),1)
   $(info )
   $(info Auto-detecting system features:)
-  $(foreach feat,$(LIB_FEATURE_TESTS),$(call feature_print,$(feat),))
+  $(foreach feat,$(LIB_FEATURE_TESTS),$(call feature_print_status,$(feat),))
 endif
 
 ifeq ($(display_vf),1)
-  $(foreach feat,$(VF_FEATURE_TESTS),$(call feature_print,$(feat),))
+  $(foreach feat,$(VF_FEATURE_TESTS),$(call feature_print_status,$(feat),))
+  $(info )
+  $(call feature_print_var,prefix)
+  $(call feature_print_var,bindir)
+  $(call feature_print_var,libdir)
+  $(call feature_print_var,sysconfdir)
 endif
 
 ifeq ($(display_lib),1)
author
#8 lore raw

PATCH 3/6 perf tools: Add feature check for libdw dwarf unwind

In reply to Jiri Olsa

Adding feature check test code for libdw dwarf unwind.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc David Ahern <[email protected]>
Cc Jean Pihet <[email protected]>
---
 tools/perf/config/Makefile                            | 19 ++++++++++++-------
 tools/perf/config/feature-checks/Makefile             |  6 +++++-
 tools/perf/config/feature-checks/test-all.c           |  5 +++++
 .../config/feature-checks/test-libdw-dwarf-unwind.c   | 13 +++++++++++++
 4 files changed, 35 insertions(+), 8 deletions(-)
 create mode 100644 tools/perf/config/feature-checks/test-libdw-dwarf-unwind.c
tools/perf/config/Makefile +12 -7
index 97a64c4..63c98c2 100644
@@ -59,6 +59,18 @@ ifeq ($(NO_PERF_REGS),0)
   CFLAGS += -DHAVE_PERF_REGS_SUPPORT
 endif
 
+ifndef NO_LIBELF
+  # for linking with debug library, run like:
+  # make DEBUG=1 LIBDW_DIR=/opt/libdw/
+  ifdef LIBDW_DIR
+    LIBDW_CFLAGS  := -I$(LIBDW_DIR)/include
+    LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
+
+    FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
+    FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
+  endif
+endif
+
 # include ARCH specific config
 -include $(src-perf)/arch/$(ARCH)/Makefile
 
@@ -267,13 +279,6 @@ else
       msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
     endif
   else
-    # for linking with debug library, run like:
-    # make DEBUG=1 LIBDW_DIR=/opt/libdw/
-    ifdef LIBDW_DIR
-      LIBDW_CFLAGS  := -I$(LIBDW_DIR)/include
-      LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
-    endif
-
     ifneq ($(feature-dwarf), 1)
       msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev);
       NO_DWARF := 1
tools/perf/config/feature-checks/Makefile +5 -1
index 12e5513..2b492f5 100644
@@ -26,7 +26,8 @@ FILES=					\
 	test-libunwind-debug-frame.bin	\
 	test-on-exit.bin		\
 	test-stackprotector-all.bin	\
-	test-timerfd.bin
+	test-timerfd.bin		\
+	test-libdw-dwarf-unwind.bin
 
 CC := $(CROSS_COMPILE)gcc -MD
 PKG_CONFIG := $(CROSS_COMPILE)pkg-config
@@ -141,6 +142,9 @@ test-backtrace.bin:
 test-timerfd.bin:
 	$(BUILD)
 
+test-libdw-dwarf-unwind.bin:
+	$(BUILD)
+
 -include *.d
 
 ###############################
tools/perf/config/feature-checks/test-all.c +5 -0
index 9b8a544..fc37eb3 100644
@@ -89,6 +89,10 @@
 # include "test-stackprotector-all.c"
 #undef main
 
+#define main main_test_libdw_dwarf_unwind
+# include "test-libdw-dwarf-unwind.c"
+#undef main
+
 int main(int argc, char *argv[])
 {
 	main_test_libpython();
@@ -111,6 +115,7 @@ int main(int argc, char *argv[])
 	main_test_libnuma();
 	main_test_timerfd();
 	main_test_stackprotector_all();
+	main_test_libdw_dwarf_unwind();
 
 	return 0;
 }
tools/perf/config/feature-checks/test-libdw-dwarf-unwind.c new file +13 -0
new file mode 100644
index 0000000..f676a3f
@@ -0,0 +1,13 @@
+
+#include <elfutils/libdwfl.h>
+
+int main(void)
+{
+	/*
+	 * This function is guarded via: __nonnull_attribute__ (1, 2).
+	 * Passing '1' as arguments value. This code is never executed,
+	 * only compiled.
+	 */
+	dwfl_thread_getframes((void *) 1, (void *) 1, NULL);
+	return 0;
+}
Signature · 1 line
1.8.3.1
#9 lore raw

[tip:perf/core] perf tools: Add feature check for libdw dwarf unwind

perf tools: Add feature check for libdw dwarf unwind
Commit-ID:  45757895c785e0a4c10afd5670cdc26cea2bbc97
Gitweb:     http://git.kernel.org/tip/45757895c785e0a4c10afd5670cdc26cea2bbc97
Author:     Jiri Olsa <[email protected]>
AuthorDate: Wed, 19 Feb 2014 16:52:56 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 24 Feb 2014 09:29:36 -0300

perf tools: Add feature check for libdw dwarf unwind

Adding feature check test code for libdw dwarf unwind.

Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jean Pihet <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 tools/perf/config/Makefile                            | 19 ++++++++++++-------
 tools/perf/config/feature-checks/Makefile             |  6 +++++-
 tools/perf/config/feature-checks/test-all.c           |  5 +++++
 .../config/feature-checks/test-libdw-dwarf-unwind.c   | 13 +++++++++++++
 4 files changed, 35 insertions(+), 8 deletions(-)
tools/perf/config/Makefile +12 -7
index 9429805..074fa61 100644
@@ -59,6 +59,18 @@ ifeq ($(NO_PERF_REGS),0)
   CFLAGS += -DHAVE_PERF_REGS_SUPPORT
 endif
 
+ifndef NO_LIBELF
+  # for linking with debug library, run like:
+  # make DEBUG=1 LIBDW_DIR=/opt/libdw/
+  ifdef LIBDW_DIR
+    LIBDW_CFLAGS  := -I$(LIBDW_DIR)/include
+    LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
+
+    FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
+    FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
+  endif
+endif
+
 # include ARCH specific config
 -include $(src-perf)/arch/$(ARCH)/Makefile
 
@@ -267,13 +279,6 @@ else
       msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
     endif
   else
-    # for linking with debug library, run like:
-    # make DEBUG=1 LIBDW_DIR=/opt/libdw/
-    ifdef LIBDW_DIR
-      LIBDW_CFLAGS  := -I$(LIBDW_DIR)/include
-      LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
-    endif
-
     ifneq ($(feature-dwarf), 1)
       msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev);
       NO_DWARF := 1
tools/perf/config/feature-checks/Makefile +5 -1
index 12e5513..2b492f5 100644
@@ -26,7 +26,8 @@ FILES=					\
 	test-libunwind-debug-frame.bin	\
 	test-on-exit.bin		\
 	test-stackprotector-all.bin	\
-	test-timerfd.bin
+	test-timerfd.bin		\
+	test-libdw-dwarf-unwind.bin
 
 CC := $(CROSS_COMPILE)gcc -MD
 PKG_CONFIG := $(CROSS_COMPILE)pkg-config
@@ -141,6 +142,9 @@ test-backtrace.bin:
 test-timerfd.bin:
 	$(BUILD)
 
+test-libdw-dwarf-unwind.bin:
+	$(BUILD)
+
 -include *.d
 
 ###############################
tools/perf/config/feature-checks/test-all.c +5 -0
index 9b8a544..fc37eb3 100644
@@ -89,6 +89,10 @@
 # include "test-stackprotector-all.c"
 #undef main
 
+#define main main_test_libdw_dwarf_unwind
+# include "test-libdw-dwarf-unwind.c"
+#undef main
+
 int main(int argc, char *argv[])
 {
 	main_test_libpython();
@@ -111,6 +115,7 @@ int main(int argc, char *argv[])
 	main_test_libnuma();
 	main_test_timerfd();
 	main_test_stackprotector_all();
+	main_test_libdw_dwarf_unwind();
 
 	return 0;
 }
tools/perf/config/feature-checks/test-libdw-dwarf-unwind.c new file +13 -0
new file mode 100644
index 0000000..f676a3f
@@ -0,0 +1,13 @@
+
+#include <elfutils/libdwfl.h>
+
+int main(void)
+{
+	/*
+	 * This function is guarded via: __nonnull_attribute__ (1, 2).
+	 * Passing '1' as arguments value. This code is never executed,
+	 * only compiled.
+	 */
+	dwfl_thread_getframes((void *) 1, (void *) 1, NULL);
+	return 0;
+}
author
#10 lore raw

PATCH 4/6 perf tools: Add libdw DWARF post unwind support

In reply to Jiri Olsa

Adding libdw DWARF post unwind support, which is part of elfutils-devel/libdw-dev package from version 0.158.

The new code is contained in unwin-libdw.c object, and implements unwind__get_entries unwind interface function.

New Makefile variable NO_LIBDW_DWARF_UNWIND was added to control its compilation, and is marked as disabled now. It's factored with the rest of the Makefile unwind build code in the next patch.

Arch specific code was added for x86.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc David Ahern <[email protected]>
Cc Jean Pihet <[email protected]>
---
 tools/perf/Makefile.perf                |  11 ++
 tools/perf/arch/x86/Makefile            |   3 +
 tools/perf/arch/x86/util/unwind-libdw.c |  51 ++++++++
 tools/perf/config/Makefile              |   1 +
 tools/perf/util/unwind-libdw.c          | 210 ++++++++++++++++++++++++++++++++
 tools/perf/util/unwind-libdw.h          |  21 ++++
 6 files changed, 297 insertions(+)
 create mode 100644 tools/perf/arch/x86/util/unwind-libdw.c
 create mode 100644 tools/perf/util/unwind-libdw.c
 create mode 100644 tools/perf/util/unwind-libdw.h
tools/perf/Makefile.perf +11 -0
index bde91f8..2dff0b8 100644
@@ -57,6 +57,12 @@ include config/utilities.mak
 # Define NO_LIBAUDIT if you do not want libaudit support
 #
 # Define NO_LIBBIONIC if you do not want bionic support
+#
+# Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support
+# for dwarf backtrace post unwind.
+
+# temporarily disabled
+NO_LIBDW_DWARF_UNWIND := 1
 
 ifeq ($(srctree),)
 srctree := $(patsubst %/,%,$(dir $(shell pwd)))
@@ -478,6 +484,11 @@ ifndef NO_DWARF
 endif # NO_DWARF
 endif # NO_LIBELF
 
+ifndef NO_LIBDW_DWARF_UNWIND
+  LIB_OBJS += $(OUTPUT)util/unwind-libdw.o
+  LIB_H += util/unwind-libdw.h
+endif
+
 ifndef NO_LIBUNWIND
   LIB_OBJS += $(OUTPUT)util/unwind-libunwind.o
 endif
tools/perf/arch/x86/Makefile +3 -0
index 4fa9be9..37c4652 100644
@@ -7,6 +7,9 @@ LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o
 endif
+ifndef NO_LIBDW_DWARF_UNWIND
+LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o
+endif
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/tsc.o
 LIB_H += arch/$(ARCH)/util/tsc.h
tools/perf/arch/x86/util/unwind-libdw.c new file +51 -0

51 lines not on this page · raw message

tools/perf/config/Makefile +1 -0
index 63c98c2..3936a4b 100644
@@ -261,6 +261,7 @@ ifdef NO_LIBELF
   NO_DWARF := 1
   NO_DEMANGLE := 1
   NO_LIBUNWIND := 1
+  NO_LIBDW_DWARF_UNWIND := 1
 else
   ifeq ($(feature-libelf), 0)
     ifeq ($(feature-glibc), 1)
tools/perf/util/unwind-libdw.c new file +210 -0

210 lines not on this page · raw message

tools/perf/util/unwind-libdw.h new file +21 -0
new file mode 100644
index 0000000..417a142
@@ -0,0 +1,21 @@
+#ifndef __PERF_UNWIND_LIBDW_H
+#define __PERF_UNWIND_LIBDW_H
+
+#include <elfutils/libdwfl.h>
+#include "event.h"
+#include "thread.h"
+#include "unwind.h"
+
+bool libdw__arch_set_initial_registers(Dwfl_Thread *thread, void *arg);
+
+struct unwind_info {
+	Dwfl			*dwfl;
+	struct perf_sample      *sample;
+	struct machine          *machine;
+	struct thread           *thread;
+	unwind_entry_cb_t	cb;
+	void			*arg;
+	int			max_stack;
+};
+
+#endif /* __PERF_UNWIND_LIBDW_H */
Signature · 1 line
1.8.3.1
#11 lore raw

[tip:perf/core] perf tools: Add libdw DWARF post unwind support

perf tools: Add libdw DWARF post unwind support
Commit-ID:  5ea8415407a76c4a85ac971ec82d110161cd77f1
Gitweb:     http://git.kernel.org/tip/5ea8415407a76c4a85ac971ec82d110161cd77f1
Author:     Jiri Olsa <[email protected]>
AuthorDate: Wed, 19 Feb 2014 16:52:57 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 24 Feb 2014 09:29:36 -0300

perf tools: Add libdw DWARF post unwind support

Adding libdw DWARF post unwind support, which is part of elfutils-devel/libdw-dev package from version 0.158.

The new code is contained in unwin-libdw.c object, and implements unwind__get_entries unwind interface function.

New Makefile variable NO_LIBDW_DWARF_UNWIND was added to control its compilation, and is marked as disabled now. It's factored with the rest of the Makefile unwind build code in the next patch.

Arch specific code was added for x86.

Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jean Pihet <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 tools/perf/Makefile.perf                |  11 ++
 tools/perf/arch/x86/Makefile            |   3 +
 tools/perf/arch/x86/util/unwind-libdw.c |  51 ++++++++
 tools/perf/config/Makefile              |   1 +
 tools/perf/util/unwind-libdw.c          | 210 ++++++++++++++++++++++++++++++++
 tools/perf/util/unwind-libdw.h          |  21 ++++
 6 files changed, 297 insertions(+)
tools/perf/Makefile.perf +11 -0
index bde91f8..2dff0b8 100644
@@ -57,6 +57,12 @@ include config/utilities.mak
 # Define NO_LIBAUDIT if you do not want libaudit support
 #
 # Define NO_LIBBIONIC if you do not want bionic support
+#
+# Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support
+# for dwarf backtrace post unwind.
+
+# temporarily disabled
+NO_LIBDW_DWARF_UNWIND := 1
 
 ifeq ($(srctree),)
 srctree := $(patsubst %/,%,$(dir $(shell pwd)))
@@ -478,6 +484,11 @@ ifndef NO_DWARF
 endif # NO_DWARF
 endif # NO_LIBELF
 
+ifndef NO_LIBDW_DWARF_UNWIND
+  LIB_OBJS += $(OUTPUT)util/unwind-libdw.o
+  LIB_H += util/unwind-libdw.h
+endif
+
 ifndef NO_LIBUNWIND
   LIB_OBJS += $(OUTPUT)util/unwind-libunwind.o
 endif
tools/perf/arch/x86/Makefile +3 -0
index 4fa9be9..37c4652 100644
@@ -7,6 +7,9 @@ LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o
 endif
+ifndef NO_LIBDW_DWARF_UNWIND
+LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o
+endif
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/tsc.o
 LIB_H += arch/$(ARCH)/util/tsc.h
tools/perf/arch/x86/util/unwind-libdw.c new file +51 -0

51 lines not on this page · raw message

tools/perf/config/Makefile +1 -0
index 074fa61..c040d86 100644
@@ -261,6 +261,7 @@ ifdef NO_LIBELF
   NO_DWARF := 1
   NO_DEMANGLE := 1
   NO_LIBUNWIND := 1
+  NO_LIBDW_DWARF_UNWIND := 1
 else
   ifeq ($(feature-libelf), 0)
     ifeq ($(feature-glibc), 1)
tools/perf/util/unwind-libdw.c new file +210 -0

210 lines not on this page · raw message

tools/perf/util/unwind-libdw.h new file +21 -0
new file mode 100644
index 0000000..417a142
@@ -0,0 +1,21 @@
+#ifndef __PERF_UNWIND_LIBDW_H
+#define __PERF_UNWIND_LIBDW_H
+
+#include <elfutils/libdwfl.h>
+#include "event.h"
+#include "thread.h"
+#include "unwind.h"
+
+bool libdw__arch_set_initial_registers(Dwfl_Thread *thread, void *arg);
+
+struct unwind_info {
+	Dwfl			*dwfl;
+	struct perf_sample      *sample;
+	struct machine          *machine;
+	struct thread           *thread;
+	unwind_entry_cb_t	cb;
+	void			*arg;
+	int			max_stack;
+};
+
+#endif /* __PERF_UNWIND_LIBDW_H */
author
#12 lore raw

PATCH 5/6 perf tools: Setup default dwarf post unwinder

In reply to Jiri Olsa

Factor NO_LIBDW_DWARF_UNWIND makefile variable and code that selects default DWARf post unwinder based on detected features (libdw and libunwind support)

If both are detected the libunwind is selected as default. Simple 'make' will try to add:
- libunwind unwinder if present
- libdw unwinder if present
- disable dwarf unwind if non of libunwind and libdw libraries are present

If one of the DWARF unwind libraries is detected, message is displayed which one (libunwind/libdw) is compiled in.

Examples:
- compile in libdw unwinder if present:

    $ make NO_LIBUNWIND=1

- compile in libdw (with libdw installation directory) unwinder if present:

    $ make LIBDW_DIR=/opt/elfutils/ NO_LIBUNWIND=1
      BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on ]
... glibc: [ on ]
... gtk2: [ on ]
... libaudit: [ on ]
... libbfd: [ on ]
... libelf: [ on ]
... libnuma: [ on ]
... libperl: [ on ]
... libpython: [ on ]
... libslang: [ on ]
... libunwind: [ on ]
... libdw-dwarf-unwind: [ on ]
... DWARF post unwind library: libdw

- disable post dwarf unwind completely:

    $ make NO_LIBUNWIND=1 NO_LIBDW_DWARF_UNWIND=1
      BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on ]
... glibc: [ on ]
... gtk2: [ on ]
... libaudit: [ on ]
... libbfd: [ on ]
... libelf: [ on ]
... libnuma: [ on ]
... libperl: [ on ]
... libpython: [ on ]
... libslang: [ on ]
... libunwind: [ on ]
... libdw-dwarf-unwind: [ on ]
... DWARF post unwind library: libunwind

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc David Ahern <[email protected]>
Cc Jean Pihet <[email protected]>
---
 tools/perf/Makefile.perf     |  5 +--
 tools/perf/arch/x86/Makefile |  6 ++--
 tools/perf/config/Makefile   | 78 ++++++++++++++++++++++++++++++++++----------
 3 files changed, 66 insertions(+), 23 deletions(-)
tools/perf/Makefile.perf +1 -4
index 2dff0b8..1f7ec48 100644
@@ -61,9 +61,6 @@ include config/utilities.mak
 # Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support
 # for dwarf backtrace post unwind.
 
-# temporarily disabled
-NO_LIBDW_DWARF_UNWIND := 1
-
 ifeq ($(srctree),)
 srctree := $(patsubst %/,%,$(dir $(shell pwd)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
@@ -412,7 +409,7 @@ endif
 LIB_OBJS += $(OUTPUT)tests/code-reading.o
 LIB_OBJS += $(OUTPUT)tests/sample-parsing.o
 LIB_OBJS += $(OUTPUT)tests/parse-no-sample-id-all.o
-ifndef NO_LIBUNWIND
+ifndef NO_DWARF_UNWIND
 ifeq ($(ARCH),x86)
 LIB_OBJS += $(OUTPUT)tests/dwarf-unwind.o
 endif
tools/perf/arch/x86/Makefile +4 -2
index 37c4652..1641542 100644
@@ -4,12 +4,14 @@ LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
 ifndef NO_LIBUNWIND
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o
 endif
 ifndef NO_LIBDW_DWARF_UNWIND
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o
 endif
+ifndef NO_DWARF_UNWIND
+LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o
+LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o
+endif
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/tsc.o
 LIB_H += arch/$(ARCH)/util/tsc.h
tools/perf/config/Makefile +61 -17

124 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#13 lore raw

[tip:perf/core] perf tools: Setup default dwarf post unwinder

perf tools: Setup default dwarf post unwinder
Commit-ID:  0a4f2b6a3ba5066947a8cbd7cfa26fb8a9280625
Gitweb:     http://git.kernel.org/tip/0a4f2b6a3ba5066947a8cbd7cfa26fb8a9280625
Author:     Jiri Olsa <[email protected]>
AuthorDate: Wed, 19 Feb 2014 16:52:58 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 24 Feb 2014 09:29:36 -0300

perf tools: Setup default dwarf post unwinder

Factor NO_LIBDW_DWARF_UNWIND makefile variable and code that selects default DWARf post unwinder based on detected features (libdw and libunwind support)

If both are detected the libunwind is selected as default. Simple 'make' will try to add:

- libunwind unwinder if present
- libdw unwinder if present
- disable dwarf unwind if non of libunwind and libdw libraries are present

If one of the DWARF unwind libraries is detected, message is displayed which one (libunwind/libdw) is compiled in.

Examples:
- compile in libdw unwinder if present:

    $ make NO_LIBUNWIND=1

- compile in libdw (with libdw installation directory) unwinder if present:

    $ make LIBDW_DIR=/opt/elfutils/ NO_LIBUNWIND=1
      BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on ]
... glibc: [ on ]
... gtk2: [ on ]
... libaudit: [ on ]
... libbfd: [ on ]
... libelf: [ on ]
... libnuma: [ on ]
... libperl: [ on ]
... libpython: [ on ]
... libslang: [ on ]
... libunwind: [ on ]
... libdw-dwarf-unwind: [ on ]
... DWARF post unwind library: libdw

- disable post dwarf unwind completely:

    $ make NO_LIBUNWIND=1 NO_LIBDW_DWARF_UNWIND=1
      BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on ]
... glibc: [ on ]
... gtk2: [ on ]
... libaudit: [ on ]
... libbfd: [ on ]
... libelf: [ on ]
... libnuma: [ on ]
... libperl: [ on ]
... libpython: [ on ]
... libslang: [ on ]
... libunwind: [ on ]
... libdw-dwarf-unwind: [ on ]
... DWARF post unwind library: libunwind

Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jean Pihet <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
[ Add suggestion about setting LIBDW_DIR when not finding libdw ]
---
 tools/perf/Makefile.perf     |  5 +--
 tools/perf/arch/x86/Makefile |  6 ++--
 tools/perf/config/Makefile   | 78 ++++++++++++++++++++++++++++++++++----------
 3 files changed, 66 insertions(+), 23 deletions(-)
tools/perf/Makefile.perf +1 -4
index 2dff0b8..1f7ec48 100644
@@ -61,9 +61,6 @@ include config/utilities.mak
 # Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support
 # for dwarf backtrace post unwind.
 
-# temporarily disabled
-NO_LIBDW_DWARF_UNWIND := 1
-
 ifeq ($(srctree),)
 srctree := $(patsubst %/,%,$(dir $(shell pwd)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
@@ -412,7 +409,7 @@ endif
 LIB_OBJS += $(OUTPUT)tests/code-reading.o
 LIB_OBJS += $(OUTPUT)tests/sample-parsing.o
 LIB_OBJS += $(OUTPUT)tests/parse-no-sample-id-all.o
-ifndef NO_LIBUNWIND
+ifndef NO_DWARF_UNWIND
 ifeq ($(ARCH),x86)
 LIB_OBJS += $(OUTPUT)tests/dwarf-unwind.o
 endif
tools/perf/arch/x86/Makefile +4 -2
index 37c4652..1641542 100644
@@ -4,12 +4,14 @@ LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
 ifndef NO_LIBUNWIND
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o
 endif
 ifndef NO_LIBDW_DWARF_UNWIND
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o
 endif
+ifndef NO_DWARF_UNWIND
+LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o
+LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o
+endif
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/tsc.o
 LIB_H += arch/$(ARCH)/util/tsc.h
tools/perf/config/Makefile +61 -17

124 lines not on this page · raw message

author
#14 lore raw

PATCH 6/6 perf tests: Add NO_LIBDW_DWARF_UNWIND make test

In reply to Jiri Olsa

Adding make test for NO_LIBDW_DWARF_UNWIND option, plus updating minimal build test with it.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc David Ahern <[email protected]>
Cc Jean Pihet <[email protected]>
---
 tools/perf/tests/make | 3 +++
 1 file changed, 3 insertions(+)
tools/perf/tests/make +3 -0
index 2d24954..5daeae1 100644
@@ -27,6 +27,7 @@ make_no_ui          := NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
 make_no_demangle    := NO_DEMANGLE=1
 make_no_libelf      := NO_LIBELF=1
 make_no_libunwind   := NO_LIBUNWIND=1
+make_no_libdw_dwarf_unwind := NO_LIBDW_DWARF_UNWIND=1
 make_no_backtrace   := NO_BACKTRACE=1
 make_no_libnuma     := NO_LIBNUMA=1
 make_no_libaudit    := NO_LIBAUDIT=1
@@ -50,6 +51,7 @@ make_install_pdf    := install-pdf
 make_minimal        := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
 make_minimal        += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1
 make_minimal        += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
+make_minimal        += NO_LIBDW_DWARF_UNWIND=1
 
 # $(run) contains all available tests
 run := make_pure
@@ -66,6 +68,7 @@ run += make_no_ui
 run += make_no_demangle
 run += make_no_libelf
 run += make_no_libunwind
+run += make_no_libdw_dwarf_unwind
 run += make_no_backtrace
 run += make_no_libnuma
 run += make_no_libaudit
Signature · 1 line
1.8.3.1
#15 lore raw

[tip:perf/core] perf tests: Add NO_LIBDW_DWARF_UNWIND make test

perf tests: Add NO_LIBDW_DWARF_UNWIND make test
Commit-ID:  9e8c06eaba76392644825a72d965ffa5f2a5784a
Gitweb:     http://git.kernel.org/tip/9e8c06eaba76392644825a72d965ffa5f2a5784a
Author:     Jiri Olsa <[email protected]>
AuthorDate: Wed, 19 Feb 2014 16:52:59 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 24 Feb 2014 09:29:37 -0300

perf tests: Add NO_LIBDW_DWARF_UNWIND make test

Adding make test for NO_LIBDW_DWARF_UNWIND option, plus updating minimal build test with it.

Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jean Pihet <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 tools/perf/tests/make | 3 +++
 1 file changed, 3 insertions(+)
tools/perf/tests/make +3 -0
index 2d24954..5daeae1 100644
@@ -27,6 +27,7 @@ make_no_ui          := NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
 make_no_demangle    := NO_DEMANGLE=1
 make_no_libelf      := NO_LIBELF=1
 make_no_libunwind   := NO_LIBUNWIND=1
+make_no_libdw_dwarf_unwind := NO_LIBDW_DWARF_UNWIND=1
 make_no_backtrace   := NO_BACKTRACE=1
 make_no_libnuma     := NO_LIBNUMA=1
 make_no_libaudit    := NO_LIBAUDIT=1
@@ -50,6 +51,7 @@ make_install_pdf    := install-pdf
 make_minimal        := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
 make_minimal        += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1
 make_minimal        += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
+make_minimal        += NO_LIBDW_DWARF_UNWIND=1
 
 # $(run) contains all available tests
 run := make_pure
@@ -66,6 +68,7 @@ run += make_no_ui
 run += make_no_demangle
 run += make_no_libelf
 run += make_no_libunwind
+run += make_no_libdw_dwarf_unwind
 run += make_no_backtrace
 run += make_no_libnuma
 run += make_no_libaudit