path: root/tools/perf/util/map_groups.h
diff options
authorArnaldo Carvalho de Melo <acme@redhat.com>2019-11-25 21:58:33 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-11-26 11:07:46 -0300
commit79b6bb73f888933cbcd20b0ef3976cde67951b72 (patch)
tree3b564c22a30578b3eb34e19f6315b4bdc5da9d1e /tools/perf/util/map_groups.h
parentx86/insn: perf tools: Add some more instructions to the new instructions test (diff)
perf maps: Merge 'struct maps' with 'struct map_groups'
And pick the shortest name: 'struct maps'. The split existed because we used to have two groups of maps, one for functions and one for variables, but that only complicated things, sometimes we needed to figure out what was at some address and then had to first try it on the functions group and if that failed, fall back to the variables one. That split is long gone, so for quite a while we had only one struct maps per struct map_groups, simplify things by combining those structs. First patch is the minimum needed to merge both, follow up patches will rename 'thread->mg' to 'thread->maps', etc. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lkml.kernel.org/n/tip-hom6639ro7020o708trhxh59@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to '')
1 files changed, 23 insertions, 37 deletions
diff --git a/tools/perf/util/map_groups.h b/tools/perf/util/map_groups.h
index f6270243ac4b..8a45994d6a97 100644
--- a/tools/perf/util/map_groups.h
+++ b/tools/perf/util/map_groups.h
@@ -12,13 +12,9 @@
struct ref_reloc_sym;
struct machine;
struct map;
+struct maps;
struct thread;
-struct maps {
- struct rb_root entries;
- struct rw_semaphore lock;
struct map *maps__find(struct maps *maps, u64 addr);
struct map *maps__first(struct maps *maps);
struct map *map__next(struct map *map);
@@ -29,8 +25,9 @@ struct map *map__next(struct map *map);
#define maps__for_each_entry_safe(maps, map, next) \
for (map = maps__first(maps), next = map__next(map); map; map = next, next = map__next(map))
-struct map_groups {
- struct maps maps;
+struct maps {
+ struct rb_root entries;
+ struct rw_semaphore lock;
struct machine *machine;
struct map *last_search_by_name;
struct map **maps_by_name;
@@ -47,55 +44,44 @@ struct map_groups {
struct kmap {
struct ref_reloc_sym *ref_reloc_sym;
- struct map_groups *kmaps;
+ struct maps *kmaps;
char name[KMAP_NAME_LEN];
-struct map_groups *map_groups__new(struct machine *machine);
-void map_groups__delete(struct map_groups *mg);
-bool map_groups__empty(struct map_groups *mg);
+struct maps *maps__new(struct machine *machine);
+void maps__delete(struct maps *mg);
+bool maps__empty(struct maps *mg);
-static inline struct map_groups *map_groups__get(struct map_groups *mg)
+static inline struct maps *maps__get(struct maps *mg)
if (mg)
return mg;
-void map_groups__put(struct map_groups *mg);
-void map_groups__init(struct map_groups *mg, struct machine *machine);
-void map_groups__exit(struct map_groups *mg);
-int map_groups__clone(struct thread *thread, struct map_groups *parent);
-size_t map_groups__fprintf(struct map_groups *mg, FILE *fp);
-void map_groups__insert(struct map_groups *mg, struct map *map);
-void map_groups__remove(struct map_groups *mg, struct map *map);
-static inline struct map *map_groups__find(struct map_groups *mg, u64 addr)
- return maps__find(&mg->maps, addr);
+void maps__put(struct maps *mg);
+void maps__init(struct maps *mg, struct machine *machine);
+void maps__exit(struct maps *mg);
+int maps__clone(struct thread *thread, struct maps *parent);
+size_t maps__fprintf(struct maps *mg, FILE *fp);
-#define map_groups__for_each_entry(mg, map) \
- for (map = maps__first(&mg->maps); map; map = map__next(map))
+void maps__insert(struct maps *mg, struct map *map);
-#define map_groups__for_each_entry_safe(mg, map, next) \
- for (map = maps__first(&mg->maps), next = map__next(map); map; map = next, next = map__next(map))
+void maps__remove(struct maps *mg, struct map *map);
-struct symbol *map_groups__find_symbol(struct map_groups *mg, u64 addr, struct map **mapp);
-struct symbol *map_groups__find_symbol_by_name(struct map_groups *mg, const char *name, struct map **mapp);
+struct symbol *maps__find_symbol(struct maps *mg, u64 addr, struct map **mapp);
+struct symbol *maps__find_symbol_by_name(struct maps *mg, const char *name, struct map **mapp);
struct addr_map_symbol;
-int map_groups__find_ams(struct map_groups *mg, struct addr_map_symbol *ams);
+int maps__find_ams(struct maps *mg, struct addr_map_symbol *ams);
-int map_groups__fixup_overlappings(struct map_groups *mg, struct map *map, FILE *fp);
+int maps__fixup_overlappings(struct maps *mg, struct map *map, FILE *fp);
-struct map *map_groups__find_by_name(struct map_groups *mg, const char *name);
+struct map *maps__find_by_name(struct maps *mg, const char *name);
-int map_groups__merge_in(struct map_groups *kmaps, struct map *new_map);
+int maps__merge_in(struct maps *kmaps, struct map *new_map);
-void __map_groups__sort_by_name(struct map_groups *mg);
+void __maps__sort_by_name(struct maps *mg);
#endif // __PERF_MAP_GROUPS_H