diff options
Diffstat (limited to 'tools/perf/util/thread.c')
-rw-r--r-- | tools/perf/util/thread.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index 9d0945cc66d1..3b56aebb1f4b 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c | |||
@@ -16,6 +16,7 @@ static struct thread *thread__new(pid_t pid) | |||
16 | if (self->comm) | 16 | if (self->comm) |
17 | snprintf(self->comm, 32, ":%d", self->pid); | 17 | snprintf(self->comm, 32, ":%d", self->pid); |
18 | self->maps = RB_ROOT; | 18 | self->maps = RB_ROOT; |
19 | INIT_LIST_HEAD(&self->removed_maps); | ||
19 | } | 20 | } |
20 | 21 | ||
21 | return self; | 22 | return self; |
@@ -32,13 +33,20 @@ int thread__set_comm(struct thread *self, const char *comm) | |||
32 | static size_t thread__fprintf(struct thread *self, FILE *fp) | 33 | static size_t thread__fprintf(struct thread *self, FILE *fp) |
33 | { | 34 | { |
34 | struct rb_node *nd; | 35 | struct rb_node *nd; |
35 | size_t ret = fprintf(fp, "Thread %d %s\n", self->pid, self->comm); | 36 | struct map *pos; |
37 | size_t ret = fprintf(fp, "Thread %d %s\nCurrent maps:\n", | ||
38 | self->pid, self->comm); | ||
36 | 39 | ||
37 | for (nd = rb_first(&self->maps); nd; nd = rb_next(nd)) { | 40 | for (nd = rb_first(&self->maps); nd; nd = rb_next(nd)) { |
38 | struct map *pos = rb_entry(nd, struct map, rb_node); | 41 | pos = rb_entry(nd, struct map, rb_node); |
39 | ret += map__fprintf(pos, fp); | 42 | ret += map__fprintf(pos, fp); |
40 | } | 43 | } |
41 | 44 | ||
45 | ret = fprintf(fp, "Removed maps:\n"); | ||
46 | |||
47 | list_for_each_entry(pos, &self->removed_maps, node) | ||
48 | ret += map__fprintf(pos, fp); | ||
49 | |||
42 | return ret; | 50 | return ret; |
43 | } | 51 | } |
44 | 52 | ||
@@ -112,21 +120,13 @@ static void thread__remove_overlappings(struct thread *self, struct map *map) | |||
112 | map__fprintf(pos, stdout); | 120 | map__fprintf(pos, stdout); |
113 | } | 121 | } |
114 | 122 | ||
115 | if (map->start <= pos->start && map->end > pos->start) | 123 | rb_erase(&pos->rb_node, &self->maps); |
116 | pos->start = map->end; | 124 | /* |
117 | 125 | * We may have references to this map, for instance in some | |
118 | if (map->end >= pos->end && map->start < pos->end) | 126 | * hist_entry instances, so just move them to a separate |
119 | pos->end = map->start; | 127 | * list. |
120 | 128 | */ | |
121 | if (verbose >= 2) { | 129 | list_add_tail(&pos->node, &self->removed_maps); |
122 | printf("after collision:\n"); | ||
123 | map__fprintf(pos, stdout); | ||
124 | } | ||
125 | |||
126 | if (pos->start >= pos->end) { | ||
127 | rb_erase(&pos->rb_node, &self->maps); | ||
128 | free(pos); | ||
129 | } | ||
130 | } | 130 | } |
131 | } | 131 | } |
132 | 132 | ||