diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-10-03 10:50:55 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-10-03 10:52:07 -0400 |
commit | e60fc847cefa34d9b7a60f8fbbe3f7dc68fbd75e (patch) | |
tree | 3d105a7de6d611468353d9444a21a1ad15577155 /tools/perf/util/evlist.c | |
parent | 39876e7dd385e0f0a438ee0ab13cf75a4f5e0e3b (diff) |
perf evlist: Remove some unused methods
Those were introduced in a previous attempt at implementing 'trace', but
are not being used anywhere, ditch them.
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
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/n/tip-ruhm5gocoh32pb7gnr0ai6gh@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/evlist.c')
-rw-r--r-- | tools/perf/util/evlist.c | 86 |
1 files changed, 2 insertions, 84 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 6a2809fd257e..186b87730396 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -154,8 +154,8 @@ error: | |||
154 | return -ENOMEM; | 154 | return -ENOMEM; |
155 | } | 155 | } |
156 | 156 | ||
157 | int perf_evlist__add_attrs(struct perf_evlist *evlist, | 157 | static int perf_evlist__add_attrs(struct perf_evlist *evlist, |
158 | struct perf_event_attr *attrs, size_t nr_attrs) | 158 | struct perf_event_attr *attrs, size_t nr_attrs) |
159 | { | 159 | { |
160 | struct perf_evsel *evsel, *n; | 160 | struct perf_evsel *evsel, *n; |
161 | LIST_HEAD(head); | 161 | LIST_HEAD(head); |
@@ -189,60 +189,6 @@ int __perf_evlist__add_default_attrs(struct perf_evlist *evlist, | |||
189 | return perf_evlist__add_attrs(evlist, attrs, nr_attrs); | 189 | return perf_evlist__add_attrs(evlist, attrs, nr_attrs); |
190 | } | 190 | } |
191 | 191 | ||
192 | static int trace_event__id(const char *evname) | ||
193 | { | ||
194 | char *filename, *colon; | ||
195 | int err = -1, fd; | ||
196 | |||
197 | if (asprintf(&filename, "%s/%s/id", tracing_events_path, evname) < 0) | ||
198 | return -1; | ||
199 | |||
200 | colon = strrchr(filename, ':'); | ||
201 | if (colon != NULL) | ||
202 | *colon = '/'; | ||
203 | |||
204 | fd = open(filename, O_RDONLY); | ||
205 | if (fd >= 0) { | ||
206 | char id[16]; | ||
207 | if (read(fd, id, sizeof(id)) > 0) | ||
208 | err = atoi(id); | ||
209 | close(fd); | ||
210 | } | ||
211 | |||
212 | free(filename); | ||
213 | return err; | ||
214 | } | ||
215 | |||
216 | int perf_evlist__add_tracepoints(struct perf_evlist *evlist, | ||
217 | const char *tracepoints[], | ||
218 | size_t nr_tracepoints) | ||
219 | { | ||
220 | int err; | ||
221 | size_t i; | ||
222 | struct perf_event_attr *attrs = zalloc(nr_tracepoints * sizeof(*attrs)); | ||
223 | |||
224 | if (attrs == NULL) | ||
225 | return -1; | ||
226 | |||
227 | for (i = 0; i < nr_tracepoints; i++) { | ||
228 | err = trace_event__id(tracepoints[i]); | ||
229 | |||
230 | if (err < 0) | ||
231 | goto out_free_attrs; | ||
232 | |||
233 | attrs[i].type = PERF_TYPE_TRACEPOINT; | ||
234 | attrs[i].config = err; | ||
235 | attrs[i].sample_type = (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | | ||
236 | PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD); | ||
237 | attrs[i].sample_period = 1; | ||
238 | } | ||
239 | |||
240 | err = perf_evlist__add_attrs(evlist, attrs, nr_tracepoints); | ||
241 | out_free_attrs: | ||
242 | free(attrs); | ||
243 | return err; | ||
244 | } | ||
245 | |||
246 | struct perf_evsel * | 192 | struct perf_evsel * |
247 | perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id) | 193 | perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id) |
248 | { | 194 | { |
@@ -257,34 +203,6 @@ perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id) | |||
257 | return NULL; | 203 | return NULL; |
258 | } | 204 | } |
259 | 205 | ||
260 | int perf_evlist__set_tracepoints_handlers(struct perf_evlist *evlist, | ||
261 | const struct perf_evsel_str_handler *assocs, | ||
262 | size_t nr_assocs) | ||
263 | { | ||
264 | struct perf_evsel *evsel; | ||
265 | int err; | ||
266 | size_t i; | ||
267 | |||
268 | for (i = 0; i < nr_assocs; i++) { | ||
269 | err = trace_event__id(assocs[i].name); | ||
270 | if (err < 0) | ||
271 | goto out; | ||
272 | |||
273 | evsel = perf_evlist__find_tracepoint_by_id(evlist, err); | ||
274 | if (evsel == NULL) | ||
275 | continue; | ||
276 | |||
277 | err = -EEXIST; | ||
278 | if (evsel->handler.func != NULL) | ||
279 | goto out; | ||
280 | evsel->handler.func = assocs[i].handler; | ||
281 | } | ||
282 | |||
283 | err = 0; | ||
284 | out: | ||
285 | return err; | ||
286 | } | ||
287 | |||
288 | int perf_evlist__add_newtp(struct perf_evlist *evlist, | 206 | int perf_evlist__add_newtp(struct perf_evlist *evlist, |
289 | const char *sys, const char *name, void *handler) | 207 | const char *sys, const char *name, void *handler) |
290 | { | 208 | { |