perf symbols: Do lazy symtab loading for the kernel & modules too

Just like we do with the other DSOs. This also simplifies the
kernel_maps setup process, now all that the tools need to do is
to call kernel_maps__init and the maps for the modules and
kernel will be created, then, later, when
kernel_maps__find_symbol() is used, it will also call
maps__find_symbol that already checks if the symtab was loaded,
loading it if needed.

Now if one does 'perf top --hide_kernel_symbols' we won't pay
the price of loading the (many) symbols in /proc/kallsyms or
vmlinux.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1258757489-5978-4-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Arnaldo Carvalho de Melo
2009-11-20 20:51:27 -02:00
committed by Ingo Molnar
parent 78075caad9
commit c338aee853
10 changed files with 109 additions and 161 deletions

View File

@@ -64,6 +64,7 @@ struct dso {
u8 slen_calculated:1;
u8 loaded:1;
u8 has_build_id:1;
u8 kernel:1;
unsigned char origin;
u8 build_id[BUILD_ID_SIZE];
u16 long_name_len;
@@ -77,12 +78,8 @@ void dso__delete(struct dso *self);
struct symbol *dso__find_symbol(struct dso *self, u64 ip);
int dsos__load_modules(void);
int dsos__load_modules_sym(symbol_filter_t filter);
struct dso *dsos__findnew(const char *name);
int dso__load(struct dso *self, struct map *map, symbol_filter_t filter);
int dso__load_kernel_sym(struct dso *self, symbol_filter_t filter,
int use_modules);
void dsos__fprintf(FILE *fp);
size_t dsos__fprintf_buildid(FILE *fp);
@@ -96,8 +93,8 @@ int sysfs__read_build_id(const char *filename, void *bf, size_t size);
bool dsos__read_build_ids(void);
int build_id__sprintf(u8 *self, int len, char *bf);
struct dso *dsos__load_kernel(void);
int load_kernel(symbol_filter_t filter, bool use_modules);
int kernel_maps__init(bool use_modules);
size_t kernel_maps__fprintf(FILE *fp);
void symbol__init(unsigned int priv_size);