aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2013-08-29 00:29:51 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-08-29 16:41:02 -0400
commita2f2804a7142b043dafd39f21b86777840e1a78c (patch)
tree43809e0ec0c83a81136af60e4fc304b9d8406d63 /tools
parent045f8cd8542d2fcd424a32fa10fcd3dd29c6d374 (diff)
perf evlist: Add tracepoint lookup by name
Will be used by upcoming perf-trace replay option. Signed-off-by: David Ahern <dsahern@gmail.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1377750593-48046-2-git-send-email-dsahern@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/evlist.c15
-rw-r--r--tools/perf/util/evlist.h4
2 files changed, 19 insertions, 0 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 6a629af51376..5df4ca91bed3 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)
208 return NULL; 208 return NULL;
209} 209}
210 210
211struct perf_evsel *
212perf_evlist__find_tracepoint_by_name(struct perf_evlist *evlist,
213 const char *name)
214{
215 struct perf_evsel *evsel;
216
217 list_for_each_entry(evsel, &evlist->entries, node) {
218 if ((evsel->attr.type == PERF_TYPE_TRACEPOINT) &&
219 (strcmp(evsel->name, name) == 0))
220 return evsel;
221 }
222
223 return NULL;
224}
225
211int perf_evlist__add_newtp(struct perf_evlist *evlist, 226int perf_evlist__add_newtp(struct perf_evlist *evlist,
212 const char *sys, const char *name, void *handler) 227 const char *sys, const char *name, void *handler)
213{ 228{
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index ab95d7273638..841a39405f6a 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -74,6 +74,10 @@ int perf_evlist__set_filter(struct perf_evlist *evlist, const char *filter);
74struct perf_evsel * 74struct perf_evsel *
75perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id); 75perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id);
76 76
77struct perf_evsel *
78perf_evlist__find_tracepoint_by_name(struct perf_evlist *evlist,
79 const char *name);
80
77void perf_evlist__id_add(struct perf_evlist *evlist, struct perf_evsel *evsel, 81void perf_evlist__id_add(struct perf_evlist *evlist, struct perf_evsel *evsel,
78 int cpu, int thread, u64 id); 82 int cpu, int thread, u64 id);
79 83