summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/evlist.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-10-03 11:40:22 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-10-03 11:41:22 -0300
commit39876e7dd385e0f0a438ee0ab13cf75a4f5e0e3b (patch)
tree70aade536c1561191cf80e103c21475100e682b6 /tools/perf/util/evlist.c
parentde332ac40f69f4f18111d53817b46da73e1fcbf9 (diff)
downloadop-kernel-dev-39876e7dd385e0f0a438ee0ab13cf75a4f5e0e3b.zip
op-kernel-dev-39876e7dd385e0f0a438ee0ab13cf75a4f5e0e3b.tar.gz
perf evlist: Introduce add_newtp method
To reduce the boilerplate of creating and adding a new tracepoint to an evlist. 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-4z90i79gnmsza2czv2dhdrb7@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.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index ae89686..6a2809f 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -285,6 +285,20 @@ out:
return err;
}
+int perf_evlist__add_newtp(struct perf_evlist *evlist,
+ const char *sys, const char *name, void *handler)
+{
+ struct perf_evsel *evsel;
+
+ evsel = perf_evsel__newtp(sys, name, evlist->nr_entries);
+ if (evsel == NULL)
+ return -1;
+
+ evsel->handler.func = handler;
+ perf_evlist__add(evlist, evsel);
+ return 0;
+}
+
void perf_evlist__disable(struct perf_evlist *evlist)
{
int cpu, thread;
OpenPOWER on IntegriCloud