>From 5e1fbde04a2a8745711f439f4d4682b2215119b2 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Fri, 15 Jun 2012 11:49:47 +0400 Subject: [PATCH] perf: lookup by event name Assuming event names are set, lookup tracepoint by name instead of ID. Signed-off-by: Dmitry Antipov --- tools/perf/util/evlist.c | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 7400fb3..d6b7262 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -225,13 +225,13 @@ out_free_attrs: } static struct perf_evsel * - perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id) + perf_evlist__find_tracepoint_by_name(struct perf_evlist *evlist, const char *name) { struct perf_evsel *evsel; list_for_each_entry(evsel, &evlist->entries, node) { if (evsel->attr.type == PERF_TYPE_TRACEPOINT && - (int)evsel->attr.config == id) + !strcmp(evsel->name, name)) return evsel; } @@ -247,11 +247,7 @@ int perf_evlist__set_tracepoints_handlers(struct perf_evlist *evlist, size_t i; for (i = 0; i < nr_assocs; i++) { - err = trace_event__id(assocs[i].name); - if (err < 0) - goto out; - - evsel = perf_evlist__find_tracepoint_by_id(evlist, err); + evsel = perf_evlist__find_tracepoint_by_name(evlist, assocs[i].name); if (evsel == NULL) continue; -- 1.7.7.6