Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 333958
b: refs/heads/master
c: 39876e7
h: refs/heads/master
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed Oct 3, 2012
1 parent 305f132 commit a2051e5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: de332ac40f69f4f18111d53817b46da73e1fcbf9
refs/heads/master: 39876e7dd385e0f0a438ee0ab13cf75a4f5e0e3b
18 changes: 3 additions & 15 deletions trunk/tools/perf/builtin-trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
14 changes: 14 additions & 0 deletions trunk/tools/perf/util/evlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,20 @@ int perf_evlist__set_tracepoints_handlers(struct perf_evlist *evlist,
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;
Expand Down
3 changes: 3 additions & 0 deletions trunk/tools/perf/util/evlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ int perf_evlist__set_tracepoints_handlers(struct perf_evlist *evlist,
#define perf_evlist__set_tracepoints_handlers_array(evlist, array) \
perf_evlist__set_tracepoints_handlers(evlist, array, ARRAY_SIZE(array))

int perf_evlist__add_newtp(struct perf_evlist *evlist,
const char *sys, const char *name, void *handler);

int perf_evlist__set_filter(struct perf_evlist *evlist, const char *filter);

struct perf_evsel *
Expand Down

0 comments on commit a2051e5

Please sign in to comment.