perf trace: Allow specifying names to syscall arguments formatters

For tracepointless syscalls, like clone, otherwise get them from the
tracepoint's /format file.

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: http://lkml.kernel.org/n/tip-ml5qvv1w5k96ghwhxpzzsmm3@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 332337da
...@@ -604,6 +604,7 @@ static size_t syscall_arg__scnprintf_getrandom_flags(char *bf, size_t size, ...@@ -604,6 +604,7 @@ static size_t syscall_arg__scnprintf_getrandom_flags(char *bf, size_t size,
struct syscall_arg_fmt { struct syscall_arg_fmt {
size_t (*scnprintf)(char *bf, size_t size, struct syscall_arg *arg); size_t (*scnprintf)(char *bf, size_t size, struct syscall_arg *arg);
void *parm; void *parm;
const char *name;
bool show_zero; bool show_zero;
}; };
...@@ -1349,6 +1350,15 @@ unsigned long syscall_arg__val(struct syscall_arg *arg, u8 idx) ...@@ -1349,6 +1350,15 @@ unsigned long syscall_arg__val(struct syscall_arg *arg, u8 idx)
return val; return val;
} }
static size_t syscall__scnprintf_name(struct syscall *sc, char *bf, size_t size,
struct syscall_arg *arg)
{
if (sc->arg_fmt && sc->arg_fmt[arg->idx].name)
return scnprintf(bf, size, "%s: ", sc->arg_fmt[arg->idx].name);
return scnprintf(bf, size, "arg%d: ", arg->idx);
}
static size_t syscall__scnprintf_val(struct syscall *sc, char *bf, size_t size, static size_t syscall__scnprintf_val(struct syscall *sc, char *bf, size_t size,
struct syscall_arg *arg, unsigned long val) struct syscall_arg *arg, unsigned long val)
{ {
...@@ -1421,8 +1431,9 @@ static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size, ...@@ -1421,8 +1431,9 @@ static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size,
if (arg.mask & bit) if (arg.mask & bit)
goto next_arg; goto next_arg;
val = syscall_arg__val(&arg, arg.idx); val = syscall_arg__val(&arg, arg.idx);
printed += scnprintf(bf + printed, size - printed, if (printed)
"%sarg%d: ", printed ? ", " : "", arg.idx); printed += scnprintf(bf + printed, size - printed, ", ");
printed += syscall__scnprintf_name(sc, bf + printed, size - printed, &arg);
printed += syscall__scnprintf_val(sc, bf + printed, size - printed, &arg, val); printed += syscall__scnprintf_val(sc, bf + printed, size - printed, &arg, val);
next_arg: next_arg:
++arg.idx; ++arg.idx;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册