aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/thread.c
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-08-18 11:04:03 -0400
committerIngo Molnar <mingo@elte.hu>2009-08-18 11:18:03 -0400
commit6e086437f35ad9fda448711732c4ce0f82aad569 (patch)
tree2479b5e6f11a5b0221cff9dcdd44c4caab2332a9 /tools/perf/util/thread.c
parent4273b005875c34beda4a11c9d4a9132d80378036 (diff)
perf tools: Save partial non-overlapping map
The librarization of the thread helpers between annotate and report lost some perf report specifics. thread__insert_map() had its most uptodate version in perf report which cared about partial map overlapping. In case of overlap between two maps, perf annotate's version removes the whole old map without considering if it partially or absolutely overlaps the new map. We exported the odd version, change it by using the perf report version. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Mike Galbraith <efault@gmx.de> LKML-Reference: <1250607843-7395-1-git-send-email-fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/thread.c')
-rw-r--r--tools/perf/util/thread.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index 00c14b98d651..f98032c135c6 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -4,6 +4,7 @@
4#include <string.h> 4#include <string.h>
5#include "thread.h" 5#include "thread.h"
6#include "util.h" 6#include "util.h"
7#include "debug.h"
7 8
8static struct thread *thread__new(pid_t pid) 9static struct thread *thread__new(pid_t pid)
9{ 10{
@@ -85,9 +86,27 @@ void thread__insert_map(struct thread *self, struct map *map)
85 86
86 list_for_each_entry_safe(pos, tmp, &self->maps, node) { 87 list_for_each_entry_safe(pos, tmp, &self->maps, node) {
87 if (map__overlap(pos, map)) { 88 if (map__overlap(pos, map)) {
88 list_del_init(&pos->node); 89 if (verbose >= 2) {
89 /* XXX leaks dsos */ 90 printf("overlapping maps:\n");
90 free(pos); 91 map__fprintf(map, stdout);
92 map__fprintf(pos, stdout);
93 }
94
95 if (map->start <= pos->start && map->end > pos->start)
96 pos->start = map->end;
97
98 if (map->end >= pos->end && map->start < pos->end)
99 pos->end = map->start;
100
101 if (verbose >= 2) {
102 printf("after collision:\n");
103 map__fprintf(pos, stdout);
104 }
105
106 if (pos->start >= pos->end) {
107 list_del_init(&pos->node);
108 free(pos);
109 }
91 } 110 }
92 } 111 }
93 112