summaryrefslogtreecommitdiff
path: root/tools/perf/util/machine.h
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2018-04-26 22:52:34 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-04-27 16:47:06 +0300
commit3183f8ca304fd84096c44332f9bb699943beb6f1 (patch)
treebe40e5bb5eb54f4ce203f606c509d733c81ee8fe /tools/perf/util/machine.h
parente9814df8645d82b6c5d185537f9510028e35c385 (diff)
downloadlinux-3183f8ca304fd84096c44332f9bb699943beb6f1.tar.xz
perf symbols: Unify symbol maps
Remove the split of symbol tables for data (MAP__VARIABLE) and for functions (MAP__FUNCTION), its unneeded and there were various places doing two lookups to find a symbol, so simplify this. We still will consider only the symbols that matched the filters in place, i.e. see the (elf_(sec,sym)|symbol_type)__filter() routines in the patch, just so that we consider only the same symbols as before, to reduce the possibility of regressions. All the tests on 50-something build environments, in varios versions of lots of distros and cross build environments were performed without build regressions, as usual with all pull requests the other tests were also performed: 'perf test' and 'make -C tools/perf build-test'. Also this was done at a great granularity so that regressions can be bisected more easily. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: https://lkml.kernel.org/n/tip-hiq0fy2rsleupnqqwuojo1ne@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/machine.h')
-rw-r--r--tools/perf/util/machine.h32
1 files changed, 9 insertions, 23 deletions
diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h
index ac3b8403df2e..a625a0a6330d 100644
--- a/tools/perf/util/machine.h
+++ b/tools/perf/util/machine.h
@@ -49,7 +49,7 @@ struct machine {
struct perf_env *env;
struct dsos dsos;
struct map_groups kmaps;
- struct map *vmlinux_maps[MAP__NR_TYPES];
+ struct map *vmlinux_map;
u64 kernel_start;
pid_t *current_tid;
union { /* Tool specific area */
@@ -64,19 +64,13 @@ static inline struct threads *machine__threads(struct machine *machine, pid_t ti
return &machine->threads[(unsigned int)tid % THREADS__TABLE_SIZE];
}
-static inline
-struct map *__machine__kernel_map(struct machine *machine, enum map_type type)
-{
- return machine->vmlinux_maps[type];
-}
-
/*
* The main kernel (vmlinux) map
*/
static inline
struct map *machine__kernel_map(struct machine *machine)
{
- return __machine__kernel_map(machine, MAP__FUNCTION);
+ return machine->vmlinux_map;
}
/*
@@ -85,7 +79,7 @@ struct map *machine__kernel_map(struct machine *machine)
static inline
struct maps *machine__kernel_maps(struct machine *machine)
{
- return &machine->kmaps.maps[MAP__FUNCTION];
+ return &machine->kmaps.maps;
}
int machine__get_kernel_start(struct machine *machine);
@@ -202,27 +196,25 @@ struct dso *machine__findnew_dso(struct machine *machine, const char *filename);
size_t machine__fprintf(struct machine *machine, FILE *fp);
static inline
-struct symbol *machine__find_kernel_symbol(struct machine *machine,
- enum map_type type, u64 addr,
+struct symbol *machine__find_kernel_symbol(struct machine *machine, u64 addr,
struct map **mapp)
{
- return map_groups__find_symbol(&machine->kmaps, type, addr, mapp);
+ return map_groups__find_symbol(&machine->kmaps, addr, mapp);
}
static inline
struct symbol *machine__find_kernel_symbol_by_name(struct machine *machine,
- enum map_type type, const char *name,
+ const char *name,
struct map **mapp)
{
- return map_groups__find_symbol_by_name(&machine->kmaps, type, name, mapp);
+ return map_groups__find_symbol_by_name(&machine->kmaps, name, mapp);
}
static inline
struct symbol *machine__find_kernel_function(struct machine *machine, u64 addr,
struct map **mapp)
{
- return machine__find_kernel_symbol(machine, MAP__FUNCTION, addr,
- mapp);
+ return machine__find_kernel_symbol(machine, addr, mapp);
}
static inline
@@ -237,13 +229,7 @@ struct map *machine__findnew_module_map(struct machine *machine, u64 start,
const char *filename);
int arch__fix_module_text_start(u64 *start, const char *name);
-int __machine__load_kallsyms(struct machine *machine, const char *filename,
- enum map_type type);
-
-static inline int machine__load_kallsyms(struct machine *machine, const char *filename)
-{
- return __machine__load_kallsyms(machine, filename, MAP__FUNCTION);
-}
+int machine__load_kallsyms(struct machine *machine, const char *filename);
int machine__load_vmlinux_path(struct machine *machine);