diff options
Diffstat (limited to 'tools/perf/util/map_groups.h')
-rw-r--r-- | tools/perf/util/map_groups.h | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/tools/perf/util/map_groups.h b/tools/perf/util/map_groups.h index 77252e14008f..63ed211fe241 100644 --- a/tools/perf/util/map_groups.h +++ b/tools/perf/util/map_groups.h @@ -16,21 +16,32 @@ struct thread; struct maps { struct rb_root entries; - struct rb_root names; struct rw_semaphore lock; }; void maps__insert(struct maps *maps, struct map *map); void maps__remove(struct maps *maps, struct map *map); +void __maps__remove(struct maps *maps, struct map *map); struct map *maps__find(struct maps *maps, u64 addr); struct map *maps__first(struct maps *maps); struct map *map__next(struct map *map); + +#define maps__for_each_entry(maps, map) \ + for (map = maps__first(maps); map; map = map__next(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 symbol *maps__find_symbol_by_name(struct maps *maps, const char *name, struct map **mapp); struct map_groups { struct maps maps; struct machine *machine; + struct map *last_search_by_name; + struct map **maps_by_name; refcount_t refcnt; + unsigned int nr_maps; + unsigned int nr_maps_allocated; #ifdef HAVE_LIBUNWIND_SUPPORT void *addr_space; struct unwind_libunwind_ops *unwind_libunwind_ops; @@ -64,29 +75,25 @@ size_t map_groups__fprintf(struct map_groups *mg, FILE *fp); void map_groups__insert(struct map_groups *mg, struct map *map); -static inline void map_groups__remove(struct map_groups *mg, struct map *map) -{ - maps__remove(&mg->maps, 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); } -struct map *map_groups__first(struct map_groups *mg); +#define map_groups__for_each_entry(mg, map) \ + for (map = maps__first(&mg->maps); map; map = map__next(map)) -static inline struct map *map_groups__next(struct map *map) -{ - return map__next(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)) 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 addr_map_symbol; -int map_groups__find_ams(struct addr_map_symbol *ams); +int map_groups__find_ams(struct map_groups *mg, struct addr_map_symbol *ams); int map_groups__fixup_overlappings(struct map_groups *mg, struct map *map, FILE *fp); @@ -94,4 +101,6 @@ struct map *map_groups__find_by_name(struct map_groups *mg, const char *name); int map_groups__merge_in(struct map_groups *kmaps, struct map *new_map); +void __map_groups__sort_by_name(struct map_groups *mg); + #endif // __PERF_MAP_GROUPS_H |