diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-10-02 02:29:58 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-10-02 04:48:42 -0400 |
commit | 439d473b4777de510e1322168ac6f2f377ecd5bc (patch) | |
tree | f33622a0b98c2b0ce16637322d48542eb93e2fa3 /tools/perf/util/symbol.h | |
parent | 2ccdc450e658053681202d42ac64b3638f22dc1a (diff) |
perf tools: Rewrite and improve support for kernel modules
Representing modules as struct map entries, backed by a DSO, etc,
using /proc/modules to find where the module is loaded.
DSOs now can have a short and long name, so that in verbose mode we
can show exactly which .ko or vmlinux image was used.
As kernel modules now are a DSO separate from the kernel, we can
ask for just the hits for a particular set of kernel modules, just
like we can do with shared libraries:
[root@doppio linux-2.6-tip]# perf report -n --vmlinux
/home/acme/git/build/tip-recvmmsg/vmlinux --modules --dsos \[drm\] | head -15
84.58% 13266 Xorg [k] drm_clflush_pages
4.02% 630 Xorg [k] trace_kmalloc.clone.0
3.95% 619 Xorg [k] drm_ioctl
2.07% 324 Xorg [k] drm_addbufs
1.68% 263 Xorg [k] drm_gem_close_ioctl
0.77% 120 Xorg [k] drm_setmaster_ioctl
0.70% 110 Xorg [k] drm_lastclose
0.68% 106 Xorg [k] drm_open
0.54% 85 Xorg [k] drm_mm_search_free
[root@doppio linux-2.6-tip]#
Specifying --dsos /lib/modules/2.6.31-tip/kernel/drivers/gpu/drm/drm.ko
would have the same effect. Allowing specifying just 'drm.ko' is left
for another patch.
Processing kallsyms so that per kernel module struct map are
instantiated was also left for another patch. That will allow
removing the module name from each of its symbols.
struct symbol was reduced by removing the ->module backpointer and
moving it (well now the map) to struct symbol_entry in perf top,
that is its only user right now.
The total linecount went down by ~500 lines.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Avi Kivity <avi@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/symbol.h')
-rw-r--r-- | tools/perf/util/symbol.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index ee164f659ed3..5339fd82ec96 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -5,7 +5,6 @@ | |||
5 | #include "types.h" | 5 | #include "types.h" |
6 | #include <linux/list.h> | 6 | #include <linux/list.h> |
7 | #include <linux/rbtree.h> | 7 | #include <linux/rbtree.h> |
8 | #include "module.h" | ||
9 | #include "event.h" | 8 | #include "event.h" |
10 | 9 | ||
11 | #ifdef HAVE_CPLUS_DEMANGLE | 10 | #ifdef HAVE_CPLUS_DEMANGLE |
@@ -36,10 +35,8 @@ struct symbol { | |||
36 | struct rb_node rb_node; | 35 | struct rb_node rb_node; |
37 | u64 start; | 36 | u64 start; |
38 | u64 end; | 37 | u64 end; |
39 | u64 obj_start; | ||
40 | u64 hist_sum; | 38 | u64 hist_sum; |
41 | u64 *hist; | 39 | u64 *hist; |
42 | struct module *module; | ||
43 | void *priv; | 40 | void *priv; |
44 | char name[0]; | 41 | char name[0]; |
45 | }; | 42 | }; |
@@ -52,12 +49,14 @@ struct dso { | |||
52 | unsigned char adjust_symbols; | 49 | unsigned char adjust_symbols; |
53 | unsigned char slen_calculated; | 50 | unsigned char slen_calculated; |
54 | unsigned char origin; | 51 | unsigned char origin; |
52 | const char *short_name; | ||
53 | char *long_name; | ||
55 | char name[0]; | 54 | char name[0]; |
56 | }; | 55 | }; |
57 | 56 | ||
58 | extern const char *sym_hist_filter; | 57 | extern const char *sym_hist_filter; |
59 | 58 | ||
60 | typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym); | 59 | typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym); |
61 | 60 | ||
62 | struct dso *dso__new(const char *name, unsigned int sym_priv_size); | 61 | struct dso *dso__new(const char *name, unsigned int sym_priv_size); |
63 | void dso__delete(struct dso *self); | 62 | void dso__delete(struct dso *self); |
@@ -69,10 +68,12 @@ static inline void *dso__sym_priv(struct dso *self, struct symbol *sym) | |||
69 | 68 | ||
70 | struct symbol *dso__find_symbol(struct dso *self, u64 ip); | 69 | struct symbol *dso__find_symbol(struct dso *self, u64 ip); |
71 | 70 | ||
72 | int dso__load_kernel(struct dso *self, const char *vmlinux, | 71 | int dsos__load_kernel(const char *vmlinux, unsigned int sym_priv_size, |
73 | symbol_filter_t filter, int verbose, int modules); | 72 | symbol_filter_t filter, int verbose, int modules); |
74 | int dso__load_modules(struct dso *self, symbol_filter_t filter, int verbose); | 73 | int dsos__load_modules(unsigned int sym_priv_size, symbol_filter_t filter, |
75 | int dso__load(struct dso *self, symbol_filter_t filter, int verbose); | 74 | int verbose); |
75 | int dso__load(struct dso *self, struct map *map, symbol_filter_t filter, | ||
76 | int verbose); | ||
76 | struct dso *dsos__findnew(const char *name); | 77 | struct dso *dsos__findnew(const char *name); |
77 | void dsos__fprintf(FILE *fp); | 78 | void dsos__fprintf(FILE *fp); |
78 | 79 | ||
@@ -84,9 +85,8 @@ int load_kernel(void); | |||
84 | void symbol__init(void); | 85 | void symbol__init(void); |
85 | 86 | ||
86 | extern struct list_head dsos; | 87 | extern struct list_head dsos; |
87 | extern struct dso *kernel_dso; | 88 | extern struct map *kernel_map; |
88 | extern struct dso *vdso; | 89 | extern struct dso *vdso; |
89 | extern struct dso *hypervisor_dso; | ||
90 | extern const char *vmlinux_name; | 90 | extern const char *vmlinux_name; |
91 | extern int modules; | 91 | extern int modules; |
92 | #endif /* __PERF_SYMBOL */ | 92 | #endif /* __PERF_SYMBOL */ |