aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2015-05-29 10:31:12 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-05-29 11:43:44 -0400
commitaa7cc2ae5ae69aff555793fbfcff514141bb23f3 (patch)
tree2920c2fb1a8209b5216899cdd1491c53c5fcdd5d
parent3d39ac538629e4f00a6e1c38d46346f1b8e69505 (diff)
perf machine: Introduce machine__findnew_dso() method
Similar to machine__findnew_thread(), also prepping for refcounting and locking, this time for struct dso instances. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/n/tip-fv3tshv5o1413coh147lszjc@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/tests/hists_common.c3
-rw-r--r--tools/perf/util/dso.c2
-rw-r--r--tools/perf/util/header.c2
-rw-r--r--tools/perf/util/machine.c7
-rw-r--r--tools/perf/util/machine.h2
-rw-r--r--tools/perf/util/map.c2
6 files changed, 12 insertions, 6 deletions
diff --git a/tools/perf/tests/hists_common.c b/tools/perf/tests/hists_common.c
index bcde1d27919c..915f60af6a0e 100644
--- a/tools/perf/tests/hists_common.c
+++ b/tools/perf/tests/hists_common.c
@@ -121,8 +121,7 @@ struct machine *setup_fake_machine(struct machines *machines)
121 size_t k; 121 size_t k;
122 struct dso *dso; 122 struct dso *dso;
123 123
124 dso = __dsos__findnew(&machine->dsos, 124 dso = machine__findnew_dso(machine, fake_symbols[i].dso_name);
125 fake_symbols[i].dso_name);
126 if (dso == NULL) 125 if (dso == NULL)
127 goto out; 126 goto out;
128 127
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index ff040b0569d6..b335db3532a2 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -833,7 +833,7 @@ struct dso *machine__findnew_kernel(struct machine *machine, const char *name,
833 /* 833 /*
834 * The kernel dso could be created by build_id processing. 834 * The kernel dso could be created by build_id processing.
835 */ 835 */
836 struct dso *dso = __dsos__findnew(&machine->dsos, name); 836 struct dso *dso = machine__findnew_dso(machine, name);
837 837
838 /* 838 /*
839 * We need to run this in all cases, since during the build_id 839 * We need to run this in all cases, since during the build_id
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index a900e9441fb5..851143a7988d 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1264,7 +1264,7 @@ static int __event_process_build_id(struct build_id_event *bev,
1264 goto out; 1264 goto out;
1265 } 1265 }
1266 1266
1267 dso = __dsos__findnew(&machine->dsos, filename); 1267 dso = machine__findnew_dso(machine, filename);
1268 if (dso != NULL) { 1268 if (dso != NULL) {
1269 char sbuild_id[BUILD_ID_SIZE * 2 + 1]; 1269 char sbuild_id[BUILD_ID_SIZE * 2 + 1];
1270 1270
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index ffd31079d447..698da1da5168 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1157,7 +1157,7 @@ static int machine__process_kernel_mmap_event(struct machine *machine,
1157 } 1157 }
1158 1158
1159 if (kernel == NULL) 1159 if (kernel == NULL)
1160 kernel = __dsos__findnew(&machine->dsos, kmmap_prefix); 1160 kernel = machine__findnew_dso(machine, kmmap_prefix);
1161 if (kernel == NULL) 1161 if (kernel == NULL)
1162 goto out_problem; 1162 goto out_problem;
1163 1163
@@ -1915,3 +1915,8 @@ int machine__get_kernel_start(struct machine *machine)
1915 } 1915 }
1916 return err; 1916 return err;
1917} 1917}
1918
1919struct dso *machine__findnew_dso(struct machine *machine, const char *filename)
1920{
1921 return __dsos__findnew(&machine->dsos, filename);
1922}
diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h
index aabca583e655..39a0ca06cbd8 100644
--- a/tools/perf/util/machine.h
+++ b/tools/perf/util/machine.h
@@ -154,6 +154,8 @@ static inline bool machine__is_host(struct machine *machine)
154struct thread *__machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid); 154struct thread *__machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid);
155struct thread *machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid); 155struct thread *machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid);
156 156
157struct dso *machine__findnew_dso(struct machine *machine, const char *filename);
158
157size_t machine__fprintf(struct machine *machine, FILE *fp); 159size_t machine__fprintf(struct machine *machine, FILE *fp);
158 160
159static inline 161static inline
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 57ff0256c22c..d15e1e9dd2ae 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -180,7 +180,7 @@ struct map *map__new(struct machine *machine, u64 start, u64 len,
180 pgoff = 0; 180 pgoff = 0;
181 dso = vdso__dso_findnew(machine, thread); 181 dso = vdso__dso_findnew(machine, thread);
182 } else 182 } else
183 dso = __dsos__findnew(&machine->dsos, filename); 183 dso = machine__findnew_dso(machine, filename);
184 184
185 if (dso == NULL) 185 if (dso == NULL)
186 goto out_delete; 186 goto out_delete;