diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-10-03 11:40:22 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-10-03 11:41:22 -0300 |
commit | 39876e7dd385e0f0a438ee0ab13cf75a4f5e0e3b (patch) | |
tree | 70aade536c1561191cf80e103c21475100e682b6 /tools/perf/builtin-trace.c | |
parent | de332ac40f69f4f18111d53817b46da73e1fcbf9 (diff) |
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/builtin-trace.c')
-rw-r--r-- | tools/perf/builtin-trace.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 76b1202c03c8..dec8ced61fb0 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -200,24 +200,12 @@ static int trace__run(struct trace *trace) goto out; } - evsel = perf_evsel__newtp("raw_syscalls", "sys_enter", 0); - if (evsel == NULL) { - printf("Couldn't read the raw_syscalls:sys_enter tracepoint information!\n"); + if (perf_evlist__add_newtp(evlist, "raw_syscalls", "sys_enter", trace__sys_enter) || + perf_evlist__add_newtp(evlist, "raw_syscalls", "sys_exit", trace__sys_exit)) { + printf("Couldn't read the raw_syscalls tracepoints information!\n"); goto out_delete_evlist; } - evsel->handler.func = trace__sys_enter; - perf_evlist__add(evlist, evsel); - - evsel = perf_evsel__newtp("raw_syscalls", "sys_exit", 1); - if (evsel == NULL) { - printf("Couldn't read the raw_syscalls:sys_exit tracepoint information!\n"); - goto out_delete_evlist; - } - - evsel->handler.func = trace__sys_exit; - perf_evlist__add(evlist, evsel); - err = perf_evlist__create_maps(evlist, &trace->opts.target); if (err < 0) { printf("Problems parsing the target to trace, check your options!\n"); |