perf trace: Associate more argument names with the filename beautifier

For instance, the rename* family uses "oldname", "newname", so check if
"name" is at the end and treat it as a filename.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-wjy7j4bk06g7atzwoz1mid24@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 8195168e
...@@ -1431,10 +1431,11 @@ static int syscall__set_arg_fmts(struct syscall *sc) ...@@ -1431,10 +1431,11 @@ static int syscall__set_arg_fmts(struct syscall *sc)
if (sc->fmt && sc->fmt->arg[idx].scnprintf) if (sc->fmt && sc->fmt->arg[idx].scnprintf)
continue; continue;
len = strlen(field->name);
if (strcmp(field->type, "const char *") == 0 && if (strcmp(field->type, "const char *") == 0 &&
(strcmp(field->name, "filename") == 0 || ((len >= 4 && strcmp(field->name + len - 4, "name") == 0) ||
strcmp(field->name, "path") == 0 || strstr(field->name, "path") != NULL))
strcmp(field->name, "pathname") == 0))
sc->arg_fmt[idx].scnprintf = SCA_FILENAME; sc->arg_fmt[idx].scnprintf = SCA_FILENAME;
else if ((field->flags & TEP_FIELD_IS_POINTER) || strstr(field->name, "addr")) else if ((field->flags & TEP_FIELD_IS_POINTER) || strstr(field->name, "addr"))
sc->arg_fmt[idx].scnprintf = SCA_PTR; sc->arg_fmt[idx].scnprintf = SCA_PTR;
...@@ -1445,8 +1446,7 @@ static int syscall__set_arg_fmts(struct syscall *sc) ...@@ -1445,8 +1446,7 @@ static int syscall__set_arg_fmts(struct syscall *sc)
else if ((strcmp(field->type, "int") == 0 || else if ((strcmp(field->type, "int") == 0 ||
strcmp(field->type, "unsigned int") == 0 || strcmp(field->type, "unsigned int") == 0 ||
strcmp(field->type, "long") == 0) && strcmp(field->type, "long") == 0) &&
(len = strlen(field->name)) >= 2 && len >= 2 && strcmp(field->name + len - 2, "fd") == 0) {
strcmp(field->name + len - 2, "fd") == 0) {
/* /*
* /sys/kernel/tracing/events/syscalls/sys_enter* * /sys/kernel/tracing/events/syscalls/sys_enter*
* egrep 'field:.*fd;' .../format|sed -r 's/.*field:([a-z ]+) [a-z_]*fd.+/\1/g'|sort|uniq -c * egrep 'field:.*fd;' .../format|sed -r 's/.*field:([a-z ]+) [a-z_]*fd.+/\1/g'|sort|uniq -c
......
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