perf trace: Use perf_evsel__sc_tp_{uint,ptr} for "id"/"args" handling syscalls:* events

Now it looks just about the same as for the trace__sys_{enter,exit}.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-y59may7zx1eccnp4m3qm4u0b@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent d32855fa
...@@ -1693,20 +1693,13 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel, ...@@ -1693,20 +1693,13 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel,
static int trace__fprintf_sys_enter(struct trace *trace, struct perf_evsel *evsel, static int trace__fprintf_sys_enter(struct trace *trace, struct perf_evsel *evsel,
struct perf_sample *sample) struct perf_sample *sample)
{ {
struct format_field *field = perf_evsel__field(evsel, "__syscall_nr");
struct thread_trace *ttrace; struct thread_trace *ttrace;
struct thread *thread; struct thread *thread;
struct syscall *sc; int id = perf_evsel__sc_tp_uint(evsel, id, sample), err = -1;
struct syscall *sc = trace__syscall_info(trace, evsel, id);
char msg[1024]; char msg[1024];
int id, err = -1;
void *args; void *args;
if (field == NULL)
return -1;
id = format_field__intval(field, sample, evsel->needs_swap);
sc = trace__syscall_info(trace, evsel, id);
if (sc == NULL) if (sc == NULL)
return -1; return -1;
...@@ -1719,7 +1712,7 @@ static int trace__fprintf_sys_enter(struct trace *trace, struct perf_evsel *evse ...@@ -1719,7 +1712,7 @@ static int trace__fprintf_sys_enter(struct trace *trace, struct perf_evsel *evse
if (ttrace == NULL) if (ttrace == NULL)
goto out_put; goto out_put;
args = sample->raw_data + field->offset + sizeof(u64); /* skip __syscall_nr, there is where args are */ args = perf_evsel__sc_tp_ptr(evsel, args, sample);
syscall__scnprintf_args(sc, msg, sizeof(msg), args, trace, thread); syscall__scnprintf_args(sc, msg, sizeof(msg), args, trace, thread);
fprintf(trace->output, "%s", msg); fprintf(trace->output, "%s", msg);
err = 0; err = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment