Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf trace: Allow suppressing the syscall argument names

To show just the values:

Default:

# trace -e open*,close,*sleep sleep 1
openat(dfd: CWD, filename: /etc/ld.so.cache, flags: CLOEXEC ) = 3
close(fd: 3 ) = 0
openat(dfd: CWD, filename: /lib64/libc.so.6, flags: CLOEXEC ) = 3
close(fd: 3 ) = 0
openat(dfd: CWD, filename: /usr/lib/locale/locale-archive, flags: CLOEXEC) = 3
close(fd: 3 ) = 0
nanosleep(rqtp: 0x7ffc0c4ea0d0, rmtp: 0 ) = 0
close(fd: 1 ) = 0
close(fd: 2 ) = 0
#

Remove it:

# perf config trace.show_arg_names=no
# trace -e open*,close,*sleep sleep 1
openat(CWD, /etc/ld.so.cache, CLOEXEC ) = 3
close(3 ) = 0
openat(CWD, /lib64/libc.so.6, CLOEXEC ) = 3
close(3 ) = 0
openat(CWD, /usr/lib/locale/locale-archive, CLOEXEC ) = 3
close(3 ) = 0
nanosleep(0x7ffced3a8c40, 0 ) = 0
close(1 ) = 0
close(2 ) = 0
#

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-ta9tbdwgodpw719sr2bjm8eb@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+22 -4
+4
tools/perf/Documentation/perf-config.txt
··· 532 532 trace.no_inherit:: 533 533 Do not follow children threads. 534 534 535 + trace.show_arg_names:: 536 + Should syscall argument names be printed? If not then trace.show_zeros 537 + will be set. 538 + 535 539 trace.show_duration:: 536 540 Show syscall duration. 537 541
+18 -4
tools/perf/builtin-trace.c
··· 130 130 bool show_tstamp; 131 131 bool show_duration; 132 132 bool show_zeros; 133 + bool show_arg_names; 133 134 bool force; 134 135 bool vfs_getname; 135 136 int trace_pgfaults; ··· 1614 1613 sc->arg_fmt[arg.idx].parm)) 1615 1614 continue; 1616 1615 1617 - printed += scnprintf(bf + printed, size - printed, 1618 - "%s%s: ", printed ? ", " : "", field->name); 1616 + printed += scnprintf(bf + printed, size - printed, "%s", printed ? ", " : ""); 1617 + 1618 + if (trace->show_arg_names) 1619 + printed += scnprintf(bf + printed, size - printed, "%s: ", field->name); 1620 + 1619 1621 printed += syscall__scnprintf_val(sc, bf + printed, size - printed, &arg, val); 1620 1622 } 1621 1623 } else if (IS_ERR(sc->tp_format)) { ··· 3550 3546 trace->show_tstamp = perf_config_bool(var, value); 3551 3547 } else if (!strcmp(var, "trace.show_duration")) { 3552 3548 trace->show_duration = perf_config_bool(var, value); 3549 + } else if (!strcmp(var, "trace.show_arg_names")) { 3550 + trace->show_arg_names = perf_config_bool(var, value); 3551 + if (!trace->show_arg_names) 3552 + trace->show_zeros = true; 3553 3553 } else if (!strcmp(var, "trace.show_zeros")) { 3554 - trace->show_zeros = perf_config_bool(var, value); 3554 + bool new_show_zeros = perf_config_bool(var, value); 3555 + if (!trace->show_arg_names && !new_show_zeros) { 3556 + pr_warning("trace.show_zeros has to be set when trace.show_arg_names=no\n"); 3557 + goto out; 3558 + } 3559 + trace->show_zeros = new_show_zeros; 3555 3560 } else if (!strcmp(var, "trace.no_inherit")) { 3556 3561 trace->opts.no_inherit = perf_config_bool(var, value); 3557 3562 } 3558 - 3563 + out: 3559 3564 return err; 3560 3565 } 3561 3566 ··· 3595 3582 .show_comm = true, 3596 3583 .show_tstamp = true, 3597 3584 .show_duration = true, 3585 + .show_arg_names = true, 3598 3586 .trace_syscalls = false, 3599 3587 .kernel_syscallchains = false, 3600 3588 .max_stack = UINT_MAX,