Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 188259
b: refs/heads/master
c: 1224550
h: refs/heads/master
i:
  188257: a35298b
  188255: d529b45
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo authored and Ingo Molnar committed Mar 10, 2010
1 parent 526f52a commit 6b5c01b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d4944a06666054707d23e11888e480af239e5abf
refs/heads/master: 1224550969e0bf18785786a1a9f801cd86d68586
35 changes: 32 additions & 3 deletions trunk/tools/perf/util/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ struct thread *perf_session__findnew(struct perf_session *self, pid_t pid)
return th;
}

static void map_groups__remove_overlappings(struct map_groups *self,
struct map *map)
static int map_groups__fixup_overlappings(struct map_groups *self,
struct map *map)
{
struct rb_root *root = &self->maps[map->type];
struct rb_node *next = rb_first(root);
Expand All @@ -209,7 +209,36 @@ static void map_groups__remove_overlappings(struct map_groups *self,
* list.
*/
list_add_tail(&pos->node, &self->removed_maps[map->type]);
/*
* Now check if we need to create new maps for areas not
* overlapped by the new map:
*/
if (map->start > pos->start) {
struct map *before = map__clone(pos);

if (before == NULL)
return -ENOMEM;

before->end = map->start - 1;
map_groups__insert(self, before);
if (verbose >= 2)
map__fprintf(before, stderr);
}

if (map->end < pos->end) {
struct map *after = map__clone(pos);

if (after == NULL)
return -ENOMEM;

after->start = map->end + 1;
map_groups__insert(self, after);
if (verbose >= 2)
map__fprintf(after, stderr);
}
}

return 0;
}

void maps__insert(struct rb_root *maps, struct map *map)
Expand Down Expand Up @@ -254,7 +283,7 @@ struct map *maps__find(struct rb_root *maps, u64 ip)

void thread__insert_map(struct thread *self, struct map *map)
{
map_groups__remove_overlappings(&self->mg, map);
map_groups__fixup_overlappings(&self->mg, map);
map_groups__insert(&self->mg, map);
}

Expand Down

0 comments on commit 6b5c01b

Please sign in to comment.