perf tools: Fallback to cplus_demangle when bfd_demangle is not available
PATCH 3/3 perf tools: Fallback to cplus_demangle when bfd_demangle is not available
In old binutils we can't access bfd_demangle, use cplus_demangle just like oprofile.
--- tools/perf/Makefile | 29 ++++++++++++++++++----------- tools/perf/util/symbol.c | 15 --------------- tools/perf/util/symbol.h | 24 ++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 26 deletions(-)
tools/perf/Makefile +18 -11
@@ -384,22 +384,29 @@ endif ifdef NO_DEMANGLE BASIC_CFLAGS += -DNO_DEMANGLE else - has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd > /dev/null 2>&1 && echo y") - has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd -liberty > /dev/null 2>&1 && echo y") - - has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd -liberty -lz > /dev/null 2>&1 && echo y") - ifeq ($(has_bfd),y) EXTLIBS += -lbfd - else ifeq ($(has_bfd_iberty),y) - EXTLIBS += -lbfd -liberty - else ifeq ($(has_bfd_iberty_z),y) - EXTLIBS += -lbfd -liberty -lz else - msg := $(warning No bfd.h/libbfd found, install binutils-dev[el] to gain symbol demangling) - BASIC_CFLAGS += -DNO_DEMANGLE + has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd -liberty > /dev/null 2>&1 && echo y") + ifeq ($(has_bfd_iberty),y) + EXTLIBS += -lbfd -liberty + else + has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd -liberty -lz > /dev/null 2>&1 && echo y") + ifeq ($(has_bfd_iberty_z),y) + EXTLIBS += -lbfd -liberty -lz + else + has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -liberty > /dev/null 2>&1 && echo y") + ifeq ($(has_cplus_demangle),y) + EXTLIBS += -liberty + BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE + else + msg := $(warning No bfd.h/libbfd found, install binutils-dev[el] to gain symbol demangling) + BASIC_CFLAGS += -DNO_DEMANGLE + endif + endif + endif endif endif
tools/perf/util/symbol.c +0 -15
@@ -7,23 +7,8 @@#include <gelf.h> #include <elf.h> -#ifndef NO_DEMANGLE -#include <bfd.h> -#else -static inline -char *bfd_demangle (void __used *v,const char __used *c,int __used i) -{ -return NULL ; -} -#endif -const char *sym_hist_filter; -#ifndef DMGL_PARAMS -#define DMGL_PARAMS (1 << 0)/* Include function args */ -#define DMGL_ANSI (1 << 1)/* Include const, volatile, etc */ -#endif -enum dso_origin {DSO__ORIG_KERNEL =0 ,DSO__ORIG_JAVA_JIT ,
tools/perf/util/symbol.h +24 -0
@@ -7,6 +7,30 @@#include <linux/rbtree.h> #include "module.h" +#ifdef HAVE_CPLUS_DEMANGLE +extern char *cplus_demangle (const char *,int ); + +static inline char *bfd_demangle (void __used *v,const char *c,int i) +{ +return cplus_demangle (c, i); +} +#else +#ifdef NO_DEMANGLE +static inline char *bfd_demangle (void __used *v,const char __used *c, +int __used i) +{ +return NULL ; +} +#else +#include <bfd.h> +#endif +#endif + +#ifndef DMGL_PARAMS +#define DMGL_PARAMS (1 << 0)/* Include function args */ +#define DMGL_ANSI (1 << 1)/* Include const, volatile, etc */ +#endif +struct symbol {struct rb_node rb_node;u64 start;
Signature · 1 line
1.6.2.5
PATCH 1/1 perf tools: Make dso__new handle deleted DSOs
It is better than showing the map addr, this way at least we know that we can't get the symtabs because the DSO was deleted (system update) while an app still used such DSO.
Yeah, don't do that, but if you do, you'll figure it out quicker this way.
[acme@doppio linux-2.6-tip]$ perf report | head -15 # Samples: 3796
#
# Overhead Command Shared Object Symbol
# ........ ....... ................................................................... ......
#
23.55% pidgin /lib64/libglib-2.0.so.0.2000.4.#prelink#.Pd98lu (deleted) [.] 0x00000000038844
21.55% pidgin /lib64/libpthread-2.10.1.so.#prelink#.AFwK8Q (deleted) [.] 0x0000000000a42d
10.85% pidgin [kernel] [.] vread_hpet
7.85% pidgin /lib64/libgobject-2.0.so.0.2000.4.#prelink#.o1vpU7 (deleted) [.] 0x00000000014de8
3.35% pidgin /lib64/libc-2.10.1.so (deleted) [.] 0x0000000007a875
3.19% pidgin /lib64/libdbus-1.so.3.4.0.#prelink#.6mwgZP (deleted) [.] 0x0000000001d254
3.06% pidgin /usr/lib64/libgtk-x11-2.0.so.0.1600.5.#prelink#.511hAl (deleted) [.] 0x000000002334e7
2.90% pidgin /usr/lib64/libgdk-x11-2.0.so.0.1600.5.#prelink#.5qlMo1 (deleted) [.] 0x00000000037b2d
1.84% pidgin [kernel] [k] do_sys_poll
1.45% pidgin /usr/lib64/libX11.so.6.2.0.#prelink#.iR59Rx (deleted) [.] 0x0000000004c751[acme@doppio linux-2.6-tip]$
--- tools/perf/util/symbol.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
tools/perf/util/symbol.c +2 -0
@@ -801,6 +801,8 @@ more: } out:free (name); +if (ret <0 &&strstr (self->name," (deleted)" ) !=NULL ) +return 0 ;return ret; }
Signature · 1 line
1.6.2.5
PATCH 1/1 perf list: use the pager
When /sys/kernel/debug is mounted the list is imense, so use the pager like the other tools.
tools/perf/builtin-list.c +2 -1
@@ -10,11 +10,12 @@#include "perf.h" -#include "util/parse-options.h" #include "util/parse-events.h" +#include "util/cache.h" int cmd_list (int argc__used ,const char **argv__used ,const char *prefix__used ) { +setup_pager ();print_events ();return 0 ; }
Re: [PATCH tip 1/1] perf list: use the pager
Quoted 5 lines · Arnaldo Carvalho de Melo
When
/sys/kernel/debugis mounted the list is imense, so use the pager like the other tools.Cc Peter Zijlstra <[email protected]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
Ah, the integration of syscalls tracepoints made the list huge and I tried to figure out a way to set something like that.
I didn't know it was so simple :-)
Quoted 24 lines
tools/perf/builtin-list.c +2
-2@@ -10,11 +10,12 @@#include "perf.h" -#include "util/parse-options.h" #include "util/parse-events.h" +#include "util/cache.h" int cmd_list (int argc__used ,const char **argv__used ,const char *prefix__used ) { +setup_pager ();print_events ();return 0 ; } --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[tip:perfcounters/urgent] perf list: Fix large list output by using the pager
In reply to Arnaldo Carvalho de MeloCommit-ID: 8f7a0dc51674ad0dd06155291b0aed60d655943c Gitweb: http://git.kernel.org/tip/8f7a0dc51674ad0dd06155291b0aed60d655943c Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Wed, 12 Aug 2009 14:44:59 -0300 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 13 Aug 2009 09:05:48 +0200
perf list: Fix large list output by using the pager
When /sys/kernel/debug is mounted the list can be imense, so use the pager like the other tools.
LKML-Reference: <[email protected]>
--- tools/perf/builtin-list.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
tools/perf/builtin-list.c +2 -1
@@ -10,11 +10,12 @@#include "perf.h" -#include "util/parse-options.h" #include "util/parse-events.h" +#include "util/cache.h" int cmd_list (int argc__used ,const char **argv__used ,const char *prefix__used ) { +setup_pager ();print_events ();return 0 ; }