perf symbols: Simplify symbol machinery setup

And also express its configuration toggles via a struct.

Now all one has to do is to call symbol__init(NULL) if the
defaults are OK, or pass a struct symbol_conf pointer with the
desired configuration.

If a tool uses kernel_maps__find_symbol() to look at the kernel
and modules mappings for a symbol but didn't call symbol__init()
first, that will generate a one time warning too, alerting the
subcommand developer that symbol__init() must be called.

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: <1259071517-3242-2-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-24 12:05:15 -02:00
committed by Ingo Molnar
parent 7cc017edb9
commit b32d133aec
12 changed files with 85 additions and 60 deletions

View File

@@ -49,6 +49,13 @@ struct symbol {
char name[0];
};
struct symbol_conf {
unsigned short priv_size;
bool try_vmlinux_path,
use_modules;
const char *vmlinux_name;
};
extern unsigned int symbol__priv_size;
static inline void *symbol__priv(struct symbol *self)
@@ -93,11 +100,9 @@ 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);
int kernel_maps__init(const char *vmlinux_name, bool try_vmlinux_path,
bool use_modules);
size_t kernel_maps__fprintf(FILE *fp);
void symbol__init(unsigned int priv_size);
int symbol__init(struct symbol_conf *conf);
extern struct list_head dsos;
extern struct map *kernel_map;