diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2014-07-22 09:17:53 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-07-23 15:45:50 -0400 |
commit | 2a03068c5cfa104768703cbefa2e23a6353f8de5 (patch) | |
tree | 7c41e71161602591c80a3c2cccbb113eeae0a2c6 /tools/perf | |
parent | 6d363459d7e6e05f0afeb8e36e6de262a4964694 (diff) |
perf tools: Pass machine to vdso__dso_findnew()
This is preparation for removing the global variables used in vdso.c and
thereby fixing the lifetime of the VDSO temporary file.
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1406035081-14301-45-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/machine.c | 4 | ||||
-rw-r--r-- | tools/perf/util/map.c | 7 | ||||
-rw-r--r-- | tools/perf/util/map.h | 2 | ||||
-rw-r--r-- | tools/perf/util/vdso.c | 7 | ||||
-rw-r--r-- | tools/perf/util/vdso.h | 4 |
5 files changed, 14 insertions, 10 deletions
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index cfc691000f13..a25f3ee1b5b3 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -1095,7 +1095,7 @@ int machine__process_mmap2_event(struct machine *machine, | |||
1095 | else | 1095 | else |
1096 | type = MAP__FUNCTION; | 1096 | type = MAP__FUNCTION; |
1097 | 1097 | ||
1098 | map = map__new(&machine->user_dsos, event->mmap2.start, | 1098 | map = map__new(machine, event->mmap2.start, |
1099 | event->mmap2.len, event->mmap2.pgoff, | 1099 | event->mmap2.len, event->mmap2.pgoff, |
1100 | event->mmap2.pid, event->mmap2.maj, | 1100 | event->mmap2.pid, event->mmap2.maj, |
1101 | event->mmap2.min, event->mmap2.ino, | 1101 | event->mmap2.min, event->mmap2.ino, |
@@ -1145,7 +1145,7 @@ int machine__process_mmap_event(struct machine *machine, union perf_event *event | |||
1145 | else | 1145 | else |
1146 | type = MAP__FUNCTION; | 1146 | type = MAP__FUNCTION; |
1147 | 1147 | ||
1148 | map = map__new(&machine->user_dsos, event->mmap.start, | 1148 | map = map__new(machine, event->mmap.start, |
1149 | event->mmap.len, event->mmap.pgoff, | 1149 | event->mmap.len, event->mmap.pgoff, |
1150 | event->mmap.pid, 0, 0, 0, 0, 0, 0, | 1150 | event->mmap.pid, 0, 0, 0, 0, 0, 0, |
1151 | event->mmap.filename, | 1151 | event->mmap.filename, |
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index 845f627e45f4..dffc8dce6046 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include "build-id.h" | 13 | #include "build-id.h" |
14 | #include "util.h" | 14 | #include "util.h" |
15 | #include "debug.h" | 15 | #include "debug.h" |
16 | #include "machine.h" | ||
16 | #include <linux/string.h> | 17 | #include <linux/string.h> |
17 | 18 | ||
18 | const char *map_type__name[MAP__NR_TYPES] = { | 19 | const char *map_type__name[MAP__NR_TYPES] = { |
@@ -137,7 +138,7 @@ void map__init(struct map *map, enum map_type type, | |||
137 | map->erange_warned = false; | 138 | map->erange_warned = false; |
138 | } | 139 | } |
139 | 140 | ||
140 | struct map *map__new(struct list_head *dsos__list, u64 start, u64 len, | 141 | struct map *map__new(struct machine *machine, u64 start, u64 len, |
141 | u64 pgoff, u32 pid, u32 d_maj, u32 d_min, u64 ino, | 142 | u64 pgoff, u32 pid, u32 d_maj, u32 d_min, u64 ino, |
142 | u64 ino_gen, u32 prot, u32 flags, char *filename, | 143 | u64 ino_gen, u32 prot, u32 flags, char *filename, |
143 | enum map_type type) | 144 | enum map_type type) |
@@ -173,9 +174,9 @@ struct map *map__new(struct list_head *dsos__list, u64 start, u64 len, | |||
173 | 174 | ||
174 | if (vdso) { | 175 | if (vdso) { |
175 | pgoff = 0; | 176 | pgoff = 0; |
176 | dso = vdso__dso_findnew(dsos__list); | 177 | dso = vdso__dso_findnew(machine); |
177 | } else | 178 | } else |
178 | dso = __dsos__findnew(dsos__list, filename); | 179 | dso = __dsos__findnew(&machine->user_dsos, filename); |
179 | 180 | ||
180 | if (dso == NULL) | 181 | if (dso == NULL) |
181 | goto out_delete; | 182 | goto out_delete; |
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h index 22d13a219590..a95e677f16e9 100644 --- a/tools/perf/util/map.h +++ b/tools/perf/util/map.h | |||
@@ -119,7 +119,7 @@ typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym); | |||
119 | 119 | ||
120 | void map__init(struct map *map, enum map_type type, | 120 | void map__init(struct map *map, enum map_type type, |
121 | u64 start, u64 end, u64 pgoff, struct dso *dso); | 121 | u64 start, u64 end, u64 pgoff, struct dso *dso); |
122 | struct map *map__new(struct list_head *dsos__list, u64 start, u64 len, | 122 | struct map *map__new(struct machine *machine, u64 start, u64 len, |
123 | u64 pgoff, u32 pid, u32 d_maj, u32 d_min, u64 ino, | 123 | u64 pgoff, u32 pid, u32 d_maj, u32 d_min, u64 ino, |
124 | u64 ino_gen, u32 prot, u32 flags, | 124 | u64 ino_gen, u32 prot, u32 flags, |
125 | char *filename, enum map_type type); | 125 | char *filename, enum map_type type); |
diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c index 290582452da3..da5ba4da2bd2 100644 --- a/tools/perf/util/vdso.c +++ b/tools/perf/util/vdso.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include "vdso.h" | 11 | #include "vdso.h" |
12 | #include "util.h" | 12 | #include "util.h" |
13 | #include "symbol.h" | 13 | #include "symbol.h" |
14 | #include "machine.h" | ||
14 | #include "linux/string.h" | 15 | #include "linux/string.h" |
15 | #include "debug.h" | 16 | #include "debug.h" |
16 | 17 | ||
@@ -90,9 +91,9 @@ void vdso__exit(void) | |||
90 | unlink(vdso_file); | 91 | unlink(vdso_file); |
91 | } | 92 | } |
92 | 93 | ||
93 | struct dso *vdso__dso_findnew(struct list_head *head) | 94 | struct dso *vdso__dso_findnew(struct machine *machine) |
94 | { | 95 | { |
95 | struct dso *dso = dsos__find(head, VDSO__MAP_NAME, true); | 96 | struct dso *dso = dsos__find(&machine->user_dsos, VDSO__MAP_NAME, true); |
96 | 97 | ||
97 | if (!dso) { | 98 | if (!dso) { |
98 | char *file; | 99 | char *file; |
@@ -103,7 +104,7 @@ struct dso *vdso__dso_findnew(struct list_head *head) | |||
103 | 104 | ||
104 | dso = dso__new(VDSO__MAP_NAME); | 105 | dso = dso__new(VDSO__MAP_NAME); |
105 | if (dso != NULL) { | 106 | if (dso != NULL) { |
106 | dsos__add(head, dso); | 107 | dsos__add(&machine->user_dsos, dso); |
107 | dso__set_long_name(dso, file, false); | 108 | dso__set_long_name(dso, file, false); |
108 | } | 109 | } |
109 | } | 110 | } |
diff --git a/tools/perf/util/vdso.h b/tools/perf/util/vdso.h index 0f76e7caf6f8..9ab0738b6752 100644 --- a/tools/perf/util/vdso.h +++ b/tools/perf/util/vdso.h | |||
@@ -12,7 +12,9 @@ static inline bool is_vdso_map(const char *filename) | |||
12 | return !strcmp(filename, VDSO__MAP_NAME); | 12 | return !strcmp(filename, VDSO__MAP_NAME); |
13 | } | 13 | } |
14 | 14 | ||
15 | struct dso *vdso__dso_findnew(struct list_head *head); | 15 | struct machine; |
16 | |||
17 | struct dso *vdso__dso_findnew(struct machine *machine); | ||
16 | void vdso__exit(void); | 18 | void vdso__exit(void); |
17 | 19 | ||
18 | #endif /* __PERF_VDSO__ */ | 20 | #endif /* __PERF_VDSO__ */ |