aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/map.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/map.c')
-rw-r--r--tools/perf/util/map.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 37cab9038538..2ddbae319de5 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -228,6 +228,39 @@ void map_groups__init(struct map_groups *self)
228 self->machine = NULL; 228 self->machine = NULL;
229} 229}
230 230
231static void maps__delete(struct rb_root *self)
232{
233 struct rb_node *next = rb_first(self);
234
235 while (next) {
236 struct map *pos = rb_entry(next, struct map, rb_node);
237
238 next = rb_next(&pos->rb_node);
239 rb_erase(&pos->rb_node, self);
240 map__delete(pos);
241 }
242}
243
244static void maps__delete_removed(struct list_head *self)
245{
246 struct map *pos, *n;
247
248 list_for_each_entry_safe(pos, n, self, node) {
249 list_del(&pos->node);
250 map__delete(pos);
251 }
252}
253
254void map_groups__exit(struct map_groups *self)
255{
256 int i;
257
258 for (i = 0; i < MAP__NR_TYPES; ++i) {
259 maps__delete(&self->maps[i]);
260 maps__delete_removed(&self->removed_maps[i]);
261 }
262}
263
231void map_groups__flush(struct map_groups *self) 264void map_groups__flush(struct map_groups *self)
232{ 265{
233 int type; 266 int type;