From a2f2804a7142b043dafd39f21b86777840e1a78c Mon Sep 17 00:00:00 2001 From: David Ahern Date: Wed, 28 Aug 2013 22:29:51 -0600 Subject: perf evlist: Add tracepoint lookup by name Will be used by upcoming perf-trace replay option. Signed-off-by: David Ahern Cc: Adrian Hunter Cc: Frederic Weisbecker Cc: Mike Galbraith Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1377750593-48046-2-git-send-email-dsahern@gmail.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/evlist.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tools/perf/util/evlist.c') diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 6a629af5137..5df4ca91bed 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -208,6 +208,21 @@ perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id) return NULL; } +struct perf_evsel * +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) && + (strcmp(evsel->name, name) == 0)) + return evsel; + } + + return NULL; +} + int perf_evlist__add_newtp(struct perf_evlist *evlist, const char *sys, const char *name, void *handler) { -- cgit v1.2.3-70-g09d2