aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/map_groups.h
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2019-10-28 11:55:28 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-11-06 15:49:39 -0300
commit50481461cfe937289724643691a752fa15a600c9 (patch)
treec7f583b209cc9ae5bf6e9fe0273e530c49c8a5e1 /tools/perf/util/map_groups.h
parentperf maps: Add for_each_entry()/_safe() iterators (diff)
downloadlinux-dev-50481461cfe937289724643691a752fa15a600c9.tar.xz
linux-dev-50481461cfe937289724643691a752fa15a600c9.zip
perf map_groups: Introduce for_each_entry() and for_each_entry_safe() iterators
To reduce boilerplate, providing a more compact form to iterate over the maps in a map_group. 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-gc3go6fmdn30twusg91t2q56@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to '')
-rw-r--r--tools/perf/util/map_groups.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/perf/util/map_groups.h b/tools/perf/util/map_groups.h
index ce3ade32babd..bfbdbf5a443a 100644
--- a/tools/perf/util/map_groups.h
+++ b/tools/perf/util/map_groups.h
@@ -89,12 +89,11 @@ 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);